From: Ian Jackson Subject: Re: [PATCH 4/4] xen/public: arm: rework the macro set_xen_guest_handle_raw Date: Wed, 4 Nov 2015 15:45:39 +0000 Message-ID: <22074.10275.649457.518288@mariner.uk.xensource.com> References: <1446228813-2593-1-git-send-email-julien.grall@citrix.com> <1446228813-2593-5-git-send-email-julien.grall@citrix.com> <1446554124.10390.19.camel@citrix.com> <5638BE43.4080607@citrix.com> <1446561267.10390.48.camel@citrix.com> <5639E949.6020800@citrix.com> <1446636465.6461.70.camel@citrix.com> <5639EEB6.6040908@citrix.com> <22074.8785.429075.239501@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Zu0Fw-0005nD-UD for xen-devel@lists.xenproject.org; Wed, 04 Nov 2015 15:45:49 +0000 In-Reply-To: <22074.8785.429075.239501@mariner.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Stefano Stabellini , Julien Grall , Ian Campbell , xen-devel@lists.xenproject.org, Keir Fraser , Jan Beulich , Tim Deegan List-Id: xen-devel@lists.xenproject.org Ian Jackson writes ("Re: [Xen-devel] [PATCH 4/4] xen/public: arm: rework the macro set_xen_guest_handle_raw"): > Stefano Stabellini writes ("Re: [Xen-devel] [PATCH 4/4] xen/public: arm: rework the macro set_xen_guest_handle_raw"): > > Finally, based on the defect report #283 [2], the behavior of writing > > from one member and reading from another is not clear. > > Because the hypervisor is compiled with -fno-strict-aliasing. Incidentally, it is _necessary_ to write to the uint64_t last. C99 6.2.6.1(5) says that if you write to the 32-bit pointer, the upper bits (corresponding to the uint64 but not part of the pointer) take on unspecified values. So writing the 32-bit pointer always invalidates the top bits, so if you write to the uint64_t first, the 32-bit write makes the 64-bit write a dead store. Ian.