From: Jarkko Sakkinen <jarkko@kernel.org>
To: keyrings@vger.kernel.org
Cc: Jarkko Sakkinen <jarkko@kernel.org>,
linux-kernel@vger.kernel.org,
linux-security-module@vger.kernel.org,
David Howells <dhowells@redhat.com>,
Guicai Ma <maguicai@kylinos.cn>, James Morris <jmorris@namei.org>,
Paul Moore <paul@paul-moore.com>,
"Serge E. Hallyn" <serge@hallyn.com>,
stable@vger.kernel.org
Subject: [PATCH 2/2] KEYS: Fix asym key overflow in keyctl_pkey_verify()
Date: Mon, 23 Nov 2026 23:19:59 +0200 [thread overview]
Message-ID: <20261123211959.4102708-3-jarkko@kernel.org> (raw)
In-Reply-To: <20261123211959.4102708-1-jarkko@kernel.org>
While verifying a variable-length signature shorter than info.max_sig_size,
memdup_user() reads past the end of the caller's _in2 and passes trailing
bytes to ->asym_verify_signature().
Set params->in2_len to uparams.in2_len in the KEYCTL_PKEY_VERIFY case.
Cc: stable@vger.kernel.org # v7.2+
Closes: https://sashiko.dev/#/bug/linux-dd9ad2ca-a846-4d0d-89d6-aa262ffd40f1
Fixes: cb481e59ea6c ("KEYS: fix overflow in keyctl_pkey_params_get_2()")
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
---
security/keys/keyctl_pkey.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/security/keys/keyctl_pkey.c b/security/keys/keyctl_pkey.c
index b5f82804b5ad..662226576954 100644
--- a/security/keys/keyctl_pkey.c
+++ b/security/keys/keyctl_pkey.c
@@ -176,7 +176,7 @@ static int keyctl_pkey_params_get_2(const struct keyctl_pkey_params __user *_par
goto out_up_key_sem;
}
- params->out_len = info.max_sig_size;
+ params->in2_len = uparams.in2_len;
break;
default:
ret = -EOPNOTSUPP;
--
2.47.3
next prev parent reply other threads:[~2026-11-23 21:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20261123211959.4102708-1-jarkko@kernel.org>
2026-11-23 21:19 ` [PATCH 1/2] KEYS: Fix userspace buffer overflow in keyctl_pkey_e_d_s() Jarkko Sakkinen
2026-11-23 21:25 ` Jarkko Sakkinen
2026-11-23 21:19 ` Jarkko Sakkinen [this message]
2026-11-23 21:26 ` [PATCH 2/2] KEYS: Fix asym key overflow in keyctl_pkey_verify() Jarkko Sakkinen
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=20261123211959.4102708-3-jarkko@kernel.org \
--to=jarkko@kernel.org \
--cc=dhowells@redhat.com \
--cc=jmorris@namei.org \
--cc=keyrings@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=maguicai@kylinos.cn \
--cc=paul@paul-moore.com \
--cc=serge@hallyn.com \
--cc=stable@vger.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