[llvm-bugs] [Bug 43114] New: Clan7.0.1 does not apply -D_FORTIFY_SOURCE=2
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Aug 26 02:15:32 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=43114
Bug ID: 43114
Summary: Clan7.0.1 does not apply -D_FORTIFY_SOURCE=2
Product: clang
Version: 7.0
Hardware: Other
OS: Linux
Status: NEW
Severity: release blocker
Priority: P
Component: C
Assignee: unassignedclangbugs at nondot.org
Reporter: Vikas.Pandey2 at harman.com
CC: blitzrakete at gmail.com, dgregor at apple.com,
erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
richard-llvm at metafoo.co.uk
echo $CC
aarch64-poky-linux-musl-clang -mlittle-endian
--sysroot=/data/home/user-name/work/toolchain/install_clang/sysroots/aarch64-poky-linux-musl
main.c file content:
---------------------
#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[]) {
char buffer[8];
strcpy(buffer, argv[0]);
puts(buffer);
return 0;
}
$CC -O2 -D_FORTIFY_SOURCE=2 main.c -o main.o
./checksec.sh -f main.o
RELRO STACK CANARY NX PIE
RPATH RUNPATH FORTIFY Fortified Fortifiable FILE
Partial RELRO Canary found NX enabled PIE enabled No RPATH No
RUNPATH Yes 0 2 main.o
root at b1:~/usb_drive# ./main.o
./main.o
Segmentation fault
Expected : ---
./main.o
*** buffer overflow detected ***: ./main.o terminated
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x7320f)[0x7f630b4a120f]
/lib/x86_64-linux-gnu/libc.so.6(__fortify_fail+0x37)[0x7f630b5244e7]
/lib/x86_64-linux-gnu/libc.so.6(+0xf4700)[0x7f630b522700]
./fortify_example[0x4005ba]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5)[0x7f630b44fb45]
./fortify_example[0x4004c9]
======= Memory map: ========
00400000-00401000 r-xp 00000000 fb:01 391109
/tmp/main.o
[... blah blah blah ...]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0
[vsyscall]
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190826/4fd38832/attachment-0001.html>
More information about the llvm-bugs
mailing list