public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: "slyfox at inbox dot ru" <sourceware-bugzilla@sourceware.org>
To: elfutils-devel@sourceware.org
Subject: [Bug libelf/23916] New: [bisected] elifutils-0.175 broke kernel's objtool (elifutils-0.173 works)
Date: Sat, 24 Nov 2018 00:49:00 -0000	[thread overview]
Message-ID: <bug-23916-10460@http.sourceware.org/bugzilla/> (raw)

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.

             reply	other threads:[~2018-11-24  0:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-24  0:49 slyfox at inbox dot ru [this message]
2018-11-24  0:54 ` [Bug libelf/23916] " slyfox at inbox dot ru
2018-11-24  1:04 ` mark at klomp dot org
2018-11-24 10:31 ` slyfox at inbox dot ru
2018-11-24 22:09 ` mark at klomp dot org
2018-11-26 12:13 ` mark at klomp dot org
2018-11-26 12:16 ` mark at klomp dot org
2018-12-03  0:06 ` slyfox at inbox dot ru
2018-12-03  0:19 ` ldv at sourceware dot org
2018-12-05 11:55 ` mark at klomp dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-23916-10460@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=elfutils-devel@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).