Which versions of GCC, or flags, should I use when studying buffer overflows?

最后都变了- 提交于 2019-12-04 06:04:05

Use -zexecstack -fno-stack-protector to disable stack frame protection and non-executable stack with gcc.

On your Linux system, you also have to disable address randomization (ASLR) using:

echo 0 > /proc/sys/kernel/randomize_va_space

Use -fno-stack-protector option in gcc to disable stack smashing protection.

Most recent versions of GCC (>= 4.8) have included AddressSanitizer, by -fsanitize=address option. From 4.8 Realease Notes:

AddressSanitizer , a fast memory error detector, has been added and can be enabled via -fsanitize=address. Memory access instructions will be instrumented to detect heap-, stack-, and global-buffer overflow as well as use-after-free bugs. To get nicer stacktraces, use -fno-omit-frame-pointer. The AddressSanitizer is available on IA-32/x86-64/x32/PowerPC/PowerPC64 GNU/Linux and on x86-64 Darwin.

GCC 4.9 added its support on ARM platform.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!