[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAFP8O3K1pO7AAMDeDyiSj3jCL2aOm_X88sUf5yZ4onc3whr9Jw@mail.gmail.com>
Date: Wed, 19 Apr 2023 14:02:21 -0700
From: Fangrui Song <maskray@...gle.com>
To: Nick Desaulniers <ndesaulniers@...gle.com>
Cc: Kees Cook <keescook@...omium.org>,
Nathan Chancellor <nathan@...nel.org>,
Masahiro Yamada <masahiroy@...nel.org>,
linux-hardening@...r.kernel.org, Tom Rix <trix@...hat.com>,
Josh Poimboeuf <jpoimboe@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Miroslav Benes <mbenes@...e.cz>, linux-kernel@...r.kernel.org,
llvm@...ts.linux.dev, linux-kbuild@...r.kernel.org
Subject: Re: [PATCH] ubsan: remove cc-option test for UBSAN_TRAP
On Wed, Apr 12, 2023 at 11:13 AM Fangrui Song <maskray@...gle.com> wrote:
>
> On Wed, Apr 12, 2023 at 8:12 AM Kees Cook <keescook@...omium.org> wrote:
> >
> > On Tue, Apr 11, 2023 at 05:12:24PM -0700, Fangrui Song wrote:
> > > On Fri, Apr 7, 2023 at 2:58 PM Nathan Chancellor <nathan@...nel.org> wrote:
> > > >
> > > > On Fri, Apr 07, 2023 at 02:54:06PM -0700, Nick Desaulniers wrote:
> > > > > -fsanitize-undefined-trap-on-error has been supported since GCC 5.1 and
> > > > > Clang 3.2. The minimum supported version of these according to
> > > > > Documentation/process/changes.rst is 5.1 and 11.0.0 respectively. Drop
> > > > > this cc-option check.
> > > > >
> > > > > Signed-off-by: Nick Desaulniers <ndesaulniers@...gle.com>
> > > >
> > > > Reviewed-by: Nathan Chancellor <nathan@...nel.org>
> > > >
> > > > As an aside, we should really consider having some standard format of
> > > > comment around cc-option checks so that we can easily remove them when
> > > > they become stale...
> > > >
> > > > > ---
> > > > > Masahiro, Kees: get_maintainer.pl leaves much to be desired for this
> > > > > file. Can one of you please pick this up?
> > > > >
> > > > > lib/Kconfig.ubsan | 1 -
> > > > > 1 file changed, 1 deletion(-)
> > > > >
> > > > > diff --git a/lib/Kconfig.ubsan b/lib/Kconfig.ubsan
> > > > > index fd15230a703b..0e7ad0782399 100644
> > > > > --- a/lib/Kconfig.ubsan
> > > > > +++ b/lib/Kconfig.ubsan
> > > > > @@ -15,7 +15,6 @@ if UBSAN
> > > > > config UBSAN_TRAP
> > > > > bool "On Sanitizer warnings, abort the running kernel code"
> > > > > depends on !COMPILE_TEST
> > > > > - depends on $(cc-option, -fsanitize-undefined-trap-on-error)
> > > > > help
> > > > > Building kernels with Sanitizer features enabled tends to grow
> > > > > the kernel size by around 5%, due to adding all the debugging
> > > > > --
> > > > > 2.40.0.577.gac1e443424-goog
> > > > >
> > > >
> > >
> > > -fsanitize-undefined-trap-on-error is a legacy option from 2013 when
> > > -fcatch-undefined-behavior instead of -fsanitize=undefined enabled
> > > UBSan.
> > > On the Clang side, http://reviews.llvm.org/D10464 added
> > > -fsanitize-trap= in June 2015.
> > > It's best to use -fsanitize-trap=undefined and avoid uses of
> > > -fsanitize-undefined-trap-on-error.
> >
> > But that's Clang-only. -fsanitize-undefined-trap-on-error works for both
> > GCC and Clang.
> >
> > --
> > Kees Cook
>
> Just filed a -fsanitize-trap= feature request for GCC:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109489 :)
>
> https://reviews.llvm.org/D10464 (2015) does mention the state of the
> legacy option:
>
> // https://clang.llvm.org/docs/UsersManual.html#cmdoption-fsanitize-undefined-trap-on-error
> -fsanitize-undefined-trap-on-error
> Deprecated alias for -fsanitize-trap=undefined.
Circling back. it seems that GCC 13 will have
-fsanitize-trap=undefined (a commit from 2022-06).
The current https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html
says "The -fsanitize-undefined-trap-on-error option is deprecated
equivalent of -fsanitize-trap=all."
We need to discourage further uses of the deprecated
-fsanitize-undefined-trap-on-error.
Powered by blists - more mailing lists