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

Re: [PATCH] xen/arm: ffa: Harden SEND2 against invented loads


  • To: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • From: "Orzel, Michal" <michal.orzel@xxxxxxx>
  • Date: Wed, 19 Aug 2026 10:09:22 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=arm.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=ElBOtEt8QuWxXRD7KgiNEGsI3yTM46XD66HgmSF/09s=; b=HEIxouBnvG/RlC/GpvXWW44XpDVVZk/BegKrecKxSGjxhDw1vLe1piq2CmFovY4e+sZkYMDqYdrA5mbHXgEkLbgVQWivG4quVvcr37coVy86eTfEiDwtNBsZFMtxw6ol23qrWYAMA3Gup0b4uJQhDMQ7jMq+8BJqeYOFQttFlaAldPsc9PjXMt7Y+h7XQmxA/YVrslMBlg4CZRntGdh7FBIxo6hjTSn91tm8tXT2kuC7AK0Tqv21O9jPOafhQBHcD9z58lv8A9yXwCzHEiof1pwc6A/9J4w6tLkeOVCQFt2E8DFfpm6wvK2EVe2tREZ6+fxqxfcs29ruz+6nK/0BAQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=a0W0FQN3znL9XDgjauVQBtrY7/wfswEeprm2/u/psJUIDVf7O3VDQY80PtL7gMTtFSwwGirMvAgQoD+Wq/NicjRn2glRSPThgmnIaZGLlYwt5kIajNrGrpyYg6fGhDcYvf3dMF+ukqI01Pub3uhFHirLTL9ddcK3tZpUprhtgMegdFPLgOouJvO7hsBeEQmWDdLA2XPOxzDWGwZeTxX89TuxbVjwF9KsYVS9R8b6itQFX0RqdzfvR5ZIP6MZ3tnyMVdgD1y/mB3wtfP8+OHOPRI8BxSh8cS7bSg4VHw9z74/sVeWdFSD4XFUxCpDTpYKekbSUwrQEax+8o7s9DsGCg==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=amd.com header.i="@amd.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>, Jens Wiklander <jenswi@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>
  • Delivery-date: Wed, 19 Aug 2026 08:11:14 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


On 19-Aug-26 10:01, Bertrand Marquis wrote:
> Hi Michal,
> 
>> On 19 Aug 2026, at 09:47, Orzel, Michal <Michal.Orzel@xxxxxxx> wrote:
>>
>>
>>
>> On 18-Aug-26 14:16, Bertrand Marquis wrote:
>>> Research into compiler-invented loads has flagged FFA_MSG_SEND2 as a
>>> possible vulnerability.
>>>
>>> ffa_handle_msg_send2() copies the message header from the guest-writable
>>> TX buffer before validating and using its fields. A plain structure copy
>>> does not prevent the compiler from re-deriving later field accesses from
>>> the live TX mapping.
>>>
>>> For VM-to-VM messages, msg_offset and msg_size are validated against the
>>> source and destination buffers, then used to copy the payload. If a
>>> sibling vCPU changes the header and the compiler reloads either field,
>>> the checked and used values can differ. This can cause an out-of-bounds
>>> read from the sender's TX buffer or an out-of-bounds write into the
>>> receiver's RX buffer.
>>>
>>> The cross-VM path is gated by CONFIG_FFA_VM_TO_VM, which is disabled by
>>> default. The audit ranks the likelihood of such a reload as low, but the
>>> C semantics do not guarantee that later accesses use the stack copy.
>>>
>>> Add a compiler barrier immediately after copying the header so that
>>> validation and use consume the same snapshot.
>>>
>>> Link: 
>>> https://github.com/xoreaxeaxeax/schrodingers-toctou/blob/main/observer-effect/audits/audit-xen-tee-mediator-RELEASE-4.21.1.md#tm-2--ff-a-txrx-buffers-ffa_shmc-ffa_msgc
>>> Fixes: 98af565b1e61 ("xen/arm: ffa: Add indirect message between VM")
>>> Signed-off-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>
>>> ---
>>> xen/arch/arm/tee/ffa_msg.c | 5 +++++
>>> 1 file changed, 5 insertions(+)
>>>
>>> diff --git a/xen/arch/arm/tee/ffa_msg.c b/xen/arch/arm/tee/ffa_msg.c
>>> index 1eadc62870f2..39f561c8237f 100644
>>> --- a/xen/arch/arm/tee/ffa_msg.c
>>> +++ b/xen/arch/arm/tee/ffa_msg.c
>>> @@ -257,6 +257,11 @@ int32_t ffa_handle_msg_send2(struct cpu_user_regs 
>>> *regs)
>>>
>>>     /* create a copy of the message header */
>>>     memcpy(&src_msg, tx_buf, sizeof(src_msg));
>>> +    /*
>>> +     * Make sure that "tx_buf" which is shared with the guest isn't 
>>> accessed
>>> +     * again after this point.
>> This is a bit misleading because it *is* accessed in ffa_msg_send2_vm. The
>> comment should say what you wrote as the last paragraph in the commit msg.
> 
> Yes, this should be something around:
> Ensure validation and use of the message header use the same snapshot.
> 
> Do you agree ?
Yes. I'll fix on commit.

~Michal




 


Rackspace

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