Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ewan Hai" <ewandevelop@gmail.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH v2 5/5] KVM: x86: Expose Zhaoxin RSA CPUID feature
Date: Thu, 28 May 2026 05:03:20 +0000	[thread overview]
Message-ID: <20260528050321.0DD3A1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260528032234.1322565-6-ewandevelop@gmail.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Exposing the RSA big-number arithmetic engine to untrusted guests creates a severe local denial-of-service vulnerability (Instruction Time DoS).
- [Low] The newly added X86_FEATURE_RSA and X86_FEATURE_RSA_EN flags were not synchronized to the tools/ directory.
--

commit 39b1d23089ffb8d188fc17bb71d4da69fbf1ff4a
Author: Ewan Hai <ewandevelop@gmail.com>

KVM: x86: Expose Zhaoxin RSA CPUID feature

This patch advertises the Zhaoxin big-number arithmetic engine to guests
by exposing the RSA and RSA_EN CPUID feature flags. It allows guests to
use REP XMODEXP and REP MONTMUL2 instructions for accelerating public-key
operations.

> diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h
> index 3702d7a30ae61..a769c83588f7c 100644
> --- a/arch/x86/include/asm/cpufeatures.h
> +++ b/arch/x86/include/asm/cpufeatures.h
> @@ -154,6 +154,8 @@
>  #define X86_FEATURE_RNG2_EN		( 5*32+23) /* "rng2_en" RNG2 enabled */
>  #define X86_FEATURE_PHE2		( 5*32+25) /* "phe2" PadLock Hash Engine v2 */
>  #define X86_FEATURE_PHE2_EN		( 5*32+26) /* "phe2_en" PHE2 enabled */
> +#define X86_FEATURE_RSA			( 5*32+27) /* "rsa" Big-number arithmetic */
> +#define X86_FEATURE_RSA_EN		( 5*32+28) /* "rsa_en" RSA enabled */

[Severity: Low]
Should these new flags also be synchronized to
tools/arch/x86/include/asm/cpufeatures.h? 

It looks like check-tools-headers might warn during the build if the tools
header isn't kept in sync with the main cpufeatures.h additions.

[ ... ]

> diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
> index 3fb81f7a61076..94ea9abae566d 100644
> --- a/arch/x86/kvm/cpuid.c
> +++ b/arch/x86/kvm/cpuid.c
> @@ -1290,6 +1290,8 @@ void kvm_initialize_cpu_caps(void)
>  		F(RNG2_EN),
>  		F(PHE2),
>  		F(PHE2_EN),
> +		F(RSA),
> +		F(RSA_EN),

[Severity: High]
Does exposing these instructions to untrusted guests risk a denial of
service?

Since REP XMODEXP and REP MONTMUL2 are unprivileged and support operands up
to 32768 bits, can a guest user-space application force the physical CPU core
into a prolonged computation?

If the hardware doesn't efficiently yield to external host interrupts during
these massive operations, it seems like this could stall the host, delaying
interrupts and VM-exits, potentially triggering host RCU stalls or watchdog
lockups.

>  	);
>  
>  	/*

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260528032234.1322565-1-ewandevelop@gmail.com?part=5

  reply	other threads:[~2026-05-28  5:03 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-28  3:22 [PATCH v2 0/5] KVM: x86: Expose Zhaoxin CPUID 0xC0000001 EDX cryptographic features Ewan Hai
2026-05-28  3:22 ` [PATCH v2 1/5] KVM: x86: Expose Zhaoxin SM2 CPUID feature Ewan Hai
2026-05-28  3:42   ` sashiko-bot
2026-05-28  7:09     ` Ewan Hai
2026-05-28 12:49       ` Sean Christopherson
2026-05-28 13:35         ` Ewan Hai
2026-05-28  3:22 ` [PATCH v2 2/5] KVM: x86: Expose Zhaoxin CCS (SM3 + SM4) " Ewan Hai
2026-06-02  7:30   ` Binbin Wu
2026-06-02  7:49     ` Ewan Hai
2026-05-28  3:22 ` [PATCH v2 3/5] KVM: x86: Expose Zhaoxin RNG2 " Ewan Hai
2026-05-28  3:22 ` [PATCH v2 4/5] KVM: x86: Expose Zhaoxin PHE2 " Ewan Hai
2026-06-02  7:29   ` Binbin Wu
2026-05-28  3:22 ` [PATCH v2 5/5] KVM: x86: Expose Zhaoxin RSA " Ewan Hai
2026-05-28  5:03   ` sashiko-bot [this message]
2026-05-28  7:14     ` Ewan Hai
2026-06-02  7:32 ` [PATCH v2 0/5] KVM: x86: Expose Zhaoxin CPUID 0xC0000001 EDX cryptographic features Binbin Wu

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=20260528050321.0DD3A1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=ewandevelop@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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