[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] x86emul: avoid UB shifts in FLDENV/FRSTOR handling


  • To: Jan Beulich <jbeulich@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jason Andryuk <jason.andryuk@xxxxxxx>
  • Date: Mon, 28 Apr 2025 17:24:16 -0400
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=suse.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Y3byd3yNyi0rP6Vcx1i8DXhRwYJnAy64H5JrqmQiWUQ=; b=B9FT533++skF0EYLOO7wRh/MsBWeXBUVIhB6y80k6WJNjZflWmbUyQu3hiu4OfPtXwoPhXcimGlJkDZ6Ypox40Z27xwaD/tO4/618iSblPJE/rk7LBrfcGWr0vRkkl4Y9ICMi5R0Q7qw79IecOamAALq2D+0YZMz2PbffWQPev8yVA5TRJbe5nTpBuUNEc0HQ64ot752p+xqUap+3eHSM0suyLBQPmWifB8f5Q5Wp6VtjK2WuS3/us17Iz5kKLUAywjqu1fhZKtPDrn0PtHzpO9ODi7DroCfLsd27yW98HJfL4sjcjGFMnJqeNMtfY+Fuo+TYq252jN7XHSOjfO7Hg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Z74swt1c2HTYw7aHxsFkaLteri5r12cLDvJhBbd6ksO2HGetYB1dohNrgsVbUPU3HLLsyrKvYj4JilzApur/lAOqd4FbwzGcSEKILLkPbMMYHLWI72kj1ek+SY5UNUtZ/ceIPBQHs+BPBVgynVXZOmS39LKnFSRxgc2StV1z/n+LOs2Zl8VhAU6UKQRmugj7Iq416UiSkHnhD2f8z4zpFil75QMT3t7YEFlHbG6uo7QbE+iFH2fhvf4LHyjEutp317lOu065Wx1QXlo45SXZm/Y7kZAYk4hRb7VmqEcSAbmsfhNsbW564aLYxdfmdyq+lzUy1Delofb2C+G/cb0hkQ==
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Fabian Specht <f.specht@xxxxxx>
  • Delivery-date: Mon, 28 Apr 2025 21:24:36 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 2025-04-28 07:29, Jan Beulich wrote:
16-bit quantities, no matter whether expressed as uint16_t or as
bitfield, will be promoted to plain int before doing any arithmetic on
them. Shifting such values by 16 will therefore shift into the sign bit,
which is UB if that bit becomes set. To account for all reads and all
writes accessing opposite members of the same union, introduce yet more
local variables to reduce the shift counts to 12.

Fixes: be55ed744ed8 ("x86emul: support FLDENV and FRSTOR")
Reported-by: Fabian Specht<f.specht@xxxxxx>
Signed-off-by: Jan Beulich<jbeulich@xxxxxxxx>

Reviewed-by: Jason Andryuk <jason.andryuk@xxxxxxx>

Thanks,
Jason



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.