All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: 'Herbert Xu' <herbert@gondor.apana.org.au>
Cc: 'Roberto Sassu' <roberto.sassu@huaweicloud.com>,
	"dhowells@redhat.com" <dhowells@redhat.com>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"zohar@linux.ibm.com" <zohar@linux.ibm.com>,
	"dmitry.kasatkin@gmail.com" <dmitry.kasatkin@gmail.com>,
	"paul@paul-moore.com" <paul@paul-moore.com>,
	"jmorris@namei.org" <jmorris@namei.org>,
	"serge@hallyn.com" <serge@hallyn.com>,
	"ebiggers@kernel.org" <ebiggers@kernel.org>,
	"linux-integrity@vger.kernel.org"
	<linux-integrity@vger.kernel.org>,
	"linux-security-module@vger.kernel.org" 
	<linux-security-module@vger.kernel.org>,
	"keyrings@vger.kernel.org" <keyrings@vger.kernel.org>,
	"linux-crypto@vger.kernel.org" <linux-crypto@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: RE: [PATCH v5 1/2] lib/mpi: Fix buffer overrun when SG is too long
Date: Sat, 31 Dec 2022 13:23:14 +0000	[thread overview]
Message-ID: <0d5fda5b25b8467c860d625116dac1d2@AcuMS.aculab.com> (raw)
In-Reply-To: <Y68GMsGKROsgDbcs@gondor.apana.org.au>

From: Herbert Xu
> Sent: 30 December 2022 15:40
> 
> On Fri, Dec 30, 2022 at 01:35:07PM +0000, David Laight wrote:
> >
> > miter.length is size_t (unsigned long on 64bit) and nbytes unsigned int.
> 
> miter.length is bounded by sg->length which is unsigned int.

I did say 'technically' :-)

Should there be a sg_miter_stop() before the return at the bottom?
Care seems to have been taken to add one before an earlier error return.
(The logic in that function is very strange...)

Indeed other parts of the file are equally strange.
The big multi-line if-else in twocompl() is just:
	p[i] = (p[1] ^ 0xff) + 1;
or even:
	p[i] = -p[i];
That function could also return the 'zero status' to correct
for -0 (rather than the extra check earlier in the caller).

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


  reply	other threads:[~2022-12-31 13:23 UTC|newest]

Thread overview: 25+ 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-27 14:29   ` kernel test robot
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 [this message]
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
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=0d5fda5b25b8467c860d625116dac1d2@AcuMS.aculab.com \
    --to=david.laight@aculab.com \
    --cc=davem@davemloft.net \
    --cc=dhowells@redhat.com \
    --cc=dmitry.kasatkin@gmail.com \
    --cc=ebiggers@kernel.org \
    --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@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.