Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko@kernel.org>
To: Guicai Ma <maguicai@kylinos.cn>
Cc: Florian Bauckholt <florian.bauckholt@cispa.de>,
	David Howells <dhowells@redhat.com>,
	Lukas Wunner <lukas@wunner.de>, Ignat Korchagin <ignat@linux.win>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	"David S . Miller" <davem@davemloft.net>,
	Paul Moore <paul@paul-moore.com>,
	James Morris <jmorris@namei.org>,
	"Serge E . Hallyn" <serge@hallyn.com>,
	Hui Peng <benquike@gmail.com>,
	Stefan Berger <stefanb@linux.ibm.com>,
	Rodolfo Giometti <giometti@enneenne.com>,
	keyrings@vger.kernel.org, linux-crypto@vger.kernel.org,
	linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/2] KEYS: fix signature length passed to KEYCTL_PKEY_VERIFY
Date: Thu, 19 Nov 2026 14:55:18 +0200	[thread overview]
Message-ID: <av7xtr2Owxiuzp3O@kernel.org> (raw)
In-Reply-To: <20261119075004.689388-1-maguicai@kylinos.cn>

On Thu, Nov 19, 2026 at 02:50:04AM -0500, Guicai Ma wrote:
> On Wed, Nov 18, 2026 at 11:19:28PM +0000, Florian Bauckholt wrote:
> > As a result keyctl_pkey_verify() ignores the signature length passed by
> > the caller and always reads max_sig_size bytes from the signature
> > pointer. A shorter signature is extended with whatever follows it in
> > the caller's memory, or the call fails with -EFAULT if that memory is
> > not readable.
> 
> Verified the union usage in struct kernel_pkey_params and reproduced both
> failure modes on arm64 with an RSA-2048 PKCS#8 key (enc=pkcs1 hash=sha256):
> 
> - A truncated 200-byte signature with the remaining 56 bytes still intact
>   in userspace memory was falsely accepted (0) before this patch, and is
>   now rejected with -EINVAL.
> - A 16-byte signature placed right before a PROT_NONE guard page (as well
>   as a 0-byte signature at the page boundary) returned -EFAULT before this
>   patch, and now returns -EINVAL without faulting.
> 
> Reviewed-by: Guicai Ma <maguicai@kylinos.cn>
> Tested-by: Guicai Ma <maguicai@kylinos.cn>

Thanks.

Br, Jarkko

  reply	other threads:[~2026-11-19 12:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18 23:19 [PATCH v2 0/2] KEYS: two fixes for the asymmetric keyctl operations Florian Bauckholt via B4 Relay
2026-11-18 23:19 ` [PATCH v2 1/2] KEYS: fix signature length passed to KEYCTL_PKEY_VERIFY Florian Bauckholt via B4 Relay
2026-11-19  7:50   ` Guicai Ma
2026-11-19 12:55     ` Jarkko Sakkinen [this message]
2026-11-19 10:25   ` Rodolfo Giometti
2026-11-19 12:56     ` Jarkko Sakkinen
2026-11-18 23:19 ` [PATCH v2 2/2] KEYS: asymmetric: Fix PKCS#1 decryption of an empty message Florian Bauckholt via B4 Relay
2026-11-19  7:50   ` Guicai Ma

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=av7xtr2Owxiuzp3O@kernel.org \
    --to=jarkko@kernel.org \
    --cc=benquike@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dhowells@redhat.com \
    --cc=florian.bauckholt@cispa.de \
    --cc=giometti@enneenne.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=ignat@linux.win \
    --cc=jmorris@namei.org \
    --cc=keyrings@vger.kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=maguicai@kylinos.cn \
    --cc=paul@paul-moore.com \
    --cc=serge@hallyn.com \
    --cc=stefanb@linux.ibm.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