From: "Burrow, Ryan - 0553 - MITLL" <Ryan.Burrow@ll.mit.edu>
To: Matthew Wilcox <willy@infradead.org>
Cc: "linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH] Bug fix to ELF Loader which rejects valid ELFs
Date: Tue, 11 Aug 2020 16:39:20 +0000 [thread overview]
Message-ID: <a71dc0e54ef741dfa4d5599093cb26d1@ll.mit.edu> (raw)
In-Reply-To: <20200811150517.GR17456@casper.infradead.org>
[-- Attachment #1: Type: text/plain, Size: 1371 bytes --]
> -----Original Message-----
> From: Matthew Wilcox <willy@infradead.org>
> Sent: Tuesday, August 11, 2020 11:05 AM
> To: Burrow, Ryan - 0553 - MITLL <Ryan.Burrow@ll.mit.edu>
> Cc: linux-fsdevel@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH] Bug fix to ELF Loader which rejects valid ELFs
>
> On Tue, Aug 11, 2020 at 02:44:08PM +0000, Burrow, Ryan - 0553 - MITLL
wrote:
> > /* Sanity check the number of program headers... */
> > - /* ...and their total size. */
> > - size = sizeof(struct elf_phdr) * elf_ex->e_phnum;
> > - if (size == 0 || size > 65536 || size > ELF_MIN_ALIGN)
> > + if (elf_ex->e_phnum == 0 || elf_ex->phnum > 65535)
>
> umm, did you compile-test this?
>
My apologies, I had made these edits in the context of other changes which I
didn't want to include in this patch - I replicated these changes
individually and (mistakenly) assumed I had done so correctly.
> assuming you meant e_phnum, it's a 16-bit quantity, so it can't be bigger
> than 65535.
>
> > goto out;
> >
> > + size = sizeof(struct elf_phdr) * elf_ex->e_phnum;
>
> use array_size() here?
>
That's a good catch - I had really just moved the previous allocation of
size down to after the check, but I'll use array_size instead. Just to
confirm the correct process, should I do an inline response with the updated
commit, or submit a new patch email?
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5529 bytes --]
prev parent reply other threads:[~2020-08-11 16:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-11 14:44 [PATCH] Bug fix to ELF Loader which rejects valid ELFs Burrow, Ryan - 0553 - MITLL
2020-08-11 15:05 ` Matthew Wilcox
2020-08-11 16:39 ` Burrow, Ryan - 0553 - MITLL [this message]
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=a71dc0e54ef741dfa4d5599093cb26d1@ll.mit.edu \
--to=ryan.burrow@ll.mit.edu \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=willy@infradead.org \
/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