All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 5.10] ubsan: remove CONFIG_UBSAN_OBJECT_SIZE
@ 2022-03-31 16:02 Tadeusz Struk
  2022-03-31 16:07 ` Tadeusz Struk
  0 siblings, 1 reply; 3+ messages in thread
From: Tadeusz Struk @ 2022-03-31 16:02 UTC (permalink / raw)
  To: stable
  Cc: Tadeusz Struk, Kees Cook, Marco Elver, Masahiro Yamada,
	Michal Marek, Nick Desaulniers, Nathan Chancellor,
	Andrey Ryabinin, Peter Zijlstra (Intel),
	Stephen Rothwell, Arnd Bergmann, Andrew Morton, Linus Torvalds

From: Kees Cook <keescook@chromium.org>

Upstream commit: 69d0db01e210 ("ubsan: remove CONFIG_UBSAN_OBJECT_SIZE")

The object-size sanitizer is redundant to -Warray-bounds, and
inappropriately performs its checks at run-time when all information
needed for the evaluation is available at compile-time, making it quite
difficult to use:

https://bugzilla.kernel.org/show_bug.cgi?id=214861

This run-time object-size checks also trigger false-positive errors,
like the below, that make it quite difficult to test stable kernels in
test automations like syzkaller:

https://syzkaller.appspot.com/text?tag=Error&x=12b3aac3700000

With -Warray-bounds almost enabled globally, it doesn't make sense to
keep this around.

Link: https://lkml.kernel.org/r/20211203235346.110809-1-keescook@chromium.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Marco Elver <elver@google.com>
Cc: Masahiro Yamada <masahiroy@kernel.org>
Cc: Michal Marek <michal.lkml@markovi.net>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
Cc: "Peter Zijlstra (Intel)" <peterz@infradead.org>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Tadeusz Struk <tadeusz.struk@linaro.org>
---
 lib/test_ubsan.c       | 11 -----------
 scripts/Makefile.ubsan |  1 -
 2 files changed, 12 deletions(-)

diff --git a/lib/test_ubsan.c b/lib/test_ubsan.c
index 9ea10adf7a66..b1d0a6ecfe1b 100644
--- a/lib/test_ubsan.c
+++ b/lib/test_ubsan.c
@@ -89,16 +89,6 @@ static void test_ubsan_misaligned_access(void)
 	*ptr = val;
 }
 
-static void test_ubsan_object_size_mismatch(void)
-{
-	/* "((aligned(8)))" helps this not into be misaligned for ptr-access. */
-	volatile int val __aligned(8) = 4;
-	volatile long long *ptr, val2;
-
-	ptr = (long long *)&val;
-	val2 = *ptr;
-}
-
 static const test_ubsan_fp test_ubsan_array[] = {
 	test_ubsan_add_overflow,
 	test_ubsan_sub_overflow,
@@ -110,7 +100,6 @@ static const test_ubsan_fp test_ubsan_array[] = {
 	test_ubsan_load_invalid_value,
 	//test_ubsan_null_ptr_deref, /* exclude it because there is a crash */
 	test_ubsan_misaligned_access,
-	test_ubsan_object_size_mismatch,
 };
 
 static int __init test_ubsan_init(void)
diff --git a/scripts/Makefile.ubsan b/scripts/Makefile.ubsan
index 9716dab06bc7..2156e18391a3 100644
--- a/scripts/Makefile.ubsan
+++ b/scripts/Makefile.ubsan
@@ -23,7 +23,6 @@ ifdef CONFIG_UBSAN_MISC
       CFLAGS_UBSAN += $(call cc-option, -fsanitize=integer-divide-by-zero)
       CFLAGS_UBSAN += $(call cc-option, -fsanitize=unreachable)
       CFLAGS_UBSAN += $(call cc-option, -fsanitize=signed-integer-overflow)
-      CFLAGS_UBSAN += $(call cc-option, -fsanitize=object-size)
       CFLAGS_UBSAN += $(call cc-option, -fsanitize=bool)
       CFLAGS_UBSAN += $(call cc-option, -fsanitize=enum)
 endif
-- 
2.35.1

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

* Re: [PATCH 5.10] ubsan: remove CONFIG_UBSAN_OBJECT_SIZE
  2022-03-31 16:02 [PATCH 5.10] ubsan: remove CONFIG_UBSAN_OBJECT_SIZE Tadeusz Struk
@ 2022-03-31 16:07 ` Tadeusz Struk
  2022-04-11 13:27   ` Greg Kroah-Hartman
  0 siblings, 1 reply; 3+ messages in thread
From: Tadeusz Struk @ 2022-03-31 16:07 UTC (permalink / raw)
  To: stable
  Cc: Kees Cook, Marco Elver, Masahiro Yamada, Michal Marek,
	Nick Desaulniers, Nathan Chancellor, Andrey Ryabinin,
	Peter Zijlstra (Intel),
	Stephen Rothwell, Arnd Bergmann, Andrew Morton, Linus Torvalds,
	Greg Kroah-Hartman

On 3/31/22 09:02, Tadeusz Struk wrote:
> Upstream commit: 69d0db01e210 ("ubsan: remove CONFIG_UBSAN_OBJECT_SIZE")
> 
> The object-size sanitizer is redundant to -Warray-bounds, and
> inappropriately performs its checks at run-time when all information
> needed for the evaluation is available at compile-time, making it quite
> difficult to use:
> 
> https://bugzilla.kernel.org/show_bug.cgi?id=214861
> 
> This run-time object-size checks also trigger false-positive errors,
> like the below, that make it quite difficult to test stable kernels in
> test automations like syzkaller:
> 
> https://syzkaller.appspot.com/text?tag=Error&x=12b3aac3700000
> 
> With -Warray-bounds almost enabled globally, it doesn't make sense to
> keep this around.

Hi,
This back-port is for 5.10 only. Please also cherry-pick the original
commit 69d0db01e210 ("ubsan: remove CONFIG_UBSAN_OBJECT_SIZE")
to 5.15.y and 5.16.y. There is no back-port required for these kernels.

-- 
Thanks,
Tadeusz

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

* Re: [PATCH 5.10] ubsan: remove CONFIG_UBSAN_OBJECT_SIZE
  2022-03-31 16:07 ` Tadeusz Struk
@ 2022-04-11 13:27   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2022-04-11 13:27 UTC (permalink / raw)
  To: Tadeusz Struk
  Cc: stable, Kees Cook, Marco Elver, Masahiro Yamada, Michal Marek,
	Nick Desaulniers, Nathan Chancellor, Andrey Ryabinin,
	Peter Zijlstra (Intel),
	Stephen Rothwell, Arnd Bergmann, Andrew Morton, Linus Torvalds

On Thu, Mar 31, 2022 at 09:07:02AM -0700, Tadeusz Struk wrote:
> On 3/31/22 09:02, Tadeusz Struk wrote:
> > Upstream commit: 69d0db01e210 ("ubsan: remove CONFIG_UBSAN_OBJECT_SIZE")
> > 
> > The object-size sanitizer is redundant to -Warray-bounds, and
> > inappropriately performs its checks at run-time when all information
> > needed for the evaluation is available at compile-time, making it quite
> > difficult to use:
> > 
> > https://bugzilla.kernel.org/show_bug.cgi?id=214861
> > 
> > This run-time object-size checks also trigger false-positive errors,
> > like the below, that make it quite difficult to test stable kernels in
> > test automations like syzkaller:
> > 
> > https://syzkaller.appspot.com/text?tag=Error&x=12b3aac3700000
> > 
> > With -Warray-bounds almost enabled globally, it doesn't make sense to
> > keep this around.
> 
> Hi,
> This back-port is for 5.10 only. Please also cherry-pick the original
> commit 69d0db01e210 ("ubsan: remove CONFIG_UBSAN_OBJECT_SIZE")
> to 5.15.y and 5.16.y. There is no back-port required for these kernels.

Now queued up, thanks.

greg k-h

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

end of thread, other threads:[~2022-04-11 13:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-31 16:02 [PATCH 5.10] ubsan: remove CONFIG_UBSAN_OBJECT_SIZE Tadeusz Struk
2022-03-31 16:07 ` Tadeusz Struk
2022-04-11 13:27   ` Greg Kroah-Hartman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.