[patch] validate binary before use

Aleksandar Ristovski aristovski@qnx.com
Thu Dec 27 20:07:00 GMT 2012


On 12-12-25 02:37 AM, Jan Kratochvil wrote:
> On Mon, 24 Dec 2012 20:56:42 +0100, Aleksandar Ristovski wrote:
>> While writing a testcase I realized the patch as posted did not work
>> in general cases. Comparing whole elf header and whole pheader is
>> not an option as they change depending on whether the binary is
>> stripped and such.
>
> The checked fields like vaddr also do not match as the local file is commonly
> nightly prelinked, unprelinked (after nightly update before prelink has run)
> or nightly re-prelinked (see prelink(8)).
>
> Such prelink-aware verification is already implemented in solib-svr4.c in
> svr4_exec_displacement.  GDB also handles correctly local symbol file in
> a different prelink state than the debugged target.

Ok, I will fix that.

>
> But still I find this verification less reliable and more complicated than the
> build-id verification I suggested.
>

build-id would be great if it was required by the standard and mapped 
into loadable segments. AFAIK neither is true. I am after a generic 
solution that will rely only on what's in the memory.

I will propose new patch addressing this and John Gilmore's comments (he 
made them here: http://sourceware.org/ml/gdb/2012-12/msg00080.html) but 
probably no sooner than mid-January.


---
Aleksandar



More information about the Gdb-patches mailing list