[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <a71dc0e54ef741dfa4d5599093cb26d1@ll.mit.edu>
Date: Tue, 11 Aug 2020 16:39:20 +0000
From: "Burrow, Ryan - 0553 - MITLL" <Ryan.Burrow@...mit.edu>
To: Matthew Wilcox <willy@...radead.org>
CC: "linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] Bug fix to ELF Loader which rejects valid ELFs
> -----Original Message-----
> From: Matthew Wilcox <willy@...radead.org>
> Sent: Tuesday, August 11, 2020 11:05 AM
> To: Burrow, Ryan - 0553 - MITLL <Ryan.Burrow@...mit.edu>
> Cc: linux-fsdevel@...r.kernel.org; linux-kernel@...r.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?
Download attachment "smime.p7s" of type "application/pkcs7-signature" (5529 bytes)
Powered by blists - more mailing lists