|
From: Tom H. <to...@co...> - 2005-11-08 15:35:58
|
In message <200...@gm...>
Dirk Mueller <dm...@gm...> wrote:
> On Tuesday 08 November 2005 10:41, Tom Hughes wrote:
>
>> The critical files to understand all this are mm/mprotect.c in the
>> kernel and sysdeps/unix/sysv/linux/dl-execstack.c in glibc.
>
> I'm looking at both for a while already :)
>
>> If that mprotect fails with EINVAL then glibc falls back to doing a
>> binary search
>
> Thats what the Redhat glibc might do, yes. The plan FSF glibc 2.3.6
> doesn't do that:
I was looking at the plain FSF one actually, but I had missed the
fact that you could configure it to assume PROT_GROWSDOWN support.
Obviously RedHat have no done so.
>> The attached patch seems to work for me - if it works for you as
>> well then I guess we can go with it.
>
> it crashes:
> ./test: error while loading shared libraries: libtest.so: cannot enable
> executable stack as shared object requires: Invalid argument
> ==27757== Jump to the invalid address stated on the next line
> ==27757== at 0x46E: ???
> ==27757== by 0x400AD47: _dl_signal_error (in /lib/ld-2.3.5.so)
> ==27757== by 0x400A4AC: _dl_map_object_deps (in /lib/ld-2.3.5.so)
> ==27757== by 0x4001FAD: dl_main (in /lib/ld-2.3.5.so)
> ==27757== by 0x400E40E: _dl_sysdep_start (in /lib/ld-2.3.5.so)
> ==27757== by 0x4003731: _dl_start (in /lib/ld-2.3.5.so)
> ==27757== by 0x40007B6: (within /lib/ld-2.3.5.so)
> ==27757== Address 0x46E is not stack'd, malloc'd or (recently) free'd
> ==27757==
> ==27757== Process terminating with default action of signal 11 (SIGSEGV):
> dumping core
> ==27757== Bad permissions for mapped region at address 0x46E
> ==27757== at 0x46E: ???
Hmm. It worked for me (and suppressed the binary search for the
stack judging by the syscall trace).
Tom
--
Tom Hughes (to...@co...)
http://www.compton.nu/
|