diff options
author | Kees Cook <keescook@chromium.org> | 2022-02-08 23:53:49 +0100 |
---|---|---|
committer | Kees Cook <keescook@chromium.org> | 2022-02-14 01:50:07 +0100 |
commit | 67ebc3ab446230c77fe3b545a9d8a11cac1cfb6e (patch) | |
tree | 712643fdda5c0f50442eb4d9238daaa2035be71f /security/Kconfig | |
parent | fortify: Use __diagnose_as() for better diagnostic coverage (diff) | |
download | linux-67ebc3ab446230c77fe3b545a9d8a11cac1cfb6e.tar.xz linux-67ebc3ab446230c77fe3b545a9d8a11cac1cfb6e.zip |
fortify: Make sure strlen() may still be used as a constant expression
In preparation for enabling Clang FORTIFY_SOURCE support, redefine
strlen() as a macro that tests for being a constant expression
so that strlen() can still be used in static initializers, which is
lost when adding __pass_object_size and __overloadable.
An example of this usage can be seen here:
https://lore.kernel.org/all/202201252321.dRmWZ8wW-lkp@intel.com/
Notably, this constant expression feature of strlen() is not available
for architectures that build with -ffreestanding. This means the kernel
currently does not universally expect strlen() to be used this way, but
since there _are_ some build configurations that depend on it, retain
the characteristic for Clang FORTIFY_SOURCE builds too.
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Link: https://lore.kernel.org/r/20220208225350.1331628-8-keescook@chromium.org
Diffstat (limited to 'security/Kconfig')
0 files changed, 0 insertions, 0 deletions