bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug binutils/22444] Incorrect note padding check


From: cvs-commit at gcc dot gnu.org
Subject: [Bug binutils/22444] Incorrect note padding check
Date: Fri, 24 Nov 2017 14:47:23 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=22444

--- Comment #11 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot 
gnu.org> ---
The master branch has been updated by H.J. Lu <address@hidden>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=650444eb540f9fd85e821567a3f943b4bc41b8be

commit 650444eb540f9fd85e821567a3f943b4bc41b8be
Author: H.J. Lu <address@hidden>
Date:   Fri Nov 24 06:41:40 2017 -0800

    elf: Properly compute offsets of note descriptor and next note

    According to gABI, in a note entry, the note name field, not note name
    size, is padded for the note descriptor.  And the note descriptor field,
    not note descriptor size, is padded for the next note entry.  Also notes
    are aligned to 4 bytes in 32-bit objects and 8 bytes in 64-bit objects.
    Since on Linux, .note.ABI-tag and .note.gnu.build-id notes are always
    aligned to 4 bytes, we need to use alignment of note section or note
    segment, instead of assuming alignment based on ELF file class.

    Tested on i686 and x86-64.

    bfd/

        PR binutils/22444
        * elf.c (elf_read_notes): Add an argument for note aligment.
        (elf_parse_notes): Likewise.
        (_bfd_elf_make_section_from_shdr): Pass section aligment to
        elf_parse_notes.
        (bfd_section_from_phdr): Pass segment aligment to elf_read_notes.
        (elf_parse_notes): Add an argument for note aligment.  Use
        ELF_NOTE_DESC_OFFSET to get the offset of the note descriptor.
        Use ELF_NOTE_NEXT_OFFSET to get the offset of the next note
        entry.
        (elf_read_notes): Add an argument for note aligment and pass it
        to elf_parse_notes.

    binutils/

        PR binutils/22444
        * readelf.c (process_notes_at): Use ELF_NOTE_DESC_OFFSET to get
        the offset of the note descriptor.  Use ELF_NOTE_NEXT_OFFSET to
        get the offset of the next note entry.

    include/

        PR binutils/22444
        * elf/external.h (ELF_ALIGN_UP): New.
        (ELF_NOTE_DESC_OFFSET): Likewise.
        (ELF_NOTE_NEXT_OFFSET): Likewise.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]