This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] readelf: Check alignment of note section
- From: Nick Clifton <nickc at redhat dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>, binutils at sourceware dot org
- Date: Mon, 27 Nov 2017 09:39:59 +0000
- Subject: Re: [PATCH] readelf: Check alignment of note section
- Authentication-results: sourceware.org; auth=none
- References: <20171124234931.GA32287@gmail.com>
Hi H.J.
> gABI specifies that PT_NOTE alignment should be aligned to 4 bytes
> for 32-bit objects and to 8 bytes for 64-bit objects. But on Linux,
> .note.ABI-tag and .note.gnu.build-id notes are always aligned to 4
> bytes. We allow either 4 byte or 8 byte alignments.
Approved - with one small change:
> + /* gABI specifies that PT_NOTE alignment should be aligned to 4
> + bytes for 32-bit objects and to 8 bytes for 64-bit objects.
> + But on Linux, .note.ABI-tag and .note.gnu.build-id notes are
> + always aligned to 4 bytes. We allow either 4 byte or 8 byte
> + alignments. */
> + align = section->sh_addralign;
> + if (align != 4 || align != 8)
> + return FALSE;
Please could you add an error message here so that the user is informed
as to why the note is corrupt.
Cheers
Nick