是否可以在 OS X 上获得正在运行的进程的 ASLR 幻灯片?
我不想以某种方式禁用 ASLR(例如 like gdb
),而是获得偏移量。
例子:
$ cat > test.c
#include <stdio.h>
int test(void) {
return 42;
}
int main(void) {
getchar();
printf("%p: %d\n", test, test());
return 0;
}
$ gcc test.c -o test
多次运行 test 将确认test()
每次运行确实有不同的地址:
$ ./test
^D
0x104493e50: 42
$ ./test
^D
0x106fe8e80: 42
注意:查找幻灯片的方法不应该搜索进程的内存或以其他方式检查它,因为我需要一个适用于所有可执行文件的便携式解决方案。