[英]How to detect that PIE/ASLR has been enabled for my iOS app?
I am enabling PIE (position-independent executable)/ASLR (address space layout randomization) for an iPhone app by using the "-w -pie"
linking option flag. 我通过使用
"-w -pie"
链接选项标志为iPhone应用程序启用PIE(位置无关可执行文件)/ ASLR(地址空间布局随机化)。 Is there any way I can ensure that things are now set to work as advertised? 有什么方法可以确保现在的东西按照宣传的方式工作吗? I tried printing the address of a variable (Edit: and a function) with NSLog and it comes up the same each time.
我尝试用NSLog打印变量的地址(编辑:和一个函数) ,每次都是相同的。 Am I doing it right?
我做得对吗?
I know this thread is old, but there is no good answer yet in case someone else stumbles upon it. 我知道这个帖子已经老了,但是如果别人偶然发现它,那就没有好的答案了。 To check if the PIE flag is set is very simple, just run this command:
要检查PIE标志是否设置非常简单,只需运行以下命令:
otool -hv /path/to/App.app/app
Where [APP] is the executable created after building (not the ipa but the executable, binary file). 其中[APP]是构建后创建的可执行文件(不是ipa,而是可执行文件,二进制文件)。
You should see something like this: 你应该看到这样的东西:
Mach header
magic cputype cpusubtype caps filetype ncmds sizeofcmds flags
MH_MAGIC ARM V7 0x00 EXECUTE 19 2708 NOUNDEFS DYLDLINK TWOLEVEL PIE
otool should be included in Xcode but if you don't have it you can install it in Xcode preferences > Downloads > Command Line Tools. otool应该包含在Xcode中,但是如果你没有它,你可以在Xcode首选项>下载>命令行工具中安装它。
检查函数地址,而不是变量地址。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.