mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: "Kalra, Ashish" <ashish.kalra@amd.com>
Cc: nikunj@amd.com, tglx@kernel.org, mingo@redhat.com,
	dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com,
	thomas.lendacky@amd.com, Srikanth.Aithal@amd.com,
	kvm@vger.kernel.org, linux-coco@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] x86/sev: Skip DR7 write during kexec when it would trigger an unserviceable #VC
Date: Tue, 24 Nov 2026 20:19:25 -0800	[thread overview]
Message-ID: <20261125041925.GCawZhzVbU3ngXnt5c@fat_crate.local> (raw)
In-Reply-To: <47cb97d1-5919-4ee7-ad67-6039551304d6@amd.com>

On Mon, Nov 23, 2026 at 06:22:09PM -0600, Kalra, Ashish wrote:
> On the "bogus VMGEXIT": before Nikunj's change, __sev_get_ghcb() returned
> the per-CPU GHCB, which snp_kexec_finish() had already converted back to
> private. The host mapped that GPA, read ciphertext (exit code 0) and
> returned GHCB_ERR_MISSING_INPUT, but couldn't write the result into the
> private page, so the guest saw its own stale contents, treated the call as
> successful and moved on. The DR7 write was simply dropped. It worked by
> accident.

Oh lovely.

> As for using do_vc_no_ghcb(): the GHCB MSR protocol requests are meant for
> specific guest-initiated operations (protocol negotiation, GHCB
> registration, page state changes, termination, etc.). The only one that
> corresponds to an intercepted instruction is CPUID, which is why
> do_vc_no_ghcb() handles only the CPUID exit code and terminates the guest
> for anything else. There's no MSR-protocol equivalent of a DR7 write, so the
> no-GHCB #VC handler can't handle it.

Well, can you fashion something with VMEXIT_DR7_WRITE and a dummy GHCB MSR request
to the HV which is innocuous, just so that it can satisfy the flow?

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

  reply	other threads:[~2026-11-25  4:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16 23:03 Ashish Kalra
2026-11-17  7:10 ` Aithal, Srikanth
2026-11-23 23:43 ` Borislav Petkov
2026-11-24  0:22   ` Kalra, Ashish
2026-11-25  4:19     ` Borislav Petkov [this message]
2026-11-24  8:55   ` Nikunj A. Dadhania

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=20261125041925.GCawZhzVbU3ngXnt5c@fat_crate.local \
    --to=bp@alien8.de \
    --cc=Srikanth.Aithal@amd.com \
    --cc=ashish.kalra@amd.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-coco@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=nikunj@amd.com \
    --cc=tglx@kernel.org \
    --cc=thomas.lendacky@amd.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®