c - 为什么即使 ASLR 开启,__libc_start_main 的地址在 GDB 中总是相同的?
问题描述
Breakpoint 1, 0x00007ffff7de8060 in __libc_start_main () from /usr/lib/libc.so.6
(gdb) r
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /home/firstlove/projects/org-ioslide/example/a.out
Breakpoint 1, 0x00007ffff7de8060 in __libc_start_main () from /usr/lib/libc.so.6
(gdb) r
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /home/firstlove/projects/org-ioslide/example/a.out
Breakpoint 1, 0x00007ffff7de8060 in __libc_start_main () from /usr/lib/libc.so.6
(gdb) Quit
(gdb) quit
A debugging session is active.
Inferior 1 [process 16372] will be killed.
Quit anyway? (y or n) y
firstlove-pc% cat /proc/sys/kernel/randomize_va_space
2
IIUC,ASLR 应该随机化所有地址,包括 的一个libc.so
,但是我发现 的地址__libc_start_main()
总是0x00007ffff7de8060
在我的 Linux 机器上,为什么?怎么了?
解决方案
当你在里面运行一个程序时gdb
,gdb
尝试通过禁用地址随机化来帮助你调试。您可以使用以下命令启用它(从下次运行程序开始生效):
set disable-randomization off
推荐阅读
- perforce - 带有文件的 Perforce 更改列表转储
- php - 如何在 PHP 中发送光标“home”
- powershell - 如何从 gci 中过滤和排除文件?
- ios - (SwiftUI) 谷歌地图在点击“播放”时工作正常,但在侧面预览中不起作用
- c# - 如何通过 SWIG 将 C# byte[] 传递给 C++ unsigned char *?
- php - 显示父目录页面的 codeigniter 路由
- html - 如何使用表面上的“显示” div 显示隐藏在彩色 div 后面的动画
- css - CSS - 如何使带有包装的 flexbox 具有内容宽度?
- python - 绝对和相对导入不适用于自定义包
- python - 有没有办法在字符串中获取特定行