lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Thu, 3 Feb 2022 13:26:24 -0800 From: Kees Cook <keescook@...omium.org> To: Nick Desaulniers <ndesaulniers@...gle.com> Cc: Miguel Ojeda <ojeda@...nel.org>, Nathan Chancellor <nathan@...nel.org>, George Burgess IV <gbiv@...gle.com>, llvm@...ts.linux.dev, linux-kernel@...r.kernel.org, linux-hardening@...r.kernel.org Subject: Re: [PATCH v6 4/4] fortify: Add Clang support On Thu, Feb 03, 2022 at 12:37:41PM -0800, Nick Desaulniers wrote: > On Thu, Feb 3, 2022 at 9:33 AM Kees Cook <keescook@...omium.org> wrote: > > > > Enable FORTIFY_SOURCE support for Clang: > > > > Use the new __pass_object_size and __overloadable attributes so > > that Clang will have appropriate visibility into argument sizes such > > that __builtin_object_size(p, 1) will behave correctly. Additional > > details here: > > https://github.com/llvm/llvm-project/issues/53516 > > https://github.com/ClangBuiltLinux/linux/issues/1401 > > > > When available, use the new __diagnose_as attribute to make sure no > > compile-time diagnostic warnings are lost due to the effectively renamed > > string functions. > > Consider adding something along the lines of the following to the > above paragraph: > Without diagnose_as, compile time error messages won't be as precise > as they could be, but at least users of older toolchains will have > fortified routines. That is more valuable, but certainly a tradeoff. Sure, I've changed it to: When available, use the new __diagnose_as attribute to make sure no compile-time diagnostic warnings are lost due to the effectively renamed string functions. Without __diagnose_as, Clang's compile time diagnostic messages won't be as precise as they could be, but at least users of older toolchains will have fortified routines. how's that read for you? > > Redefine strlen() as a macro that tests for being a constant expression > > so that strlen() can still be used in static initializers, which was > > lost when adding __pass_object_size and __overloadable. > > I'd like to see `const` changes explicit in 4/4; I suspect that's > _why_ __overloadable is even needed? If so, then a comment here about > that wouldn't hurt. > > Having const be more explicit in the signature will make it more > obvious why the definition cannot modify the parameter. Mostly I wanted to minimize further changes to this area when building with GCC because of all the corner cases that keep popping up, and avoid tweaking the prototypes any harder. :) -- Kees Cook
Powered by blists - more mailing lists