1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-20 11:11:24 +00:00

Do not mark shared structures as __packed, it leads to race condition

If structure packed as __packed clang (and probably gcc) generates
code that loads word fields (e.g. tx_pos)  byte-by-byte and if it's
modified by VideoCore in the same time as ARM loads the value result
is going to be mixed combination of bytes from previous value and
new one.
This commit is contained in:
Oleksandr Tymoshenko 2015-02-09 02:31:27 +00:00
parent e6bf0bdb36
commit 10e99e6057
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=278431

View File

@ -280,7 +280,7 @@ typedef struct vchiq_slot_info_struct {
/* Use two counters rather than one to avoid the need for a mutex. */
short use_count;
short release_count;
} __packed VCHIQ_SLOT_INFO_T; /* XXXGONZO: check it */
} VCHIQ_SLOT_INFO_T;
typedef struct vchiq_service_struct {
VCHIQ_SERVICE_BASE_T base;
@ -381,7 +381,7 @@ typedef struct vchiq_shared_state_struct {
/* Debugging state */
int debug[DEBUG_MAX];
} __packed VCHIQ_SHARED_STATE_T;
} VCHIQ_SHARED_STATE_T;
typedef struct vchiq_slot_zero_struct {
int magic;
@ -395,7 +395,7 @@ typedef struct vchiq_slot_zero_struct {
VCHIQ_SHARED_STATE_T master;
VCHIQ_SHARED_STATE_T slave;
VCHIQ_SLOT_INFO_T slots[VCHIQ_MAX_SLOTS];
} __packed VCHIQ_SLOT_ZERO_T;
} VCHIQ_SLOT_ZERO_T;
struct vchiq_state_struct {
int id;