stack-protect equivalent in clang compiler?

北慕城南 提交于 2019-12-05 20:17:21

clang support gcc's -fstack-protector option:

:: clang --help | grep stack-protector
-fno-stack-protector    Disable the use of stack protectors
-fstack-protector-all   Force the usage of stack protectors for all functions
-fstack-protector-strong
-fstack-protector       Enable stack protectors for functions potentially vulnerable to stack smashing

And I believe it follows what GCC does here.

Do you want to find hidden memory bugs in your app or harden it for production use? For the former you can go with -fsanitize=address which is available both in GCC and in Clang, provides excellent buffer overflow detection and can be applied to parts of your program (you won't detect all errors in this case). It's not suitable for production use though as it has a 2x performance penalty and makes program more vulnerable to external attacks.

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