Disabling ASLR in Mac OS X Snow Leopard

喜夏-厌秋 提交于 2019-12-17 19:27:20

问题


Essentially I want to disable ASLR in Mac OS X Snow Leopard and use gcc todo some buffer overflowing and stack overflows. Anyone know how to disable ASLR?


回答1:


Asan authors listed several ways to disable ASLR in MacOS: https://code.google.com/p/address-sanitizer/issues/detail?id=29

For 10.6

export DYLD_NO_PIE=1 

For 10.7 and newer:

  • "unset the MH_PIE bit in an already linked executable" with --no-pie flag of the script

    http://src.chromium.org/viewvc/chrome/trunk/src/build/mac/change_mach_o_flags.py?view=markup

  • or link the program with --no_pie flag.

And there is also hard method used by gdb: http://reverse.put.as/2011/08/11/how-gdb-disables-aslr-in-mac-os-x-lion/




回答2:


You can set the environment variable "DYLD_NO_PIE". See "man dyld". This works on OS X 10.6 but not on 10.5.



来源:https://stackoverflow.com/questions/6325537/disabling-aslr-in-mac-os-x-snow-leopard

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