public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: "mark at klomp dot org" <sourceware-bugzilla@sourceware.org>
To: elfutils-devel@sourceware.org
Subject: [Bug binutils/23919] New: bfd doesn't handle ELF compressed data alignment
Date: Sat, 24 Nov 2018 22:09:00 -0000	[thread overview]
Message-ID: <bug-23919-10460@http.sourceware.org/bugzilla/> (raw)

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

            Bug ID: 23919
           Summary: bfd doesn't handle ELF compressed data alignment
           Product: binutils
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: binutils
          Assignee: unassigned at sourceware dot org
          Reporter: mark at klomp dot org
                CC: devurandom at gmx dot net, elfutils-devel at sourceware dot org,
                    mark at klomp dot org, slyfox at inbox dot ru,
                    unassigned at sourceware dot org
        Depends on: 23916
  Target Milestone: ---

+++ This bug was initially created as a clone of Bug #23916 +++

The ELF compression header has a field (ch_addralign) that is set to the
alignment of the uncompressed section. This way the section itself can have a
different alignment than the decompressed section. bfd (and readelf) however
explicitly make the section sh_addralign and ch_addralign equal. It also always
sets the alignment to 1 which is wrong when using a Elf32_Chdr (which has
alignment of 4) or Elf64_Chdr (which has alignment of 8).

This shows up with tools that use elfutils libelf which sets up the alignment
correctly.

First gas creates a compressed section with on alignment of 1.
Second libelf accepts this, but corrects the alignment when it
writes out the section.
Third bfd_check_compression_header sanity checks the section alignment,
but it checks that the compressed and decompressed alignment is equal?!?
I think it wanted to check that the alignment is a power of 2 instead.


Referenced Bugs:

https://sourceware.org/bugzilla/show_bug.cgi?id=23916
[Bug 23916] [bisected] elifutils-0.175 broke kernel's objtool (elifutils-0.173
works)
-- 
You are receiving this mail because:
You are on the CC list for the bug.

             reply	other threads:[~2018-11-24 22:09 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-24 22:09 mark at klomp dot org [this message]
2018-11-24 22:27 ` [Bug binutils/23919] " mark at klomp dot org
2018-11-27 12:03 ` cvs-commit at gcc dot gnu.org
2018-11-27 12:06 ` nickc at redhat dot com
2018-11-27 12:22 ` mark at klomp dot org
2018-11-27 13:47 ` hjl.tools at gmail dot com
2018-11-27 14:06 ` cvs-commit at gcc dot gnu.org
2018-11-27 14:07 ` hjl.tools at gmail dot com
2018-11-28 13:55 ` ldv at sourceware dot org
2018-11-28 14:42 ` hjl.tools at gmail dot com
2018-11-28 14:57 ` mark at klomp dot org
2018-11-28 15:03 ` mark at klomp dot org
2018-12-02 13:46 ` cvs-commit at gcc dot gnu.org
2018-12-02 13:52 ` hjl.tools at gmail dot com
2018-12-05 11:55 ` mark at klomp dot org
2019-02-18 15:10 ` cvs-commit at gcc dot gnu.org
2019-02-26 20:12 ` cvs-commit at gcc dot gnu.org
2019-02-26 20:14 ` cvs-commit at gcc dot gnu.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-23919-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).