This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [gold][patch] Fix file descriptor leak
- From: Ian Lance Taylor <iant at google dot com>
- To: Cary Coutant <ccoutant at google dot com>
- Cc: Binutils <binutils at sourceware dot org>
- Date: Fri, 05 Nov 2010 14:05:16 -0700
- Subject: Re: [gold][patch] Fix file descriptor leak
- References: <AANLkTinAi_gEPw5gHPGNZp7aMhqrCJMBdmdvTJxLQJaw@mail.gmail.com>
Cary Coutant <ccoutant@google.com> writes:
> PR gold/10708
> * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
> object when reading from the file.
> * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
> second layout pass.
> * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
> when reading section contents.
> (get_section_contents): Likewise.
> (icf::find_identical_sections): Likewise.
> * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
> object when reading from the file.
> * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
> the object when doing deferred section layout.
This is OK.
We should add that assert you mentioned as soon as we can.
We should also add some notion to the workqueue as to whether we are
running single-threaded. We can use that to assert if there are ever
two jobs runnable when we think we are single-threaded.
We should then change these dummy_task Task_lock_obj calls to a
different locker which asserts that we are single threaded, does not
require a task, and calls variants of obj->lock and obj->unlock which do
not use a task.
Thanks for tracking this down.
Ian