Re: [patch] validate binary before use

Aleksandar Ristovski
2013-01-31T14:24:56Z

On 13-01-31 01:35 AM, Jan Kratochvil wrote:
> 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.
>
>

Ok, I can add this. Will be included in the new patch.

Thanks,

Aleksandar