Current-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
ASLR still problematic with -lpthread
My -current (with fixes mentioned in [1]) still has problems
when ASLR is enable and app is linked with -lpthread, example:
$ uname -a
NetBSD lelek.smutek.pl 5.99.39 NetBSD 5.99.39 (GENERIC) #0: Tue Aug 31 13:12:42
CEST 2010
root%lelek.smutek.pl@localhost:/usr/obj/sys/arch/i386/compile/GENERIC i386
$ cat aslr.c
#include <stdio.h>
int
main(int argc, char *argv[])
{
printf("Stack %p\n", &argc);
return 0;
}
$ gcc aslr.c -o a; paxctl +A a
$ in $(seq 1 1000); do ./a; done
Stack 0xbf350640
Stack 0xbfb8b6e8
Stack 0xbfabdb3c
Stack 0xbf7101e8
Stack 0xbf8bb8ac
Stack 0xbf5cd750
[...]
- all ok, even 10k runs without single dump.
$ gcc aslr.c -lpthread -o a; paxctl +A a
$ in $(seq 1 1000); do ./a; done
Stack 0xbfaa6d3c
Stack 0xbf501110
Stack 0xbf14c504
Stack 0xbfa8c42c
Stack 0xbf36ec7c
Memory fault (core dumped)
Few backtraces:
Core was generated by `a'.
Program terminated with signal 11, Segmentation fault.
#0 0xb137dc85 in pthread_suspend_np () from /usr/lib/libpthread.so.1
(gdb) bt
#0 0xb137dc85 in pthread_suspend_np () from /usr/lib/libpthread.so.1
#1 0xb137e4e5 in pthread__init () from /usr/lib/libpthread.so.1
#2 0xb132dca1 in __libc_init () from /usr/lib/libc.so.12
#3 0xb1290538 in ?? () from /usr/lib/libc.so.12
#4 0x00000000 in ?? ()
Core was generated by `a'.
Program terminated with signal 11, Segmentation fault.
#0 0xb2898053 in free () from /usr/lib/libc.so.12
(gdb) bt
#0 0xb2898053 in free () from /usr/lib/libc.so.12
#1 0xb2899859 in malloc () from /usr/lib/libc.so.12
#2 0xb28ede24 in __smakebuf () from /usr/lib/libc.so.12
#3 0xb28edc97 in __swsetup () from /usr/lib/libc.so.12
#4 0xb28ccaa7 in __vfprintf_unlocked () from /usr/lib/libc.so.12
#5 0xb28cf944 in vfprintf () from /usr/lib/libc.so.12
#6 0xb28ca8f4 in printf () from /usr/lib/libc.so.12
#7 0x080486b7 in main (argc=858980355, argv=0x0) at aslr.c:6
Core was generated by `a'.
Program terminated with signal 11, Segmentation fault.
#0 0x00000000 in ?? ()
(gdb) bt
#0 0x00000000 in ?? ()
#1 0x00000000 in ?? ()
1. http://releng.netbsd.org/cgi-bin/req-5.cgi?show=1444
--
Piotr 'aniou' Meyer
Home |
Main Index |
Thread Index |
Old Index