Re: [PATCH] KEYS: Fix signature input size for KEYCTL_PKEY_VERIFY

From: Jarkko Sakkinen

Date: Fri Nov 13 2026 - 09:52:48 EST


On Fri, Nov 13, 2026 at 04:10:12PM +0200, Jarkko Sakkinen wrote:
> On Fri, Nov 13, 2026 at 09:03:11AM -0500, Stefan Berger wrote:
> > Revert the changes made for signature verification in cb481e59ea6c back
> > to the old behavior where effectively the params->in2_len was set to the
> > length of the user provided buffer uparams.in2_len (out_len is an alias
> > for in2_len due to the union). We cannot use the max_sig_size in the
> > case of signature verification since this is neither the true size of the
> > input buffer nor would it pass tests of size indicators found in the ASN.1
> > in the buffer comparing against the input buffer size.
> >
> > Fixes: cb481e59ea6c ("KEYS: fix overflow in keyctl_pkey_params_get_2()")
> > Cc: Jarkko Sakkinen <jarkko@xxxxxxxxxx>
> > Cc: Florian Bauckholt <florian.bauckholt@xxxxxxxx>
> > Signed-off-by: Stefan Berger <stefanb@xxxxxxxxxxxxx>
> > ---
> > 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 15b6bf6399b5..794fa3d01911 100644
> > --- a/security/keys/keyctl_pkey.c
> > +++ b/security/keys/keyctl_pkey.c
> > @@ -160,7 +160,7 @@ static int keyctl_pkey_params_get_2(const struct keyctl_pkey_params __user *_par
> > uparams.in2_len > info.max_sig_size)
> > return -EINVAL;
> >
> > - params->out_len = info.max_sig_size;
> > + params->in2_len = uparams.in2_len;
> > break;
> > default:
> > return -EOPNOTSUPP;
> > --
> > 2.56.0
> >
>
>
> Reviewed-by: Jarkko Sakkinen <jarkko@xxxxxxxxxx>

Did we have reported-by and closes tags for this?

Br, Jarkko