Re: [patch] nto target: fix null pointer dereference

Aleksandar Ristovski
2008-08-13T15:47:00Z

Daniel Jacobowitz wrote:
> On Tue, Aug 12, 2008 at 05:25:40PM -0400, Aleksandar Ristovski wrote:
>> in procfs_create_inferior we call solib_create_inferior_hook, which will end up trying to determine loader base by reading inferior's memory at DT_DEBUG pointer. In our case, before the executable actually started executing, it will successfully read 0s, because dynamic loader has not been invoked yet, and the pointer to r_debug structure is not initialized.
>
> It should already detect that zero is invalid, since that's the same
> value used initially; see e.g. calls to locate_base. Where's the read
> come from?
>
nto_procfs.c::LM_ADDR gets called only by nto_relocate_section_addresses which replaces svr4_relocate_section_addresses. There is a slight difference in the way we treat l_addr address comparing to svr4.

I will repost modified patch shortly.