-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
_FORTIFY_SOURCE guidance confuses people, should suggest undefining with more care (as order matters) #658
Comments
Cross-referencing against GCC bug 40960: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=40960 |
The link to the POSIX specifications in GCC bug 40960 is broken as the name of the C compilation system utility is periodically changed. The current link (as of POSIX.1-2024) is https://pubs.opengroup.org/onlinepubs/9799919799/utilities/c17.html From a practical perspective, neither GCC not Clang conform to POSIX in this regard and that seems highly unlikely to change. |
Frankly, I think the POSIX specification is broken in this situation, especially since gcc and clang don't work that way (and I believe they never have). Some text like this: We recommend using |
Thanks, I crossposted this back to the GCC bug. |
Wireshark recently had an MR at https://gitlab.com/wireshark/wireshark/-/merge_requests/16860 that did
-D_FORTIFY_SOURCE=3 -U_FORTIFY_SOURCE
, possibly with the intent being to sort the options alphabetically, but the order matters.The documentation at https://best.openssf.org/Compiler-Hardening-Guides/Compiler-Options-Hardening-Guide-for-C-and-C++#tldr-what-compiler-options-should-i-use should make clear the order matters and that it must be
-U_FORTIFY_SOURCE
and then-D_FORTIFY_SOURCE=3
.The text was updated successfully, but these errors were encountered: