Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: binutils@sourceware.org, gdb-patches@sourceware.org
Subject: Re: [RFC/RFA] dangling bfd pointer in archive cache...
Date: Mon, 15 Oct 2012 18:01:00 -0000	[thread overview]
Message-ID: <20121015180052.GF3050@adacore.com> (raw)
In-Reply-To: <20121003052937.GB25219@bubble.grove.modra.org>

[-- Attachment #1: Type: text/plain, Size: 706 bytes --]

> No, we should already be calling _bfd_archive_close_and_cleanup via 
> 
> > --- a/bfd/opncls.c
> > +++ b/bfd/opncls.c
> > @@ -719,6 +719,17 @@ bfd_close (bfd *abfd)
> >    if (! BFD_SEND (abfd, _close_and_cleanup, (abfd)))
> 
> this call.  The problem is in coff-rs6000.c (and coff64-rs6000.c)
> where the bfd_target vector just uses bfd_true for close_and_cleanup.

Attached is a patch that implements your suggestion. Tested on ppc-aix
using AdaCore's GDB testsuite.

While at it, the powermac XCOFF backend also seemed to be using
the same code that eventually leads to the dangling pointer, and so
I fixed it as well. It's untested, but seems straightforward enough.

OK to commit?

Thanks,
-- 
Joel

[-- Attachment #2: 0001-Dangling-bfd-pointer-in-archive-cache.patch --]
[-- Type: text/x-diff, Size: 1157 bytes --]

From 63169be6cc57b68280afa74944abbfc285e9b0ae Mon Sep 17 00:00:00 2001
From: Joel Brobecker <brobecker@adacore.com>
Date: Mon, 15 Oct 2012 19:29:45 +0200
Subject: [PATCH] Dangling bfd pointer in archive cache.

This dandling pointer eventually leads to a crash when trying to run
on ppc-aix a program using threading...

bfd/ChangeLog:

        * coff-rs6000.c (rs6000coff_vec): Set _close_and_cleanup
        field to _bfd_archive_close_and_cleanup.
        (pmac_xcoff_vec): Likewise.
---
 bfd/coff-rs6000.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c
index edbef95..0945aca 100644
--- a/bfd/coff-rs6000.c
+++ b/bfd/coff-rs6000.c
@@ -4076,7 +4076,7 @@ const bfd_target rs6000coff_vec =
     },
 
     /* Generic */
-    bfd_true,
+    _bfd_archive_close_and_cleanup,
     bfd_true,
     coff_new_section_hook,
     _bfd_generic_get_section_contents,
@@ -4332,7 +4332,7 @@ const bfd_target pmac_xcoff_vec =
     },
 
     /* Generic */
-    bfd_true,
+    _bfd_archive_close_and_cleanup,
     bfd_true,
     coff_new_section_hook,
     _bfd_generic_get_section_contents,
-- 
1.6.5.rc2


  parent reply	other threads:[~2012-10-15 18:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-02 14:14 Joel Brobecker
2012-10-03  5:29 ` Alan Modra
2012-10-03 13:30   ` Joel Brobecker
2012-10-04  8:01     ` Alan Modra
2012-10-15 18:01   ` Joel Brobecker [this message]
2012-10-16  1:48     ` Alan Modra
2012-10-16 22:58       ` Joel Brobecker

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=20121015180052.GF3050@adacore.com \
    --to=brobecker@adacore.com \
    --cc=binutils@sourceware.org \
    --cc=gdb-patches@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