public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [Bug tools/31097] New: strip/unstrip on ET_REL binary might fail elflint on i386
@ 2023-11-29 15:54 amerey at redhat dot com
  2024-02-06 20:22 ` [Bug tools/31097] " amerey at redhat dot com
  0 siblings, 1 reply; 2+ messages in thread
From: amerey at redhat dot com @ 2023-11-29 15:54 UTC (permalink / raw)
  To: elfutils-devel

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

            Bug ID: 31097
           Summary: strip/unstrip on ET_REL binary might fail elflint on
                    i386
           Product: elfutils
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: tools
          Assignee: unassigned at sourceware dot org
          Reporter: amerey at redhat dot com
                CC: elfutils-devel at sourceware dot org
  Target Milestone: ---

tests/run-strip-strmerge.sh contains tests that strip and unstrip an ET_REL
binary. On i386 it is possible for the resulting binary of these tests to fail
elflint due to the presence of relocations with type R_386_GOTPC that refer to
a non-GOT symbol.

This is caught on i386 because of the presence of an ebl_gotpc_reloc_check for
this arch. Most other ebl backends do not implement this check. It is possible
that similar problems are going undetected on other arches.

We should ensure that strip/unstrip always produce binaries that pass elflint.
We should also implement ebl_gotpc_reloc_check for other backends.

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug tools/31097] strip/unstrip on ET_REL binary might fail elflint on i386
  2023-11-29 15:54 [Bug tools/31097] New: strip/unstrip on ET_REL binary might fail elflint on i386 amerey at redhat dot com
@ 2024-02-06 20:22 ` amerey at redhat dot com
  0 siblings, 0 replies; 2+ messages in thread
From: amerey at redhat dot com @ 2024-02-06 20:22 UTC (permalink / raw)
  To: elfutils-devel

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

Aaron Merey <amerey at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #1 from Aaron Merey <amerey at redhat dot com> ---
Fixed in the following commit:

commit 2f9b180cc1057fb351332689886b2492b3711aad
Author: Aaron Merey <amerey@redhat.com>
Date:   Sun Jan 21 19:44:34 2024 -0500

    unstrip: Call adjust_relocs no more than once per section.

    During symtab merging, adjust_relocs might be called multiple times on
    some SHT_REL/SHT_RELA sections.  In these cases it is possible for a
    relocation's symbol index to be correctly mapped from X to Y during the
    first call to adjust_relocs but then wrongly remapped from Y to Z during
    the second call.

    Fix this by adjusting relocation symbol indices just once per section.

    Also add stable sorting for symbols during symtab merging so that the
    symbol order in the output file's symtab does not depend on undefined
    behaviour in qsort.

    Note that adjust_relocs still might be called a second time on a section
    during add_new_section_symbols.  However since add_new_section_symbols
    generates its own distinct symbol index map, this should not trigger the
    bug described above.

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-02-06 20:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-29 15:54 [Bug tools/31097] New: strip/unstrip on ET_REL binary might fail elflint on i386 amerey at redhat dot com
2024-02-06 20:22 ` [Bug tools/31097] " amerey at redhat dot com

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).