This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] readelf: Check alignment of note section


On Mon, Nov 27, 2017 at 1:39 AM, Nick Clifton <nickc@redhat.com> wrote:
> 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

This patch won't work on CORE file and has been replaced by

https://sourceware.org/ml/binutils/2017-11/msg00478.html


-- 
H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]