* [PATCH] ubsan: Disable signed integer overflow sanitizer on GCC < 8
@ 2024-03-13 18:12 Kees Cook
2024-03-13 18:19 ` Marco Elver
0 siblings, 1 reply; 2+ messages in thread
From: Kees Cook @ 2024-03-13 18:12 UTC (permalink / raw)
To: Marco Elver
Cc: Kees Cook, kernel test robot, Andrey Konovalov, Andrey Ryabinin,
kasan-dev, linux-hardening, linux-kernel
For opting functions out of sanitizer coverage, the "no_sanitize"
attribute is used, but in GCC this wasn't introduced until GCC 8.
Disable the sanitizer unless we're not using GCC, or it is GCC
version 8 or higher.
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202403110643.27JXEVCI-lkp@intel.com/
Signed-off-by: Kees Cook <keescook@chromium.org>
---
Cc: Marco Elver <elver@google.com>
Cc: Andrey Konovalov <andreyknvl@gmail.com>
Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
Cc: kasan-dev@googlegroups.com
Cc: linux-hardening@vger.kernel.org
---
lib/Kconfig.ubsan | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lib/Kconfig.ubsan b/lib/Kconfig.ubsan
index 48a67058f84e..e81e1ac4a919 100644
--- a/lib/Kconfig.ubsan
+++ b/lib/Kconfig.ubsan
@@ -119,6 +119,8 @@ config UBSAN_SIGNED_WRAP
bool "Perform checking for signed arithmetic wrap-around"
default UBSAN
depends on !COMPILE_TEST
+ # The no_sanitize attribute was introduced in GCC with version 8.
+ depends on !CC_IS_GCC || GCC_VERSION >= 80000
depends on $(cc-option,-fsanitize=signed-integer-overflow)
help
This option enables -fsanitize=signed-integer-overflow which checks
--
2.34.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] ubsan: Disable signed integer overflow sanitizer on GCC < 8
2024-03-13 18:12 [PATCH] ubsan: Disable signed integer overflow sanitizer on GCC < 8 Kees Cook
@ 2024-03-13 18:19 ` Marco Elver
0 siblings, 0 replies; 2+ messages in thread
From: Marco Elver @ 2024-03-13 18:19 UTC (permalink / raw)
To: Kees Cook
Cc: kernel test robot, Andrey Konovalov, Andrey Ryabinin, kasan-dev,
linux-hardening, linux-kernel
On Wed, 13 Mar 2024 at 19:12, Kees Cook <keescook@chromium.org> wrote:
>
> For opting functions out of sanitizer coverage, the "no_sanitize"
> attribute is used, but in GCC this wasn't introduced until GCC 8.
> Disable the sanitizer unless we're not using GCC, or it is GCC
> version 8 or higher.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202403110643.27JXEVCI-lkp@intel.com/
> Signed-off-by: Kees Cook <keescook@chromium.org>
Looks reasonable:
Reviewed-by: Marco Elver <elver@google.com>
Thanks,
-- Marco
> ---
> Cc: Marco Elver <elver@google.com>
> Cc: Andrey Konovalov <andreyknvl@gmail.com>
> Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
> Cc: kasan-dev@googlegroups.com
> Cc: linux-hardening@vger.kernel.org
> ---
> lib/Kconfig.ubsan | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/lib/Kconfig.ubsan b/lib/Kconfig.ubsan
> index 48a67058f84e..e81e1ac4a919 100644
> --- a/lib/Kconfig.ubsan
> +++ b/lib/Kconfig.ubsan
> @@ -119,6 +119,8 @@ config UBSAN_SIGNED_WRAP
> bool "Perform checking for signed arithmetic wrap-around"
> default UBSAN
> depends on !COMPILE_TEST
> + # The no_sanitize attribute was introduced in GCC with version 8.
> + depends on !CC_IS_GCC || GCC_VERSION >= 80000
> depends on $(cc-option,-fsanitize=signed-integer-overflow)
> help
> This option enables -fsanitize=signed-integer-overflow which checks
> --
> 2.34.1
>
> --
> You received this message because you are subscribed to the Google Groups "kasan-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to kasan-dev+unsubscribe@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/kasan-dev/20240313181217.work.263-kees%40kernel.org.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-03-13 18:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-13 18:12 [PATCH] ubsan: Disable signed integer overflow sanitizer on GCC < 8 Kees Cook
2024-03-13 18:19 ` Marco Elver
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®