Re: BINFMT_FLAT: reloc outside program

Greg Ungerer <[email protected]> Fri, 13 May 2016 23:17:52 +1000
Newsgroups gmane.linux.uclinux.devel
Message-ID <[email protected]>
Hi Waldemar,

On 11/05/16 04:57, Waldemar Brodkorb wrote:
> Hi Greg,
> Greg Ungerer wrote,
>
>> Hi Waldemar,
>>
>>> I disabled CONFIG_BINFMT_SHARED_FLAT in the kernel.
>>> And now I get:
>>> ~ # /hello
>>> [   90.830000] BINFMT_FLAT: reloc[405] outside program 0xed870000 (0
>>> - 0x123b0/0x8944), killing hello!
>>> SEGV
>>>
>>> Compiling with
>>> ./output/host/usr/bin/arm-buildroot-uclinux-uclibcgnueabi-gcc
>>> -Wl,-elf2flt=-v -o hello hello.c -lpthread :
>>> ..
>>> reloc[403] = 0xe140
>>>    RELOC[404]: offset=0x5724 symbol=frame_dummy+0x0 section=.text
>>> size=0 fixup=0xac (reloc=0xe144)
>>> reloc[404] = 0xe144
>>>    RELOC[405]: offset=0x5728 symbol=pthread_initialize+0x0
>>> section=.text size=0 fixup=0x87ec (reloc=0xe148)
>>> reloc[405] = 0xe148
>>>    RELOC[406]: offset=0x572c symbol=__do_global_dtors_aux+0x0
>>> section=.text size=0 fixup=0x80 (reloc=0xe14c)
>>> reloc[406] = 0xe14c
>>> ..
>>>
>>> So pthread_initialize() is the problem?
>>
>> Sure does look that way. I am not sure why looking at the above
>> details though.
>>
>> Can you run again with the "Kernel-Traced-Load" flag set on the
>> hello program (so run the flthdr -k on it first). I want to see
>> what the actual memory regions allocated where and how far out
>> of those bounds the relocation ended up.
>
> Here it is:
> ~ # /hello
> [   57.910000] BINFMT_FLAT: Loading file: /hello
> [   57.910000] Mapping is 90580000, Entry point is 45, data_start is 8984
> [   57.910000] Load /hello: TEXT=90580040-90588984 DATA=905889a0-9058e1b0 BSS=9058e1b0-9059240c
> [   57.910000] BINFMT_FLAT: reloc[405] outside program 0xed870000 (0 - 0x123b0/0x8944), killing hello!
> SEGV

Thanks for that. When I get a spare minute I will dig into it
and see if I can make any sense of that. It is obviously way out
of the expected range.


> The same hello world application works on Qemu m68k somehow. It starts and
> get SIGILL, but at least not a relocation problem.

If you want to post more details on that I can have a look
at that too.

Regards
Greg
_______________________________________________
uClinux-dev mailing list
[email protected]
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by [email protected]
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev