Linux cryptographic layer development
 help / color / mirror / Atom feed
From: liulongfang <liulongfang@huawei.com>
To: Evanshenf <archwse@gmail.com>, <linux-crypto@vger.kernel.org>
Cc: Weili Qian <qianweili@huawei.com>,
	Zhou Wang <wangzhou1@hisilicon.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>
Subject: Re: [BUG] crypto: hisilicon/hpre: RSA request never completes during signed module verification on Kunpeng arm64
Date: Thu, 27 Aug 2026 15:07:20 +0800	[thread overview]
Message-ID: <5ec5464b-a84d-48c4-6ef7-d60944ae94a9@huawei.com> (raw)
In-Reply-To: <178779980745.730913.5616603289665364629.hisi-hpre-7980@gmail.com>

On 2026/8/27 11:03, Evanshenf wrote:
> Hello,
> 
> I observed a permanently stuck RSA request in the HiSilicon HPRE driver
> while a signed kernel module was being verified on a Kunpeng ARM64 server.
> The lost completion subsequently blocked module loading and all PVE API
> workers which invoked ss(8).
> 
> This was observed with a Proxmox kernel rather than a vanilla upstream
> kernel.  I have not yet reproduced it on a mainline build, but the relevant
> HPRE and rsassa-pkcs1 paths appear unchanged in current upstream source.
> 
> Environment:
> 
>   architecture: arm64
>   CPU: TaiShan-v120 (Kunpeng)
>   system product: J353 G3
>   HPRE PCI ID: 19e5:a258 (four PFs)
>   kernel: 7.0.14-6-pve
>   kernel package: proxmox-kernel-7.0.14-6-pve-signed 7.0.14-6
>   CONFIG_MODULE_SIG=y
>   Secure Boot: disabled
> 
> Trigger and impact:
> 
> PVE executed:
> 
>   /bin/ss -Htln sport = 5900
> 
> This requested net-pf-16-proto-4-type-2, which resolves to inet_diag.
> Verification of the signed inet_diag module selected HPRE because the
> registered algorithms were:
> 
>   pkcs1(hpre-rsa,sha512) priority 1000
>   hpre-rsa                priority 1000
>   rsa-generic             priority 100
> 
> The first modprobe has remained in uninterruptible sleep for more than ten
> hours.  Its stack is:
> 
>   rsassa_pkcs1_verify+0x284/0x3a0
>   public_key_verify_signature+0x1e4/0x2b0
>   public_key_verify_signature_2+0x20/0x48
>   verify_signature+0x48/0xc0
>   pkcs7_validate_trust+0x23c/0x300
>   verify_pkcs7_message_sig+0x10c/0x190
>   verify_pkcs7_signature+0x78/0xe0
>   mod_verify_sig+0xac/0x150
>   module_sig_check+0x104/0x190
>   load_module+0x48/0x2a68
>   init_module_from_file+0x110/0x168
>   __arm64_sys_finit_module+0x220/0x398
> 
> All later ss processes became blocked in call_usermodehelper_exec() while
> waiting for the same module request.  This exhausted all three pvedaemon
> workers and caused PVE API login requests to time out with HTTP 596.
> 
> HPRE debugfs counters isolate the lost completion to one PF:
> 
>   0000:3a:00.0 send=3  recv=3
>   0000:3e:00.0 send=25 recv=25
>   0000:7a:00.0 send=1  recv=0
>   0000:7e:00.0 send=1  recv=1
>

Hello!

We have received your report and have initiated internal analysis. Since we
do not have access to your Proxmox kernel, we are using the open-source
kernel 7.0.14 for analysis and testing. If you suspect this is an alignment
issue, you could try modifying and verifying it.

Thanks.

> For 0000:7a:00.0, send_busy_cnt, send_fail_cnt, invalid_req_cnt,
> abnormal_irq, aeq_irq, err_irq and dev_timeout are all zero.  The QM status
> still reports "work".  Its completion IRQ vector has received zero
> interrupts; the assigned CPU is online.
> 
> The signed kernel package passes dpkg verification.  hisi_hpre is not in
> the initramfs and is loaded automatically through the PCI modalias.  It is
> not exposed through UACCE and is not passed through to a VM.
> 
> Possible cause:
> 
> hpre_hw_data_init() directly maps a single full-size RSA scatterlist with
> dma_map_single() through hpre_get_data_dma_addr(), without checking the
> DMA/cacheline alignment.  rsassa_pkcs1_verify() uses the same scatterlist
> as both source and destination for the child akcipher request.
> 
> HPRE already has hpre_prepare_dma_buf(), which allocates a coherent bounce
> buffer, but the full-size RSA path bypasses it.  This resembles the recent
> rsassa-pkcs1 alignment discussion, where it was noted that the underlying
> accelerator driver must handle unaligned buffers:
> 
>   https://lore.kernel.org/linux-crypto/20260731024446.786329-1-changwei.zou@canonical.com/
> 
> I cannot prove from the current stuck system that alignment is the only
> cause, so this is a hypothesis rather than a conclusion.  Independently,
> hpre_is_bd_timeout() only records elapsed time after a response callback;
> it cannot recover a request whose completion never arrives.  The synchronous
> crypto waiter therefore remains blocked indefinitely.
> 
> The production workaround is to blacklist hisi_hpre and reboot, which
> causes signed-module verification to use rsa-generic.  The current request
> cannot be killed or recovered without rebooting.
> 
> Would forcing unaligned or in-place RSA requests through the existing
> coherent bounce-buffer path be an appropriate first fix?  Is there an
> existing HPRE/QM recovery mechanism that can safely time out the request,
> reset the affected queue, and complete or fall back to software without a
> late-callback use-after-free risk?
> 
> The corresponding Proxmox report, including a sanitized diagnostic
> attachment, is available here:
> 
>   https://bugzilla.proxmox.com/show_bug.cgi?id=7980
> 
> Please let me know if a mainline reproduction, additional HPRE registers,
> or testing of a candidate patch would be useful.  The affected production
> host is currently being kept unchanged so that more read-only evidence can
> still be collected before the maintenance reboot.
> 
> Regards,
> Evanshenf
> GitHub: https://github.com/Evanshenf
> 
> .
> 

  reply	other threads:[~2026-08-27  7:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-27  3:03 [BUG] crypto: hisilicon/hpre: RSA request never completes during signed module verification on Kunpeng arm64 Evanshenf
2026-08-27  7:07 ` liulongfang [this message]
2026-08-27  8:40   ` Evanshenf
2026-08-28  9:26     ` liulongfang
2026-08-28 13:53       ` Evanshenf

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=5ec5464b-a84d-48c4-6ef7-d60944ae94a9@huawei.com \
    --to=liulongfang@huawei.com \
    --cc=archwse@gmail.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=qianweili@huawei.com \
    --cc=wangzhou1@hisilicon.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