Date: Mon, 9 Feb 2015 02:31:28 +0000 (UTC) From: Oleksandr Tymoshenko <gonzo@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r278431 - head/sys/contrib/vchiq/interface/vchiq_arm Message-ID: <201502090231.t192VS6C060751@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: gonzo Date: Mon Feb 9 02:31:27 2015 New Revision: 278431 URL: https://svnweb.freebsd.org/changeset/base/278431 Log: 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. Modified: head/sys/contrib/vchiq/interface/vchiq_arm/vchiq_core.h Modified: head/sys/contrib/vchiq/interface/vchiq_arm/vchiq_core.h ============================================================================== --- head/sys/contrib/vchiq/interface/vchiq_arm/vchiq_core.h Mon Feb 9 02:27:33 2015 (r278430) +++ head/sys/contrib/vchiq/interface/vchiq_arm/vchiq_core.h Mon Feb 9 02:31:27 2015 (r278431) @@ -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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201502090231.t192VS6C060751>