Re: [patch] validate binary before use

Aleksandar Ristovski
2013-04-04T02:03:58Z

Actually, as I think about this more, we can not use section from
possibly unrelated bfd to read build-id in native debugging case. At a
minimum, we can not store such build-id as abfd may not even relate to
what's in target's memory.

The chunk of code that is in svr4_relocate_section_addresses in the
latest version of the patch needs to go back to svr4_validate, and not
store build-id.

Ideally, however, build id would be read from target memory phdrs, not
from bfd.

Main complication, of course, is that due to missing load base for a
shared object, this becomes target os specific. On Neutrino, it is
straight forward, but on gnu it requires parsing smaps.

So, I'm thinking that linux-nat should be taught to return
TARGET_OBJECT_LIBRARIES_SVR4, and also augument gdbserver to return load
base.

i.e. gdbserver would return, in addition to what it already does, a
mandatory attribute "load_base".

If a native implementation does not support
TARGET_OBJECT_LIBRARIES_SVR4, build-id is not checked.

Thoughts?