Skip to content

Fix Clang vs CONFIG_FORTIFY_SOURCE #77

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

Closed
2 of 3 tasks
kees opened this issue Jun 3, 2020 · 4 comments
Closed
2 of 3 tasks

Fix Clang vs CONFIG_FORTIFY_SOURCE #77

kees opened this issue Jun 3, 2020 · 4 comments
Assignees
Labels
bug Something isn't working [Compiler] Clang An issue in Clang itself needs to be addressed [Feature] FORTIFY_SOURCE Involves buffer overflow detection

Comments

@kees
Copy link

kees commented Jun 3, 2020

This is the KSPP bug to track this same issue from ClangBuiltLinux:
ClangBuiltLinux#1002

Basically, CONFIG_FORTIFY_SOURCE does nothing under Clang.

These bugs can be worked around by reorganizing the fortify macros in the kernel, which is underway.

@kees kees added bug Something isn't working compiler Needs compiler support labels Jun 3, 2020
@kees
Copy link
Author

kees commented Aug 21, 2020

Maybe use PASS_ARGUMENT_SIZE, but doesn't seem to help with collapsing: https://godbolt.org/z/_2Fj3z

@kees
Copy link
Author

kees commented Aug 21, 2020

Using external __*_chk() functions can convince Clang to DTRT, but code generation doesn't look right, and this fails in the face of -ffreestanding:
ClangBuiltLinux@41a9c9c

@kees kees self-assigned this Oct 21, 2020
@kees
Copy link
Author

kees commented Oct 21, 2020

Clang and GCC differ in their beliefs about flexible-array address calculations: https://godbolt.org/z/PWjEoo

@kees kees added [Compiler] Clang An issue in Clang itself needs to be addressed and removed compiler Needs compiler support labels Jun 4, 2021
@kees
Copy link
Author

kees commented Apr 7, 2022

This still could use some improvement in Clang, but overall this is fixed in the kernel now with the various commits leading up to and include commit 281d0c9 (v5.18).

@kees kees closed this as completed Apr 7, 2022
@kees kees added the [Feature] FORTIFY_SOURCE Involves buffer overflow detection label Apr 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working [Compiler] Clang An issue in Clang itself needs to be addressed [Feature] FORTIFY_SOURCE Involves buffer overflow detection
Projects
None yet
Development

No branches or pull requests

1 participant