lkml.org 
[lkml]   [2022]   [Jan]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v4] fortify: Work around Clang inlining bugs
On Sun, Jan 30, 2022 at 10:22 AM Kees Cook <keescook@chromium.org> wrote:
>
> To enable FORTIFY_SOURCE support for Clang, the kernel must work around
> a pair of bugs, related to Clang's inlining:
>
> 1) Change all the fortified string APIs into macros with different
> inline names to bypass Clang's broken inline-of-a-builtin detection:
> https://bugs.llvm.org/show_bug.cgi?id=50322
>
> 2) Lift all misbehaving __builtin_object_size() calls into the macros
> to bypass Clang's broken __builtin_object_size() arguments-of-an-inline
> visibility:
> https://github.com/ClangBuiltLinux/linux/issues/1401

^ mentions a difference in compilers for mode 1. I wonder if this
patch could "hoist" the BOS calls into the macro ONLY for mode 1 and
not mode 0 usage? i.e. the str* functions, not the mem* functions.

It's too late to fix these in clang-13. If we get a fix in clang-14
or later, what does that look like for this header? Is there a way we
can provide a different header than include/linux/fortify-string.h
just for clang-13 (or whatever versions until the above are fixed)?

I don't see this series getting backported to stable, where older
versions of clang may still be in use.

I'm tempted to say "let's get get these 2 fixed in clang-14" but we'll
probably have to trade something off the existing TODO list.
--
Thanks,
~Nick Desaulniers

\
 
 \ /
  Last update: 2022-01-31 20:05    [W:0.039 / U:0.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site