Re: [PATCH 1/2] KEYS: fix signature length passed to KEYCTL_PKEY_VERIFY
From: Jarkko Sakkinen
Date: Wed Nov 18 2026 - 15:28:29 EST
On Wed, Nov 18, 2026 at 03:08:19PM -0500, Stefan Berger wrote:
>
>
> On 11/11/26 10:56 AM, Florian Bauckholt via B4 Relay wrote:
> > From: Florian Bauckholt <florian.bauckholt@xxxxxxxx>
> >
> > Commit cb481e59ea6c ("KEYS: fix overflow in keyctl_pkey_params_get_2()")
> > made keyctl_pkey_params_get_2() set params->out_len to the maximum
> > output size of the operation instead of the size provided by the caller.
> > It does so for KEYCTL_PKEY_VERIFY as well, but verify has no output
> > buffer: out_len shares a union with in2_len, the length of the
> > signature.
> >
> > As a result keyctl_pkey_verify() ignores the signature length passed by
> > the caller. It copies max_sig_size bytes from the signature pointer and
> > passes max_sig_size as the signature size to the verification.
> >
> > This makes no difference for signatures that are always max_sig_size
> > bytes long, such as RSA. A shorter signature, e.g. a DER-encoded ECDSA
> > signature, is followed by whatever is behind it in the caller's memory,
> > or the call fails with -EFAULT if that memory is not readable. The
> > x962 ECDSA template currently ignores data following the signature,
> > which hides the problem.
> >
> > Use the length provided by the caller, which has already been checked
> > against max_sig_size.
> >
> > Fixes: cb481e59ea6c ("KEYS: fix overflow in keyctl_pkey_params_get_2()")
> > Cc: stable@xxxxxxxxxxxxxxx
> > Link: https://lore.kernel.org/all/20260919221742.3709658-1-benquike@xxxxxxxxx/
> > Signed-off-by: Florian Bauckholt <florian.bauckholt@xxxxxxxx>
>
> Tested-by: Stefan Berger <stefanb@xxxxxxxxxxxxx>
Can these patches be rebased? They don't apply.
I've probably missed b4 shazam issue last time.
Was just wondering why I don't have these yet.
Br, Jarkko