From: Dave Hansen <dave.hansen@intel.com>
To: Sagi Shahar <sagis@google.com>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
Peter Zijlstra <peterz@infradead.org>,
Jun Nakajima <jun.nakajima@intel.com>,
Isaku Yamahata <isaku.yamahata@intel.com>,
Erdem Aktas <erdemaktas@google.com>,
Vishal Annapurve <vannapurve@google.com>,
Sean Christopherson <seanjc@google.com>,
Nikolay Borisov <nik.borisov@suse.com>,
"Jason A. Donenfeld" <Jason@zx2c4.com>,
Kuppuswamy Sathyanarayanan
<sathyanarayanan.kuppuswamy@linux.intel.com>,
"H. Peter Anvin" <hpa@zytor.com>,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86/tdx: Allow extended topology CPUID leafs to be emulated by hypercall
Date: Fri, 8 Sep 2023 15:24:15 -0700 [thread overview]
Message-ID: <fb81c0f4-5553-4c0d-89e3-3798405cdc7e@intel.com> (raw)
In-Reply-To: <CAAhR5DGUjeU=QoQdSXSLqaKiQ6U-Q8+sRQhnijHHtUtHfgh01Q@mail.gmail.com>
On 9/8/23 12:25, Sagi Shahar wrote:
> On Fri, Sep 8, 2023 at 11:00 AM Dave Hansen <dave.hansen@intel.com> wrote:
>>
>> On 9/8/23 10:56, Sagi Shahar wrote:
>>> The current TDX module does not handle extended topology leaves
>>> explicitly and will generate a #VE but the current #VE handler
>>> implementation blindly returns 0 for those CPUID leaves.
>>>
>>> This currently causes TDX guests to see 0 values when querying the numa
>>> topology leading to incorrect numa configurations.
>>>
>>> This patch fixes this behavior by emulating the extended topology leaves
>>> using the CPUID hypercall.
>>
>> ... and thus acquires the data from the untrusted VMM. Right?
>>
>> What are the security implications of consuming this untrusted data?
>
> The topology information is mostly used for performance optimizations
> on the guest side. I don't see any security implications if VMM passes
> incorrect values.
Oh, so I take it you did an audit and checked that no data structures
are sized or accessed based on this information.
Could you share some of your analysis, please? I'd love to see it in
the changelog.
> Right now, the guest is already using the returned 0 values and gets
> an incorrect numa topology leading to odd behavior in the guest. If we
> allow guests to read these values from the untrusted VMM and VMM
> spoofs the values, the worst that can happen is a different incorrect
> numa topology instead of the incorrect one we already have today.
I'm going to have to disagree with this logic a wee bit.
The 0's have *KNOWN*, *FIXED* behavior. It may stink, but it's known
and fixed and thoroughly unexploitable. If it were somehow exploited,
we would change it to another value that we control.
The VMM values are fundamentally different. They're dynamic and can be
maliciously crafted.
I'm actually not even sure how you're getting bad "NUMA" data out of
these leaves. The check_extended_topology_leaf() checks should fail
because ecx will be all 0's and SMT_TYPE==1, so the (LEAFB_SUBTYPE(ecx)
!= SMT_TYPE) condition will always hit.
I'm also not sure where the "numa topology" comment comes from. There's
a _lot_ of topology information in these leaves that's at a much finer
granularity than NUMA nodes. If you're getting errors on the console,
it would be spectacular to share those.
I have all kinds of guesses about what trouble this might be causing
you, but I'm a bad guesser.
next prev parent reply other threads:[~2023-09-08 22:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-08 17:56 Sagi Shahar
2023-09-08 18:00 ` Dave Hansen
2023-09-08 19:25 ` Sagi Shahar
2023-09-08 22:24 ` Dave Hansen [this message]
2023-09-09 10:14 ` Kirill A. Shutemov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fb81c0f4-5553-4c0d-89e3-3798405cdc7e@intel.com \
--to=dave.hansen@intel.com \
--cc=Jason@zx2c4.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=erdemaktas@google.com \
--cc=hpa@zytor.com \
--cc=isaku.yamahata@intel.com \
--cc=jun.nakajima@intel.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=nik.borisov@suse.com \
--cc=peterz@infradead.org \
--cc=sagis@google.com \
--cc=sathyanarayanan.kuppuswamy@linux.intel.com \
--cc=seanjc@google.com \
--cc=tglx@linutronix.de \
--cc=vannapurve@google.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®