linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Roberto Sassu <roberto.sassu@huaweicloud.com>
Cc: dhowells@redhat.com, herbert@gondor.apana.org.au,
	davem@davemloft.net, zohar@linux.ibm.com,
	dmitry.kasatkin@gmail.com, paul@paul-moore.com,
	jmorris@namei.org, serge@hallyn.com,
	linux-integrity@vger.kernel.org,
	linux-security-module@vger.kernel.org, keyrings@vger.kernel.org,
	linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org, Roberto Sassu <roberto.sassu@huawei.com>
Subject: Re: [PATCH v5 2/2] KEYS: asymmetric: Copy sig and digest in public_key_verify_signature()
Date: Thu, 29 Dec 2022 14:39:03 -0800	[thread overview]
Message-ID: <Y64XB0yi24yjeBDw@sol.localdomain> (raw)
In-Reply-To: <20221227142740.2807136-3-roberto.sassu@huaweicloud.com>

On Tue, Dec 27, 2022 at 03:27:40PM +0100, Roberto Sassu wrote:
> From: Roberto Sassu <roberto.sassu@huawei.com>
> 
> 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>
> ---
>  crypto/asymmetric_keys/public_key.c | 38 ++++++++++++++++-------------
>  1 file changed, 21 insertions(+), 17 deletions(-)

Reviewed-by: Eric Biggers <ebiggers@google.com>

- Eric

  reply	other threads:[~2022-12-29 22:39 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-27 14:27 [PATCH v5 0/2] KEYS: asymmetric: Copy sig and digest in public_key_verify_signature() Roberto Sassu
2022-12-27 14:27 ` [PATCH v5 1/2] lib/mpi: Fix buffer overrun when SG is too long Roberto Sassu
2022-12-29 22:38   ` Eric Biggers
2022-12-30 13:35   ` David Laight
2022-12-30 15:39     ` Herbert Xu
2022-12-31 13:23       ` David Laight
2023-01-06 15:18   ` Herbert Xu
2023-01-16  8:57     ` Roberto Sassu
2023-01-16  9:06       ` Herbert Xu
2023-01-20 10:23         ` Roberto Sassu
2022-12-27 14:27 ` [PATCH v5 2/2] KEYS: asymmetric: Copy sig and digest in public_key_verify_signature() Roberto Sassu
2022-12-29 22:39   ` Eric Biggers [this message]
2023-01-27  8:27     ` Roberto Sassu
2023-02-09 10:49       ` Roberto Sassu
2023-02-09 18:53         ` Eric Biggers
2023-02-09 22:46           ` Paul Moore
2023-02-10  3:56             ` Jarkko Sakkinen
2023-02-10 17:32               ` Paul Moore
2023-02-10  3:52           ` Jarkko Sakkinen
2023-05-26  7:35             ` Roberto Sassu
2023-06-01 21:00   ` Stefan Berger
2023-06-02  9:17     ` Roberto Sassu
2023-06-02 13:17       ` Eric Biggers
2023-06-02 13:39         ` Roberto Sassu

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=Y64XB0yi24yjeBDw@sol.localdomain \
    --to=ebiggers@kernel.org \
    --cc=davem@davemloft.net \
    --cc=dhowells@redhat.com \
    --cc=dmitry.kasatkin@gmail.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=jmorris@namei.org \
    --cc=keyrings@vger.kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=paul@paul-moore.com \
    --cc=roberto.sassu@huawei.com \
    --cc=roberto.sassu@huaweicloud.com \
    --cc=serge@hallyn.com \
    --cc=stable@vger.kernel.org \
    --cc=zohar@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;
as well as URLs for NNTP newsgroup(s).