[Bug libelf/23916] New: [bisected] elifutils-0.175 broke kernel's objtool (elifutils-0.173 works)

slyfox at inbox dot ru sourceware-bugzilla@sourceware.org
Sat Nov 24 00:49:00 GMT 2018


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

            Bug ID: 23916
           Summary: [bisected] elifutils-0.175 broke kernel's objtool
                    (elifutils-0.173 works)
           Product: elfutils
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libelf
          Assignee: unassigned at sourceware dot org
          Reporter: slyfox at inbox dot ru
                CC: elfutils-devel at sourceware dot org
  Target Milestone: ---

Created attachment 11411
  --> https://sourceware.org/bugzilla/attachment.cgi?id=11411&action=edit
b.tar.gz

Looks like libelf started adding larger alignment to .debug sections but
something went wrong. Original report: https://bugs.gentoo.org/671760

The symptom: kernel can't be compiled on amd64 against elifutils-0.175:
    linux.git $ LANG=C make arch/x86/events/intel/intel-rapl-perf.ko
    LD [M]  arch/x86/events/intel/intel-rapl-perf.o
    ld: arch/x86/events/intel/rapl.o: unable to initialize decompress status
for section .debug_info
    ....
    arch/x86/events/intel/rapl.o: file not recognized: file format not
recognized

Minimal reproducer (against kernel's objtool):

    $ cat rapl.c.c
    void a(void) {}
    $ gcc -nostdinc -g -o rapl.o -c rapl.c.c
    $ ./objtool orc generate  --module --no-fp --retpoline rapl.o
    $ ld -m elf_x86_64 -z max-page-size=0x200000 -r -o intel-rapl-perf.o rapl.o
    ld: rapl.o: unable to initialize decompress status for section .debug_info
    ...
    rapl.o: file not recognized: file format not recognized

Bisected down to something plausible:

$ git bisect bad
cf10453f8252df81225796d98548ba6eac113df3 is the first bad commit
commit cf10453f8252df81225796d98548ba6eac113df3
Author: Mark Wielaard <mark@klomp.org>
Date:   Tue Nov 13 21:18:09 2018 +0100

    libelf: Correctly setup alignment of SHF_COMPRESSED section data.

    We didn't set the alignment of SHF_COMPRESSED sections correctly.
    Those sections start with an Elf(32|64)_Chdr. Make sure sh_addralign
    is setup to be able to read such a struct directly. Likewise don't
    trust the alignment set on any SHF_COMPRESSED section, but always
    make the (raw) compressed data aligned correctly for the reading the
    Elf(32|64)_Chdr directly.

    Signed-off-by: Mark Wielaard <mark@klomp.org>

:040000 040000 99b0262c62d71ac5aaa178519df9a4db917ab1bd
df8299442f6fae9677d31699b88638a325eb9527 M      libelf

$ git bisect log
# bad: [628b4a93c6863b9982d817db6acaacbc4e116453] tests: Call test_cleanup in
backtrace-subr.sh check_unsupported.
# good: [aa36de0335e3ce12898954985a208f6336731289] Prepare for 0.173
git bisect start 'master' 'elfutils-0.173'
# good: [2876b3b648f665736ac9c879d34de5e3866ba8f9] Handle ADD/SUB relocations
git bisect good 2876b3b648f665736ac9c879d34de5e3866ba8f9
# good: [f2d59180b90b56b32240f0ba106add050a1b7d09] strip: Extract code to
update shdrstrndx into new common function.
git bisect good f2d59180b90b56b32240f0ba106add050a1b7d09
# good: [d3e6266754b95244063aa1e40c531fdd57259332] strip: Also handle gnu
compressed debug sections with --reloc-debug-sections
git bisect good d3e6266754b95244063aa1e40c531fdd57259332
# good: [d3e6266754b95244063aa1e40c531fdd57259332] strip: Also handle gnu
compressed debug sections with --reloc-debug-sections
git bisect good d3e6266754b95244063aa1e40c531fdd57259332
# bad: [a01938d584b91e747167bb4b3f30ec300c4d6e43] libelf: Mark both fsize and
msize with const attribute.
git bisect bad a01938d584b91e747167bb4b3f30ec300c4d6e43
# bad: [a01938d584b91e747167bb4b3f30ec300c4d6e43] libelf: Mark both fsize and
msize with const attribute.
git bisect bad a01938d584b91e747167bb4b3f30ec300c4d6e43
# bad: [22ec8efc1dd87cdc7892523457eb55990b967224] elflint: Allow
PT_GNU_EH_FRAME segment to match SHT_X86_64_UNWIND section.
git bisect bad 22ec8efc1dd87cdc7892523457eb55990b967224
# bad: [cf10453f8252df81225796d98548ba6eac113df3] libelf: Correctly setup
alignment of SHF_COMPRESSED section data.
git bisect bad cf10453f8252df81225796d98548ba6eac113df3
# first bad commit: [cf10453f8252df81225796d98548ba6eac113df3] libelf:
Correctly setup alignment of SHF_COMPRESSED section data.

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


More information about the Elfutils-devel mailing list