mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Ard Biesheuvel" <ardb@kernel.org>
To: "Kiryl Shutsemau (Meta)" <kas@kernel.org>,
	"Yan Y Zhao" <yan.y.zhao@intel.com>
Cc: "Rick Edgecombe" <rick.p.edgecombe@intel.com>,
	"linux-efi@vger.kernel.org" <linux-efi@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"x86@kernel.org" <x86@kernel.org>,
	"Borislav Petkov" <bp@alien8.de>
Subject: Re: [PATCH 0/3] Move memory acceptance x86 arch code into EFI stub
Date: Wed, 23 Sep 2026 16:34:47 +0200	[thread overview]
Message-ID: <b9ff9e11-d7da-4e34-9744-e3adcc786276@app.fastmail.com> (raw)
In-Reply-To: <aq0VWfqv2_SgOvV9@thinkstation>



On Fri, 18 Sep 2026, at 12:45, Kiryl Shutsemau wrote:
> On Fri, Sep 18, 2026 at 01:28:56PM +0800, Yan Zhao wrote:
>> On Fri, Sep 18, 2026 at 10:12:10AM +0800, Yan Zhao wrote:
>> > On Fri, Sep 18, 2026 at 02:29:55AM +0800, Edgecombe, Rick P wrote:
>> > > +Yan 
>> > > 
>> > > On Thu, 2026-09-17 at 14:32 +0100, Kiryl Shutsemau wrote:
>> > > > > I guess the caller could care about TDX_PAGE_ALREADY_ACCEPTED errors. But
>> > > > > SNP
>> > > > > doesn't do anything for this case. It seems like part of the problem is that
>> > > > > we
>> > > > > are passing errors back that the caller can't feasibly handle.
>> > > > 
>> > > > Maybe. I don't understand SNP model and why they don't care about errors
>> > > > here.
>> > > > 
>> > > > Do you have a proposal here?
>> > > 
>> > > Yan pointed out that future TDX modules will not take an S-EPT entry lock on
>> > > accepting a NP S-EPT entry. However, I think this won't prevent guest caused
>> > > busys on re-accept attempts?
>> > Re-accept attempts may occur due to:
>> > (a) two concurrent ACCEPT TDCALLs, where the one that arrives slightly later
>> >     returns either TDACCEPT_ALREADY_ACCEPTED or TDX_OPERAND_BUSY.
>> > (b) two successive ACCEPT TDCALLs on the same GPA.
>> > 
>> > Since Linux guest always invokes ACCEPT TDCALL before a memory access, and
>> > accept_memory() always checks the unaccepted_table->bitmap before invoking the
>> > ACCEPT TDCALL, case (b) should be impossible in practice, right?
>> > 
>> > Is case (a) a valid scenario, and does it actually occur in a Linux guest?
>> Case (a) should be prevented by the unaccepted_memory_lock in accept_memory(),
>> right?
>
> Right, for accept_memory().
>
> The lock itself is dropped around the TDCALL, but the range stays on
> accepting_list until the bits are cleared, and the overlap check is done
> in unit_size granularity, so a second caller for the same unit spins
> until the first one is done and then finds the bits clear. Both (a) and
> (b) are covered there.
>
> There is a second ACCEPT issuer that does not look at the bitmap at
> all: shared->private conversion in tdx_enc_status_changed().
>
> It does not need the bitmap because the memory came from the page
> allocator or memblock and got accepted before it was handed out. It also
> has no per-range serialization; mem_enc_lock is only taken for read. So
> ALREADY_ACCEPTED on that path means either the guest converted the same
> range twice (a double-free class of bug) or the VMM acked MapGPA(shared)
> but never removed the private page. Either way the page there is the one
> the guest accepted earlier, and the failure already comes back as -EIO
> rather than a panic.
>

Is there any way we could make some progress here?

Ultimately, the thing I am after is to get rid of the call from the
decompressor to EFI stub's snprintf(), which I want to remove. For
the time being, I am more than happy leaving the memory acceptance where
it is, and just dropping the call to snprintf().


  reply	other threads:[~2026-09-23 14:35 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-14 18:37 Ard Biesheuvel
2026-09-14 18:37 ` [PATCH 1/3] x86/tdx: Share tdx_panic() with the " Ard Biesheuvel
2026-09-15  0:02   ` Borislav Petkov
2026-09-15  3:11   ` Borislav Petkov
2026-09-16  7:05     ` Ard Biesheuvel
2026-09-14 18:37 ` [PATCH 2/3] x86/boot: Move unaccepted memory handling out of the decompressor Ard Biesheuvel
2026-09-14 18:37 ` [PATCH 3/3] x86/boot: Drop unused implementation of panic() Ard Biesheuvel
2026-09-14 23:26 ` [PATCH 0/3] Move memory acceptance x86 arch code into EFI stub Borislav Petkov
2026-09-16 18:16 ` Edgecombe, Rick P
2026-09-17 13:32   ` Kiryl Shutsemau
2026-09-17 18:29     ` Edgecombe, Rick P
2026-09-17 23:19       ` Ard Biesheuvel
2026-09-17 23:52         ` Edgecombe, Rick P
2026-09-18  2:12       ` Yan Zhao
2026-09-18  5:28         ` Yan Zhao
2026-09-18 10:45           ` Kiryl Shutsemau
2026-09-23 14:34             ` Ard Biesheuvel [this message]
2026-09-24 11:46               ` Kiryl Shutsemau

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=b9ff9e11-d7da-4e34-9744-e3adcc786276@app.fastmail.com \
    --to=ardb@kernel.org \
    --cc=bp@alien8.de \
    --cc=kas@kernel.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rick.p.edgecombe@intel.com \
    --cc=x86@kernel.org \
    --cc=yan.y.zhao@intel.com \
    /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®