public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Doug Evans <dje@google.com>
Cc: gdb-patches <gdb-patches@sourceware.org>,
	       Aleksandar Ristovski <ARistovski@qnx.com>
Subject: Re: [PATCH v8 09/10] Validate symbol file using build-id
Date: Tue, 23 Jun 2015 20:47:00 -0000	[thread overview]
Message-ID: <20150623204702.GA2156@host1.jankratochvil.net> (raw)
In-Reply-To: <CADPb22TH5nfFSkCzW9cCiHuoJFAG+P5z=qZawgwGUgYQ5kfd5Q@mail.gmail.com>

On Tue, 23 Jun 2015 00:25:52 +0200, Doug Evans wrote:
> On Sun, Jun 21, 2015 at 5:16 AM, Jan Kratochvil <jan.kratochvil@redhat.com> wrote:
> >         * gdb.texinfo (Files): Add 'set solib-build-id-force'
> >         and 'show solib-build-id-force'.
> 
> IIUC this applies to symbol files (the main program) too, right?

No.  That is an extension I am working on as an add-on patchset, to be posted
in a week or two.

I expected this "solib" patchset will be already approved a long time ago so
the add-on patchset will make sense.  But given this patchset is still being
reviewed and the new patchset will change some parts of this one I am curious
whether I should not rather merge the second patchset into the first one and
start the review process from scratch.


> If so, having solib in the option name is confusing.
> 
> set build-id-force
> or
> set require-build-id-match
> or some such would be clearer.

The new patchset is being cooked as the last commits without ChangeLogs at:
	https://sourceware.org/git/?p=archer.git;a=log;h=refs/heads/jankratochvil/gdbserverbuildid
Particularly:
	https://sourceware.org/git/?p=archer.git;a=commitdiff;h=79c03cbb287878d3e5fcfb8104bdd21aa712f013
	-set solib-build-id-force (on|off)
	+set build-id-force (on|off)


> > +/* Validate SO by comparing build-id from the associated bfd and
> > +   corresponding build-id from target memory.  */
> 
> Please document that the result is an error message or NULL for success
> (including missing build id), and that the caller must free it.
> I realize you say so in the docs for the "validate" "method",
> but the comment here doesn't mention it is the validate method
> (which would be a fine alternative to repeating all the docs
> of the method).

I agree; although it gets reworked in the add-on patchset anyway.
	https://sourceware.org/git/?p=archer.git;a=commitdiff;h=6d40ae1db39bdabb415a05aa909178d61cb519ed

> > +
> > +static char *
> > +svr4_validate (const struct so_list *const so)


> > @@ -1146,6 +1215,25 @@ library_list_start_library (struct gdb_xml_parser *parser,
> >    strncpy (new_elem->so_name, name, sizeof (new_elem->so_name) - 1);
> >    new_elem->so_name[sizeof (new_elem->so_name) - 1] = 0;
> >    strcpy (new_elem->so_original_name, new_elem->so_name);
> > +  if (hex_build_id != NULL)
> > +    {
> > +      const size_t hex_build_id_len = strlen (hex_build_id);
> > +
> > +      if (hex_build_id_len > 0 && (hex_build_id_len & 1U) == 0)
> > +       {
> > +         const size_t build_idsz = hex_build_id_len / 2;
> > +
> > +         new_elem->build_id = xmalloc (build_idsz);
> > +         new_elem->build_idsz = hex2bin (hex_build_id, new_elem->build_id,
> > +                                         build_idsz);
> > +         if (new_elem->build_idsz != build_idsz)
> > +           {
> 
> This happens for a malformed build id, right?

Yes.

> A warning would be useful here.
> It'd also be nice to have a warning for an odd count.

OK.


> > --- a/gdb/solist.h
> > +++ b/gdb/solist.h
> > @@ -75,6 +75,22 @@ struct so_list
> >         There may not be just one (e.g. if two segments are relocated
> >         differently); but this is only used for "info sharedlibrary".  */
> >      CORE_ADDR addr_low, addr_high;
> > +
> > +    /* Build id in raw format, contains verbatim contents of
> > +       .note.gnu.build-id including note header.
> 
> Including the note header will be confusing to readers.
> Is there a reason to include it?

It seems to simplify all the code.  I will recheck how the code looks if it
parses the note.


Thanks,
Jan

  reply	other threads:[~2015-06-23 20:47 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-14 19:25 [PATCH v7 00/10] Validate binary before use Jan Kratochvil
2015-06-14 19:25 ` [PATCH v7 01/10] Move utility functions to common/ Jan Kratochvil
2015-06-15 13:22   ` Joel Brobecker
2015-06-15 15:07     ` [commit] " Jan Kratochvil
2015-06-14 19:26 ` [PATCH v7 07/10] Move linux_find_memory_regions_full & co Jan Kratochvil
2015-06-14 19:26 ` [PATCH v7 03/10] Code cleanup: Rename enum -> enum filterflags Jan Kratochvil
2015-06-15 13:34   ` Joel Brobecker
2015-06-15 15:12     ` [commit] " Jan Kratochvil
2015-07-08 14:38   ` Pedro Alves
2015-06-14 19:26 ` [PATCH v7 06/10] Prepare linux_find_memory_regions_full & co. for move Jan Kratochvil
2015-06-14 19:26 ` [PATCH v7 02/10] Merge multiple hex conversions Jan Kratochvil
2015-06-15 13:33   ` Joel Brobecker
2015-06-15 15:09     ` [commit] " Jan Kratochvil
2015-06-14 19:26 ` [PATCH v7 04/10] Create empty nat/linux-maps.[ch] and common/target-utils.[ch] Jan Kratochvil
2015-06-14 19:26 ` [PATCH v7 05/10] Move gdb_regex* to common/ Jan Kratochvil
2015-07-08 14:39   ` Pedro Alves
2015-07-14 20:13     ` Jan Kratochvil
2015-06-14 19:27 ` [PATCH v7 10/10] Tests for validate symbol file using build-id Jan Kratochvil
2015-07-08 14:44   ` Pedro Alves
2015-06-14 19:27 ` [PATCH v7 08/10] gdbserver build-id attribute generator Jan Kratochvil
2015-07-08 14:41   ` Pedro Alves
2015-06-14 19:27 ` [PATCH v7 09/10] Validate symbol file using build-id Jan Kratochvil
2015-06-21 10:16   ` [PATCH v8 " Jan Kratochvil
2015-06-22 12:55     ` Aleksandar Ristovski
2015-06-22 20:37       ` Jan Kratochvil
2015-06-22 20:41         ` Aleksandar Ristovski
2015-06-22 22:25     ` Doug Evans
2015-06-23 20:47       ` Jan Kratochvil [this message]
2015-07-08 14:44         ` Pedro Alves
2015-07-12 19:09           ` Jan Kratochvil
2015-07-12 19:29             ` [PATCH v9 " Jan Kratochvil
2015-07-12 19:54               ` Eli Zaretskii
2015-07-12 20:01                 ` Jan Kratochvil
2015-07-13  2:30                   ` Eli Zaretskii
2015-07-13 10:34                 ` Pedro Alves
2015-07-13 12:38                   ` Jan Kratochvil
2015-07-14 16:14                     ` Doug Evans
2015-07-15  8:21                       ` Jan Kratochvil
2015-07-15 14:59                         ` Doug Evans
2015-06-27 21:05       ` [PATCH v8 " Jan Kratochvil
2015-07-08 15:40         ` Doug Evans
2015-07-12 19:27           ` Jan Kratochvil
2015-07-15 16:36 ` [commit] [PATCH v7 00/10] Validate binary before use Jan Kratochvil
2015-07-15 18:33   ` [revert] " Jan Kratochvil

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=20150623204702.GA2156@host1.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=ARistovski@qnx.com \
    --cc=dje@google.com \
    --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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).