public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Alan Modra <amodra@gmail.com>
Cc: Binutils <binutils@sourceware.org>
Subject: Re: [PATCH] Use GCC LTO wrapper to get real symbols from LTO IR objects
Date: Tue, 11 Feb 2020 12:21:00 -0000	[thread overview]
Message-ID: <CAMe9rOpgURRdtQa-=vT2S_iFvUAFUeFQbDhA9Jei76DqysuUUw@mail.gmail.com> (raw)
In-Reply-To: <20200211023143.GT5669@bubble.grove.modra.org>

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

On Mon, Feb 10, 2020 at 6:31 PM Alan Modra <amodra@gmail.com> wrote:
>
> On Mon, Feb 10, 2020 at 05:22:24PM -0800, H.J. Lu wrote:
> > +  if (lto_symbol_found)
> > +    {
> > +      current_plugin->real_nsyms = real_nsyms;
> > +      current_plugin->real_syms = real_syms;
> > +      /* NB: We can't close RBFD which own the real symbol info.  */
> > +      current_plugin->real_bfd = rbfd;
> > +    }
> > +  else
> > +    bfd_close (rbfd);
>
> I think you might want to free real_syms here on else branch.  OK with
> that fix.

I am checking in this patch to avoid uninitialized memory.


-- 
H.J.

[-- Attachment #2: 0001-Clear-plugin_data-memory.patch --]
[-- Type: text/x-patch, Size: 768 bytes --]

From 04fe3341b310980507380118c0eb03537850f738 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Tue, 11 Feb 2020 04:09:32 -0800
Subject: [PATCH] Clear plugin_data memory

Clear plugin_data memory since it may be uninitialized.

	* plugin.c (add_symbols): Clear plugin_data memory.
---
 bfd/plugin.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/bfd/plugin.c b/bfd/plugin.c
index 1edcb57bf3a..5681a6a2913 100644
--- a/bfd/plugin.c
+++ b/bfd/plugin.c
@@ -448,6 +448,8 @@ add_symbols (void * handle,
       size_t sym_info_size, name_length;
       int i;
 
+      memset (plugin_data, 0, sizeof (*plugin_data));
+
       abfd->tdata.plugin_data = plugin_data;
 
       /* NB: LTO symbols are owned by LTO plugin.  Create a copy so
-- 
2.24.1


  reply	other threads:[~2020-02-11 12:21 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-10 14:24 H.J. Lu
2020-02-10 21:31 ` H.J. Lu
2020-02-10 23:02   ` Alan Modra
2020-02-11  1:23     ` H.J. Lu
2020-02-11  2:31       ` Alan Modra
2020-02-11 12:21         ` H.J. Lu [this message]
2020-02-11 22:05           ` [PATCH] Plugin: Treat each object as independent H.J. Lu
2020-02-11 22:22             ` Alan Modra
2020-02-11 16:07       ` [PATCH] Use GCC LTO wrapper to get real symbols from LTO IR objects Michael Matz
2020-02-11 17:04         ` H.J. Lu
2020-02-13  8:15           ` Alan Modra
2020-03-10 14:55       ` Richard Biener

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='CAMe9rOpgURRdtQa-=vT2S_iFvUAFUeFQbDhA9Jei76DqysuUUw@mail.gmail.com' \
    --to=hjl.tools@gmail.com \
    --cc=amodra@gmail.com \
    --cc=binutils@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).