Skip to content

Commit

Permalink
x86/tdx: Fix data leak in mmio_read()
Browse files Browse the repository at this point in the history
The mmio_read() function makes a TDVMCALL to retrieve MMIO data for an
address from the VMM.

Sean noticed that mmio_read() unintentionally exposes the value of an
initialized variable (val) on the stack to the VMM.

This variable is only needed as an output value. It did not need to be
passed to the VMM in the first place.

Do not send the original value of *val to the VMM.

[ dhansen: clarify what 'val' is used for. ]

Fixes: 31d58c4 ("x86/tdx: Handle in-kernel MMIO")
Reported-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Cc:stable@vger.kernel.org
Link: https://lore.kernel.org/all/20240826125304.1566719-1-kirill.shutemov%40linux.intel.com
  • Loading branch information
Kirill A. Shutemov authored and Dave Hansen committed Aug 26, 2024
1 parent ea72ce5 commit b6fb565
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion arch/x86/coco/tdx/tdx.c
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,6 @@ static bool mmio_read(int size, unsigned long addr, unsigned long *val)
.r12 = size,
.r13 = EPT_READ,
.r14 = addr,
.r15 = *val,
};

if (__tdx_hypercall(&args))
Expand Down

0 comments on commit b6fb565

Please sign in to comment.