This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc 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]

[Bug dynamic-link/22370] Incorrect note padding check


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

--- Comment #4 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, hjl/pr22370/master has been created
        at  0dfdda09f7b0faef5ff166f3e4e099b20571b76c (commit)

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=0dfdda09f7b0faef5ff166f3e4e099b20571b76c

commit 0dfdda09f7b0faef5ff166f3e4e099b20571b76c
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Oct 31 04:51:41 2017 -0700

    Properly compute offsets of note descriptor and next note [BZ #22370]

    A note header has 3 4-bytes fields, followed by note name and note
    descriptor.  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.  Notes are aligned to 4 bytes in 32-bit objects and 8 bytes
    in 64-bit objects.

    For all GNU notes, the name is "GNU" which is 4 bytes.  They have the
    same format in the first 16 bytes in both 32-bit and 64-bit objects.
    They differ by note descriptor size and note type.  So far, .note.ABI-tag
    and .note.gnu.build-id notes are always aligned to 4 bytes.  The exsting
    codes compute the note size by aligning the note name size and note
    descriptor size to 4 bytes.  It happens to produce the same value as
    the actual note size by luck since the name size is 4 and offset of the
    note descriptor is 16.  But it will produce the wrong size when note
    alignment is 8 bytes in 64-bit objects.

    This patch defines ELF_NOTE_DESC_OFFSET and ELF_NOTE_NEXT_OFFSET to
    properly compute offsets of note descriptor and next note.  It uses
    alignment of PT_NOTE segment to support both 4-byte and 8-byte note
    alignments in 64-bit objects.

        [BZ #22370]
        * dl-hwcaps.c (ROUND): Removed.
        (_dl_important_hwcaps): Replace ROUND with ELF_NOTE_DESC_OFFSET
        and ELF_NOTE_NEXT_OFFSET.
        * elf/dl-load.c (ROUND): Removed.
        (open_verify): Replace ROUND with ELF_NOTE_NEXT_OFFSET.
        * elf/readelflib.c (ROUND): Removed.
        (process_elf_file): Replace ROUND with ELF_NOTE_NEXT_OFFSET.
        * include/elf.h [!_ISOMAC]: Include <libc-pointer-arith.h>.
        [!_ISOMAC] (ELF_NOTE_DESC_OFFSET): New.
        [!_ISOMAC] (ELF_NOTE_NEXT_OFFSET): Likewise.

-----------------------------------------------------------------------

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

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