本文介绍了clang编译器中的堆栈保护等效项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大多数成熟的编译器似乎都对堆栈变量修饰符有很好的支持。

Most of the mature compilers appear to have good support for stack variable clobbers.


  • GCC:

  • xlC:

  • intel:

  • windows:/ RTC

  • GCC: -fstack-protector
  • xlC: -qstackprotect
  • intel: -fstackprotector
  • windows: /RTC

对于c,我发现,但它不支持共享库,这使它变得毫无用处对我来说。

For clang I've found -fsanitize=safe-stack, but it doesn't support shared libraries, which makes it pretty much useless for me.

看起来消毒剂是作为附加组件实现的?是否有人知道clang是否具有不受共享库限制的任何替代(内置?)反堆栈粉碎支持,或者是否有计划推广现有的有限安全堆栈实现以赶上其他所有编译器?

It looks like that sanitizer is implemented as an add-on? Does anybody know if clang has any sort of alternate (built-in?) anti stack-smashing support that doesn't have the no shared library restriction, or if there are plans to generalize the existing limited safe-stack implementation to catch up to all the other compilers?

推荐答案

clang支持gcc的 -fstack-protector 选项:

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

我相信遵循GCC在这里所做的事情。

And I believe it follows what GCC does here.

这篇关于clang编译器中的堆栈保护等效项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-26 12:02