This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
-D_FORTIFY_SOURCE=2 doesn't show backtrace on ARM
- From: Cedric Jehasse <cedric dot jehasse at gmail dot com>
- To: libc-help at sourceware dot org
- Date: Thu, 11 Sep 2014 10:06:23 +0200
- Subject: -D_FORTIFY_SOURCE=2 doesn't show backtrace on ARM
- Authentication-results: sourceware.org; auth=none
Hi,
I have a toolchain with glibc2.19 for ARM. I've a small test program
for -DFORTIFY_SOURCE=2. When a buffer overflow is detected, it doesn't
show a backtrace.
It seems to be because it's missing unwind information for some
functions in the c-library. Eg. for __libc_message.
After adding this line to the libio/Makefile:
CFLAGS-libc_fatal.c = $(exceptions)
I get a partial backtrace:
*** buffer overflow detected ***: ./fortify_test1 terminated
======= Backtrace: =========
/lib/libc.so.6(+0x6b81c)[0xb6e8281c]
/lib/libc.so.6(__fortify_fail+0x40)[0xb6ef6370]
/lib/ld-linux.so.3(+0xfbbc)[0xb6f5bbbc]
======= Memory map: ========
00008000-00009000 r-xp 00000000 00:13 9063117
/mnt/nfs/src/fortify_source/fortify_test1
00010000-00011000 rw-p 00000000 00:13 9063117
/mnt/nfs/src/fortify_source/fortify_test1
00feb000-0100c000 rw-p 00000000 00:00 0 [heap]
b6e05000-b6e0f000 r-xp 00000000 00:0b 362 /lib/libgcc_s.so.1
b6e0f000-b6e16000 ---p 0000a000 00:0b 362 /lib/libgcc_s.so.1
b6e16000-b6e17000 rw-p 00009000 00:0b 362 /lib/libgcc_s.so.1
b6e17000-b6f3e000 r-xp 00000000 00:0b 417 /lib/libc.so.6
b6f3e000-b6f46000 ---p 00127000 00:0b 417 /lib/libc.so.6
b6f46000-b6f48000 r--p 00127000 00:0b 417 /lib/libc.so.6
b6f48000-b6f49000 rw-p 00129000 00:0b 417 /lib/libc.so.6
b6f49000-b6f4c000 rw-p 00000000 00:00 0
b6f4c000-b6f6b000 r-xp 00000000 00:0b 459 /lib/ld-2.19.so
b6f6f000-b6f72000 rw-p 00000000 00:00 0
b6f72000-b6f73000 r--p 0001e000 00:0b 459 /lib/ld-2.19.so
b6f73000-b6f74000 rw-p 0001f000 00:0b 459 /lib/ld-2.19.so
bed60000-bed81000 rw-p 00000000 00:00 0 [stack]
ffff0000-ffff1000 r-xp 00000000 00:00 0 [vectors]
Aborted (core dumped)
Unwind information for other functions is still missing.
Is it correct to add -fexceptions to get the backtrace?
If it's the correct way, do you know which other files need this to
get a full backtrace?
Thanks,
Cedric