Re: [patch] validate binary before use

Jan Kratochvil
2012-12-25T07:37:28Z

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.

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

Thanks,
Jan