Re: [patch] validate binary before use

Jan Kratochvil
2012-12-27T20:59:39Z

On Thu, 27 Dec 2012 21:06:52 +0100, Aleksandar Ristovski wrote:
> build-id would be great if it was required by the standard

GDB can check if it exists and do something as a fallback if it does not exist.
Such as printing a warning and possibly also verifying the program headers, if
compatibility with binaries from old toolchain and/or toolchain without
configured ld --build-id is required in some situations (which I doubt).

> and mapped into loadable segments.

It is mapped, because one of its purposes is to get dumped into a core file.
In fact there is a special care to make it always present in the first page.

Section Headers:
[Nr] Name Type Address Off Size ES Flg Lk Inf Al
[ 3] .note.gnu.build-id NOTE 00000000004002ac 0002ac 000024 00 A 0 0 4
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
LOAD 0x000000 0x0000000000400000 0x0000000000400000 0x0d9db0 0x0d9db0 R E 0x200000

Thanks,
Jan