]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
KEYS: asymmetric: Copy sig and digest in public_key_verify_signature()
authorRoberto Sassu <roberto.sassu@huawei.com>
Thu, 8 Dec 2022 09:56:46 +0000 (10:56 +0100)
committerStefan Bader <stefan.bader@canonical.com>
Mon, 4 Sep 2023 09:10:33 +0000 (11:10 +0200)
commitd295ea5c9f15623e57f25bc35fd1bd02714eb702
treee198a23c80ae9b672442ce4a461f64e672053fcf
parent557c48426e96156b9fd82b11a6b9e6693ff6ebaf
KEYS: asymmetric: Copy sig and digest in public_key_verify_signature()

BugLink: https://bugs.launchpad.net/bugs/2029808
commit c3d03e8e35e005e1a614e51bb59053eeb5857f76 upstream.

Commit ac4e97abce9b8 ("scatterlist: sg_set_buf() argument must be in linear
mapping") checks that both the signature and the digest reside in the
linear mapping area.

However, more recently commit ba14a194a434c ("fork: Add generic vmalloced
stack support") made it possible to move the stack in the vmalloc area,
which is not contiguous, and thus not suitable for sg_set_buf() which needs
adjacent pages.

Always make a copy of the signature and digest in the same buffer used to
store the key and its parameters, and pass them to sg_init_one(). Prefer it
to conditionally doing the copy if necessary, to keep the code simple. The
buffer allocated with kmalloc() is in the linear mapping area.

Cc: stable@vger.kernel.org # 4.9.x
Fixes: ba14a194a434 ("fork: Add generic vmalloced stack support")
Link: https://lore.kernel.org/linux-integrity/Y4pIpxbjBdajymBJ@sol.localdomain/
Suggested-by: Eric Biggers <ebiggers@kernel.org>
Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
Reviewed-by: Eric Biggers <ebiggers@google.com>
Tested-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
crypto/asymmetric_keys/public_key.c