Coconut-SVSM development mailing list
 help / color / mirror / Atom feed
* [svsm-devel] SVSM Host Kernel KVM Update Required
@ 2025-03-12  9:21 Jörg Rödel
  2025-03-12  9:36 ` Gupta, Pankaj
  0 siblings, 1 reply; 8+ messages in thread
From: Jörg Rödel @ 2025-03-12  9:21 UTC (permalink / raw)
  To: svsm-devel

Hi everyone,

As some of you already noticed there is a regression with the current
SVSM tree, as it does not boot the SVSM-kernel anymore on KVM with
SEV-SNP hardware. The problem was in our host kernel, for which I just
merged a fix. So please update your host environments with the updated
kernel if you experience this problem.

The reason for the breakage was a PR to unconditionally compile in the
shadow-stack code in all builds and do detection at runtime.
Unfortunately this broke on KVM because our SVSM Linux kernel tree does
still intercept all shadow-stack MSRs. So when COCONUT accesses these
MSRs it will cause a #VC exception and the kernel panics.

My fix disables the intercepts of the shadow-stack MSRs in our host
kernel. This is safe because Linux does only implement user
shadow-stacks so far and that state is switched via the FPU load/unload
path.

Regards,

	Joerg

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

* Re: [svsm-devel] SVSM Host Kernel KVM Update Required
  2025-03-12  9:21 [svsm-devel] SVSM Host Kernel KVM Update Required Jörg Rödel
@ 2025-03-12  9:36 ` Gupta, Pankaj
  2025-03-12  9:48   ` Gupta, Pankaj
  2025-03-12 10:02   ` Jörg Rödel
  0 siblings, 2 replies; 8+ messages in thread
From: Gupta, Pankaj @ 2025-03-12  9:36 UTC (permalink / raw)
  To: Jörg Rödel, svsm-devel

Hi Joerg,

Thanks for the headsup!

> Hi everyone,
> 
> As some of you already noticed there is a regression with the current
> SVSM tree, as it does not boot the SVSM-kernel anymore on KVM with
> SEV-SNP hardware. The problem was in our host kernel, for which I just
> merged a fix. So please update your host environments with the updated
> kernel if you experience this problem.
> 
> The reason for the breakage was a PR to unconditionally compile in the
> shadow-stack code in all builds and do detection at runtime.

Would you mind sharing the #PR? Now, I am wondering why I did not notice 
any no boot scenario at all.

Thanks,
Pankaj

> Unfortunately this broke on KVM because our SVSM Linux kernel tree does
> still intercept all shadow-stack MSRs. So when COCONUT accesses these
> MSRs it will cause a #VC exception and the kernel panics.
> 
> My fix disables the intercepts of the shadow-stack MSRs in our host
> kernel. This is safe because Linux does only implement user
> shadow-stacks so far and that state is switched via the FPU load/unload
> path.
> 
> Regards,
> 
> 	Joerg


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

* Re: [svsm-devel] SVSM Host Kernel KVM Update Required
  2025-03-12  9:36 ` Gupta, Pankaj
@ 2025-03-12  9:48   ` Gupta, Pankaj
  2025-03-12 10:02   ` Jörg Rödel
  1 sibling, 0 replies; 8+ messages in thread
From: Gupta, Pankaj @ 2025-03-12  9:48 UTC (permalink / raw)
  To: Jörg Rödel, svsm-devel


>> As some of you already noticed there is a regression with the current
>> SVSM tree, as it does not boot the SVSM-kernel anymore on KVM with
>> SEV-SNP hardware. The problem was in our host kernel, for which I just
>> merged a fix. So please update your host environments with the updated
>> kernel if you experience this problem.
>>
>> The reason for the breakage was a PR to unconditionally compile in the
>> shadow-stack code in all builds and do detection at runtime.
> 
> Would you mind sharing the #PR? Now, I am wondering why I did not notice 
> any no boot scenario at all.

I think i got it.

"cpu: compile for shadow stack support by default (PR #630)"

Thanks,
Pankaj


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

* Re: [svsm-devel] SVSM Host Kernel KVM Update Required
  2025-03-12  9:36 ` Gupta, Pankaj
  2025-03-12  9:48   ` Gupta, Pankaj
@ 2025-03-12 10:02   ` Jörg Rödel
  2025-03-12 14:33     ` Gupta, Pankaj
  1 sibling, 1 reply; 8+ messages in thread
From: Jörg Rödel @ 2025-03-12 10:02 UTC (permalink / raw)
  To: Gupta, Pankaj; +Cc: svsm-devel

Hi Pankaj,

On Wed, Mar 12, 2025 at 10:36:17AM +0100, Gupta, Pankaj wrote:
> Would you mind sharing the #PR? Now, I am wondering why I did not notice any
> no boot scenario at all.

The PR that triggered the breakage on the SVSM side was:

	https://github.com/coconut-svsm/svsm/pull/630

The PR removing the intercepts and fixing boot for the SVSM Linux
repository was:

	https://github.com/coconut-svsm/linux/pull/10

Note that part of the problem was that COCONUT determines CET support
by checking whether it can successfully change the CR4.CET bit. With a
CPUID check this would probably not have happened, but that early in the
SVSM boot process CPUID is not working yet.

Regards,

	Joerg

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

* Re: [svsm-devel] SVSM Host Kernel KVM Update Required
  2025-03-12 10:02   ` Jörg Rödel
@ 2025-03-12 14:33     ` Gupta, Pankaj
  2025-03-12 14:54       ` Jörg Rödel
  0 siblings, 1 reply; 8+ messages in thread
From: Gupta, Pankaj @ 2025-03-12 14:33 UTC (permalink / raw)
  To: Jörg Rödel; +Cc: svsm-devel

On 3/12/2025 11:02 AM, Jörg Rödel wrote:
> Hi Pankaj,
> 
> On Wed, Mar 12, 2025 at 10:36:17AM +0100, Gupta, Pankaj wrote:
>> Would you mind sharing the #PR? Now, I am wondering why I did not notice any
>> no boot scenario at all.
> 
> The PR that triggered the breakage on the SVSM side was:
> 
> 	https://github.com/coconut-svsm/svsm/pull/630
> 
> The PR removing the intercepts and fixing boot for the SVSM Linux
> repository was:
> 
> 	https://github.com/coconut-svsm/linux/pull/10
> 
> Note that part of the problem was that COCONUT determines CET support
> by checking whether it can successfully change the CR4.CET bit. With a
> CPUID check this would probably not have happened, but that early in the
> SVSM boot process CPUID is not working yet.

Thanks for sharing more details about the cause and fixing it!

So, the support was not working and got triggered when config check in 
'determine_cet_support()' was removed.

Best regards,
Pankaj


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

* Re: [svsm-devel] SVSM Host Kernel KVM Update Required
  2025-03-12 14:33     ` Gupta, Pankaj
@ 2025-03-12 14:54       ` Jörg Rödel
  2025-03-12 20:05         ` Gupta, Pankaj
  0 siblings, 1 reply; 8+ messages in thread
From: Jörg Rödel @ 2025-03-12 14:54 UTC (permalink / raw)
  To: Gupta, Pankaj; +Cc: svsm-devel

On Wed, Mar 12, 2025 at 03:33:15PM +0100, Gupta, Pankaj wrote:
> So, the support was not working and got triggered when config check in
> 'determine_cet_support()' was removed.

Right, actually it was broken before already when building with the
shadow-stack feature. But since this was not enabled by default nobody
noticed. With the feature check removed it triggered for everyone.

Regards,

	Joerg

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

* Re: [svsm-devel] SVSM Host Kernel KVM Update Required
  2025-03-12 14:54       ` Jörg Rödel
@ 2025-03-12 20:05         ` Gupta, Pankaj
  2025-03-13  5:54           ` Jörg Rödel
  0 siblings, 1 reply; 8+ messages in thread
From: Gupta, Pankaj @ 2025-03-12 20:05 UTC (permalink / raw)
  To: Jörg Rödel; +Cc: svsm-devel, Tom Lendacky, John Allen

+CC [Tom & John]

> On Wed, Mar 12, 2025 at 03:33:15PM +0100, Gupta, Pankaj wrote:
>> So, the support was not working and got triggered when config check in
>> 'determine_cet_support()' was removed.
> 
> Right, actually it was broken before already when building with the
> shadow-stack feature. But since this was not enabled by default nobody
> noticed. With the feature check removed it triggered for everyone.

O.k. Should the KVM fix also goto Upstream KVM as well?

Thanks,
Pankaj

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

* Re: [svsm-devel] SVSM Host Kernel KVM Update Required
  2025-03-12 20:05         ` Gupta, Pankaj
@ 2025-03-13  5:54           ` Jörg Rödel
  0 siblings, 0 replies; 8+ messages in thread
From: Jörg Rödel @ 2025-03-13  5:54 UTC (permalink / raw)
  To: Gupta, Pankaj; +Cc: svsm-devel, Tom Lendacky, John Allen

Hi Pankaj,

On Wed, Mar 12, 2025 at 09:05:50PM +0100, Gupta, Pankaj wrote:
> O.k. Should the KVM fix also goto Upstream KVM as well?

We can try, but my guess is that KVM maintainers will only accept it
together with a general CET enablement for all VMs. Also, my patch does
not cover the CPUID support indication, yet.

John's patch-set is much more complete in that regard, maybe it can
be updated and reposted?

Regards,

	Joerg

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

end of thread, other threads:[~2025-03-13  5:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-12  9:21 [svsm-devel] SVSM Host Kernel KVM Update Required Jörg Rödel
2025-03-12  9:36 ` Gupta, Pankaj
2025-03-12  9:48   ` Gupta, Pankaj
2025-03-12 10:02   ` Jörg Rödel
2025-03-12 14:33     ` Gupta, Pankaj
2025-03-12 14:54       ` Jörg Rödel
2025-03-12 20:05         ` Gupta, Pankaj
2025-03-13  5:54           ` Jörg Rödel

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