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

[gold commit] (PR gold/14860) Fix race condition causing assert in Eh_frame_hdr::do_sized_write


This patch fixes PR gold/14860, where a race condition leads to an
assert in Eh_frame_hdr::do_sized_write().

Thanks to analysis by Taiju Tsuiki, who identified the problem as
Write_after_sections_task running while Write_sections_task was still
running, I was able to figure out just how that could happen -- it
took a very small test case, building a shared library so there were
no crt*.o files, and a single input file with no .eh_frame section of
its own, but a PLT entry that caused the linker to generate an eh
frame entry on the fly. With all of those conditions met, it is
possible for all the Relocate_tasks to run and complete while
Write_sections_task is still running, allowing
Write_after_sections_task to start before the .eh_frame section has
been written.

Even so, the small test case still never failed on my own workstation,
but tzik tested it out for me and verified that he got 10000
successful runs with no failures.

(While testing, I also found a missing dependency in one of the
exception tests.)

-cary


2014-09-23  Taiju Tsuiki  <tzik@google.com>
            Cary Coutant  <ccoutant@google.com>

gold/
        PR gold/14860
        * gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
        on input_sections_blocker.
        * layout.cc (Write_sections_task::locks): Unblock
        input_sections_blocker_.
        * layout.h (Write_sections_task::Write_sections_task): Add
        input_sections_blocker.
        * testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
        to DEPENDENCIES.
        * testsuite/Makefile.in: Regenerate.

Attachment: ehframe-race-patch.txt
Description: Text document


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