This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] validate binary before use
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: Aleksandar Ristovski <aristovski at qnx dot com>
- Cc: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Thu, 31 Jan 2013 07:35:18 +0100
- Subject: Re: [patch] validate binary before use
- References: <50D4C49A.6040502@qnx.com> <50D8B37A.20001@qnx.com> <20121225073709.GA11349@host2.jankratochvil.net> <50DCAA5C.3000301@qnx.com> <20121227205924.GA5109@host2.jankratochvil.net> <50DCB787.6020601@qnx.com> <20121227211328.GA5739@host2.jankratochvil.net> <50DCBBD1.7000707@qnx.com> <5107F591.304@qnx.com>
On Tue, 29 Jan 2013 17:15:13 +0100, Aleksandar Ristovski wrote:
> --- gdb/solib.c 1 Jan 2013 06:32:51 -0000 1.169
> +++ gdb/solib.c 29 Jan 2013 15:46:39 -0000
> @@ -495,6 +495,17 @@ solib_map_sections (struct so_list *so)
> }
> }
>
> + gdb_assert (ops->validate != NULL);
> +
> + if (!ops->validate (so))
When thinking about it this approach regresses back again performance with
gdbserver over high latency links. This is why the <library-list-svr4 /> XML
protocol has been put there. With ops->validate there will be
a round-trip-time requirement on very every library listed from gdbserver.
Therefore with gdbserver the current
p += sprintf (p, "<library name=\"%s\" lm=\"0x%lx\" "
"l_addr=\"0x%lx\" l_ld=\"0x%lx\"/>",
should be extended with hex-encoded build-id="..." parameter. gdbserver does
not have the bfd but it already iterates program headers in get_dynamic so it
can find PT_NOTE there.
Therefore there should be new build_id field in struct so_list where
svr4_current_sos_via_xfer_libraries will put it from gdbserver. In local mode
it should remain mostly as you wrote it / as suggested in the review as there
is currently no easy non-Linux way how to find PT_NOTE without bfd at hand.
Thanks,
Jan