如何在纯快速应用程序中启用堆栈粉碎保护?
How to enable Stack Smashing Protection in pure swift application?
我确实尝试将"-fstack-protector-all"标志放入xCode中项目构建设置选项卡下的其他C ++"标志,但是似乎该标志未使用或对构建的应用程序没有影响.
I did try to put "-fstack-protector-all" flag to Other C++ Flags under project build settings tab in xCode, but is seems that, this flag is unused or have no impact on builded application.
要验证版本,我使用的是otool -Iv AppBinary | grep stack.
To verifie build I'm using otool -Iv AppBinary | grep stack.
推荐答案在Swift中,默认情况下启用堆栈粉碎,只需要在Objective-C应用程序的构建设置下添加"-fstack-protector-all"标志即可.
In Swift, Stack smashing is enabled by default one only need to add the "-fstack-protector-all" flag under build settings in objective-c applications.
如何检查是否启用了堆栈粉碎功能. 运行otool命令,并且stack_chk_guard和stack_chk_fail的存在表示代码受堆栈粉碎保护.
How to check if stack smashing is enabled. Run the otool command and presence of stack_chk_guard and stack_chk_fail means the code is stack smashing protected.
$ otool -Iv <appname>|grep stack 0x0013dfg 520 ___stack_chk_fail 0x001d009 521 ___stack_chk_guard 0x001fd345 520 ___stack_chk_fail 0x000000010087efd 513 ___stack_chk_fail 0x0000000100098hf3 514 ___stack_chk_guard 0x00000001000897gfr 513 ___stack_chk_fail更多推荐
Swift和Stack防砸保护
发布评论