Linux Confidential Computing Development
 help / color / mirror / Atom feed
* [PATCH] x86/tdx: Fix data leak in mmio_read()
@ 2024-08-26 12:53 Kirill A. Shutemov
  2024-08-26 16:41 ` Dave Hansen
  0 siblings, 1 reply; 3+ messages in thread
From: Kirill A. Shutemov @ 2024-08-26 12:53 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
	H. Peter Anvin
  Cc: linux-kernel, linux-coco, Kirill A. Shutemov, Sean Christopherson,
	stable

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 on the stack to the VMM.

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

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Reported-by: Sean Christopherson <seanjc@google.com>
Fixes: 31d58c4e557d ("x86/tdx: Handle in-kernel MMIO")
Cc: stable@vger.kernel.org # v5.19+
---
 arch/x86/coco/tdx/tdx.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/x86/coco/tdx/tdx.c b/arch/x86/coco/tdx/tdx.c
index 078e2bac2553..da8b66dce0da 100644
--- a/arch/x86/coco/tdx/tdx.c
+++ b/arch/x86/coco/tdx/tdx.c
@@ -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))
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86/tdx: Fix data leak in mmio_read()
  2024-08-26 12:53 [PATCH] x86/tdx: Fix data leak in mmio_read() Kirill A. Shutemov
@ 2024-08-26 16:41 ` Dave Hansen
  2024-08-26 19:44   ` Kirill A. Shutemov
  0 siblings, 1 reply; 3+ messages in thread
From: Dave Hansen @ 2024-08-26 16:41 UTC (permalink / raw)
  To: Kirill A. Shutemov, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, x86, H. Peter Anvin
  Cc: linux-kernel, linux-coco, Sean Christopherson, stable

On 8/26/24 05:53, Kirill A. Shutemov wrote:
> 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 on the stack to the VMM.
> 
> Do not send the original value of *val to the VMM.

The key to this is that 'val' is only used for the _return_ value, right?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86/tdx: Fix data leak in mmio_read()
  2024-08-26 16:41 ` Dave Hansen
@ 2024-08-26 19:44   ` Kirill A. Shutemov
  0 siblings, 0 replies; 3+ messages in thread
From: Kirill A. Shutemov @ 2024-08-26 19:44 UTC (permalink / raw)
  To: Dave Hansen
  Cc: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
	H. Peter Anvin, linux-kernel, linux-coco, Sean Christopherson,
	stable

On Mon, Aug 26, 2024 at 09:41:49AM -0700, Dave Hansen wrote:
> On 8/26/24 05:53, Kirill A. Shutemov wrote:
> > 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 on the stack to the VMM.
> > 
> > Do not send the original value of *val to the VMM.
> 
> The key to this is that 'val' is only used for the _return_ value, right?

Correct.

-- 
  Kiryl Shutsemau / Kirill A. Shutemov

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-08-26 19:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-26 12:53 [PATCH] x86/tdx: Fix data leak in mmio_read() Kirill A. Shutemov
2024-08-26 16:41 ` Dave Hansen
2024-08-26 19:44   ` Kirill A. Shutemov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox