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


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


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