linux-hardening.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ubsan: remove cc-option test for UBSAN_TRAP
@ 2023-04-07 21:54 Nick Desaulniers
  2023-04-07 21:58 ` Nathan Chancellor
  2023-05-17 19:02 ` Kees Cook
  0 siblings, 2 replies; 11+ messages in thread
From: Nick Desaulniers @ 2023-04-07 21:54 UTC (permalink / raw)
  To: Kees Cook, Masahiro Yamada
  Cc: linux-hardening, Nathan Chancellor, Tom Rix, Josh Poimboeuf,
	Peter Zijlstra, Miroslav Benes, linux-kernel, llvm, linux-kbuild,
	Nick Desaulniers

-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@google.com>
---
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


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH] ubsan: remove cc-option test for UBSAN_TRAP
  2023-04-07 21:54 [PATCH] ubsan: remove cc-option test for UBSAN_TRAP Nick Desaulniers
@ 2023-04-07 21:58 ` Nathan Chancellor
  2023-04-12  0:12   ` Fangrui Song
  2023-05-17 19:02 ` Kees Cook
  1 sibling, 1 reply; 11+ messages in thread
From: Nathan Chancellor @ 2023-04-07 21:58 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Kees Cook, Masahiro Yamada, linux-hardening, Tom Rix,
	Josh Poimboeuf, Peter Zijlstra, Miroslav Benes, linux-kernel,
	llvm, linux-kbuild

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@google.com>

Reviewed-by: Nathan Chancellor <nathan@kernel.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
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] ubsan: remove cc-option test for UBSAN_TRAP
  2023-04-07 21:58 ` Nathan Chancellor
@ 2023-04-12  0:12   ` Fangrui Song
  2023-04-12 15:12     ` Kees Cook
  0 siblings, 1 reply; 11+ messages in thread
From: Fangrui Song @ 2023-04-12  0:12 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Nathan Chancellor, Kees Cook, Masahiro Yamada, linux-hardening,
	Tom Rix, Josh Poimboeuf, Peter Zijlstra, Miroslav Benes,
	linux-kernel, llvm, linux-kbuild

On Fri, Apr 7, 2023 at 2:58 PM Nathan Chancellor <nathan@kernel.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@google.com>
>
> Reviewed-by: Nathan Chancellor <nathan@kernel.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.



-- 
宋方睿

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] ubsan: remove cc-option test for UBSAN_TRAP
  2023-04-12  0:12   ` Fangrui Song
@ 2023-04-12 15:12     ` Kees Cook
  2023-04-12 18:13       ` Fangrui Song
  0 siblings, 1 reply; 11+ messages in thread
From: Kees Cook @ 2023-04-12 15:12 UTC (permalink / raw)
  To: Fangrui Song
  Cc: Nick Desaulniers, Nathan Chancellor, Masahiro Yamada,
	linux-hardening, Tom Rix, Josh Poimboeuf, Peter Zijlstra,
	Miroslav Benes, linux-kernel, llvm, linux-kbuild

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@kernel.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@google.com>
> >
> > Reviewed-by: Nathan Chancellor <nathan@kernel.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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] ubsan: remove cc-option test for UBSAN_TRAP
  2023-04-12 15:12     ` Kees Cook
@ 2023-04-12 18:13       ` Fangrui Song
  2023-04-19 21:02         ` Fangrui Song
  0 siblings, 1 reply; 11+ messages in thread
From: Fangrui Song @ 2023-04-12 18:13 UTC (permalink / raw)
  To: Kees Cook
  Cc: Nick Desaulniers, Nathan Chancellor, Masahiro Yamada,
	linux-hardening, Tom Rix, Josh Poimboeuf, Peter Zijlstra,
	Miroslav Benes, linux-kernel, llvm, linux-kbuild

On Wed, Apr 12, 2023 at 8:12 AM Kees Cook <keescook@chromium.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@kernel.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@google.com>
> > >
> > > Reviewed-by: Nathan Chancellor <nathan@kernel.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.





-- 
宋方睿

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] ubsan: remove cc-option test for UBSAN_TRAP
  2023-04-12 18:13       ` Fangrui Song
@ 2023-04-19 21:02         ` Fangrui Song
  0 siblings, 0 replies; 11+ messages in thread
From: Fangrui Song @ 2023-04-19 21:02 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Kees Cook, Nathan Chancellor, Masahiro Yamada, linux-hardening,
	Tom Rix, Josh Poimboeuf, Peter Zijlstra, Miroslav Benes,
	linux-kernel, llvm, linux-kbuild

On Wed, Apr 12, 2023 at 11:13 AM Fangrui Song <maskray@google.com> wrote:
>
> On Wed, Apr 12, 2023 at 8:12 AM Kees Cook <keescook@chromium.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@kernel.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@google.com>
> > > >
> > > > Reviewed-by: Nathan Chancellor <nathan@kernel.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.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] ubsan: remove cc-option test for UBSAN_TRAP
  2023-04-07 21:54 [PATCH] ubsan: remove cc-option test for UBSAN_TRAP Nick Desaulniers
  2023-04-07 21:58 ` Nathan Chancellor
@ 2023-05-17 19:02 ` Kees Cook
  2023-05-17 19:08   ` Fangrui Song
  1 sibling, 1 reply; 11+ messages in thread
From: Kees Cook @ 2023-05-17 19:02 UTC (permalink / raw)
  To: ndesaulniers, masahiroy
  Cc: Kees Cook, linux-kbuild, nathan, linux-hardening, jpoimboe, llvm,
	mbenes, linux-kernel, trix, peterz

On Fri, 7 Apr 2023 14:54:06 -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.
> 
> 

Applied to for-next/hardening, thanks!

[1/1] ubsan: remove cc-option test for UBSAN_TRAP
      https://git.kernel.org/kees/c/08e4044243a6

-- 
Kees Cook


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] ubsan: remove cc-option test for UBSAN_TRAP
  2023-05-17 19:02 ` Kees Cook
@ 2023-05-17 19:08   ` Fangrui Song
  2023-05-17 19:09     ` Fangrui Song
  0 siblings, 1 reply; 11+ messages in thread
From: Fangrui Song @ 2023-05-17 19:08 UTC (permalink / raw)
  To: Kees Cook
  Cc: ndesaulniers, masahiroy, linux-kbuild, nathan, linux-hardening,
	jpoimboe, llvm, mbenes, linux-kernel, trix, peterz

On Wed, May 17, 2023 at 12:02 PM Kees Cook <keescook@chromium.org> wrote:
>
> On Fri, 7 Apr 2023 14:54:06 -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.
> >
> >
>
> Applied to for-next/hardening, thanks!
>
> [1/1] ubsan: remove cc-option test for UBSAN_TRAP
>       https://git.kernel.org/kees/c/08e4044243a6
>
> --
> Kees Cook
>
>

For this -fsanitize-undefined-trap-on-error, I think we need a v2 patch that
tries -fsanitize-trap=all as well.

-fsanitize-undefined-trap-on-error has been deprecated in Clang for 8
years, and at some point we will remove the option.

GCC implements -fsanitize-trap=all later, but
-fsanitize-undefined-trap-on-error is documented as deprecated as
well.


-- 
宋方睿

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] ubsan: remove cc-option test for UBSAN_TRAP
  2023-05-17 19:08   ` Fangrui Song
@ 2023-05-17 19:09     ` Fangrui Song
  2023-05-17 19:16       ` Kees Cook
  0 siblings, 1 reply; 11+ messages in thread
From: Fangrui Song @ 2023-05-17 19:09 UTC (permalink / raw)
  To: Kees Cook
  Cc: ndesaulniers, masahiroy, linux-kbuild, nathan, linux-hardening,
	jpoimboe, llvm, mbenes, linux-kernel, trix, peterz

On Wed, May 17, 2023 at 12:08 PM Fangrui Song <maskray@google.com> wrote:
>
> On Wed, May 17, 2023 at 12:02 PM Kees Cook <keescook@chromium.org> wrote:
> >
> > On Fri, 7 Apr 2023 14:54:06 -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.
> > >
> > >
> >
> > Applied to for-next/hardening, thanks!
> >
> > [1/1] ubsan: remove cc-option test for UBSAN_TRAP
> >       https://git.kernel.org/kees/c/08e4044243a6
> >
> > --
> > Kees Cook
> >
> >
>
> For this -fsanitize-undefined-trap-on-error, I think we need a v2 patch that
> tries -fsanitize-trap=all as well.

Correction: -fsanitize-trap=undefined

> -fsanitize-undefined-trap-on-error has been deprecated in Clang for 8
> years, and at some point we will remove the option.
>
> GCC implements -fsanitize-trap=all later, but
> -fsanitize-undefined-trap-on-error is documented as deprecated as
> well.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] ubsan: remove cc-option test for UBSAN_TRAP
  2023-05-17 19:09     ` Fangrui Song
@ 2023-05-17 19:16       ` Kees Cook
  2023-05-17 19:22         ` Fangrui Song
  0 siblings, 1 reply; 11+ messages in thread
From: Kees Cook @ 2023-05-17 19:16 UTC (permalink / raw)
  To: Fangrui Song
  Cc: ndesaulniers, masahiroy, linux-kbuild, nathan, linux-hardening,
	jpoimboe, llvm, mbenes, linux-kernel, trix, peterz

On Wed, May 17, 2023 at 12:09:35PM -0700, Fangrui Song wrote:
> On Wed, May 17, 2023 at 12:08 PM Fangrui Song <maskray@google.com> wrote:
> >
> > On Wed, May 17, 2023 at 12:02 PM Kees Cook <keescook@chromium.org> wrote:
> > >
> > > On Fri, 7 Apr 2023 14:54:06 -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.
> > > >
> > > >
> > >
> > > Applied to for-next/hardening, thanks!
> > >
> > > [1/1] ubsan: remove cc-option test for UBSAN_TRAP
> > >       https://git.kernel.org/kees/c/08e4044243a6
> > >
> > > --
> > > Kees Cook
> > >
> > >
> >
> > For this -fsanitize-undefined-trap-on-error, I think we need a v2 patch that
> > tries -fsanitize-trap=all as well.
> 
> Correction: -fsanitize-trap=undefined
> 
> > -fsanitize-undefined-trap-on-error has been deprecated in Clang for 8
> > years, and at some point we will remove the option.
> >
> > GCC implements -fsanitize-trap=all later, but
> > -fsanitize-undefined-trap-on-error is documented as deprecated as
> > well.

Right now all the compilers support the old way, and I'd rather remove a
cc-option call than add two. :)

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] ubsan: remove cc-option test for UBSAN_TRAP
  2023-05-17 19:16       ` Kees Cook
@ 2023-05-17 19:22         ` Fangrui Song
  0 siblings, 0 replies; 11+ messages in thread
From: Fangrui Song @ 2023-05-17 19:22 UTC (permalink / raw)
  To: Kees Cook
  Cc: ndesaulniers, masahiroy, linux-kbuild, nathan, linux-hardening,
	jpoimboe, llvm, mbenes, linux-kernel, trix, peterz

On Wed, May 17, 2023 at 12:16 PM Kees Cook <keescook@chromium.org> wrote:
>
> On Wed, May 17, 2023 at 12:09:35PM -0700, Fangrui Song wrote:
> > On Wed, May 17, 2023 at 12:08 PM Fangrui Song <maskray@google.com> wrote:
> > >
> > > On Wed, May 17, 2023 at 12:02 PM Kees Cook <keescook@chromium.org> wrote:
> > > >
> > > > On Fri, 7 Apr 2023 14:54:06 -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.
> > > > >
> > > > >
> > > >
> > > > Applied to for-next/hardening, thanks!
> > > >
> > > > [1/1] ubsan: remove cc-option test for UBSAN_TRAP
> > > >       https://git.kernel.org/kees/c/08e4044243a6
> > > >
> > > > --
> > > > Kees Cook
> > > >
> > > >
> > >
> > > For this -fsanitize-undefined-trap-on-error, I think we need a v2 patch that
> > > tries -fsanitize-trap=all as well.
> >
> > Correction: -fsanitize-trap=undefined
> >
> > > -fsanitize-undefined-trap-on-error has been deprecated in Clang for 8
> > > years, and at some point we will remove the option.
> > >
> > > GCC implements -fsanitize-trap=all later, but
> > > -fsanitize-undefined-trap-on-error is documented as deprecated as
> > > well.
>
> Right now all the compilers support the old way, and I'd rather remove a
> cc-option call than add two. :)
>
> --
> Kees Cook

Hmm, this gives Clang developers a disadvantage... Anyone who removes
Clang's -fsanitize-undefined-trap-on-error (or give it a warning
before removal) will probably face complaints from kernel
developers...



-- 
宋方睿

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-05-17 19:23 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-07 21:54 [PATCH] ubsan: remove cc-option test for UBSAN_TRAP Nick Desaulniers
2023-04-07 21:58 ` Nathan Chancellor
2023-04-12  0:12   ` Fangrui Song
2023-04-12 15:12     ` Kees Cook
2023-04-12 18:13       ` Fangrui Song
2023-04-19 21:02         ` Fangrui Song
2023-05-17 19:02 ` Kees Cook
2023-05-17 19:08   ` Fangrui Song
2023-05-17 19:09     ` Fangrui Song
2023-05-17 19:16       ` Kees Cook
2023-05-17 19:22         ` Fangrui Song

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).