* [PATCH v2 0/7] set clang minimum version to 10.0.1
@ 2020-09-01 0:23 Nick Desaulniers
2020-09-01 0:23 ` [PATCH v2 1/7] compiler-clang: add build check for clang 10.0.1 Nick Desaulniers
` (8 more replies)
0 siblings, 9 replies; 21+ messages in thread
From: Nick Desaulniers @ 2020-09-01 0:23 UTC (permalink / raw)
To: Andrew Morton
Cc: Kees Cook, Miguel Ojeda, Nathan Chancellor, Sedat Dilek,
Marco Elver, Andrey Konovalov, Masahiro Yamada,
clang-built-linux, Daniel Borkmann, Alexei Starovoitov,
Will Deacon, Vincenzo Frascino, linux-kernel, Nick Desaulniers
Adds a compile time #error to compiler-clang.h setting the effective
minimum supported version to clang 10.0.1. A separate patch has already
been picked up into the Documentation/ tree also confirming the version.
Next are a series of reverts. One for 32b arm is a partial revert.
Then Marco suggested fixes to KASAN docs.
Finally, improve the warning for GCC too as per Kees.
Patches after 001 are new for v2.
Marco Elver (1):
kasan: Remove mentions of unsupported Clang versions
Nick Desaulniers (6):
compiler-clang: add build check for clang 10.0.1
Revert "kbuild: disable clang's default use of -fmerge-all-constants"
Revert "arm64: bti: Require clang >= 10.0.1 for in-kernel BTI support"
Revert "arm64: vdso: Fix compilation with clang older than 8"
Partial revert "ARM: 8905/1: Emit __gnu_mcount_nc when using Clang
10.0.0 or newer"
compiler-gcc: improve version warning
Documentation/dev-tools/kasan.rst | 4 ++--
Makefile | 9 ---------
arch/arm/Kconfig | 2 +-
arch/arm64/Kconfig | 2 --
arch/arm64/kernel/vdso/Makefile | 7 -------
include/linux/compiler-clang.h | 8 ++++++++
include/linux/compiler-gcc.h | 2 +-
lib/Kconfig.kasan | 9 ++++-----
8 files changed, 16 insertions(+), 27 deletions(-)
--
2.28.0.402.g5ffc5be6b7-goog
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH v2 1/7] compiler-clang: add build check for clang 10.0.1
2020-09-01 0:23 [PATCH v2 0/7] set clang minimum version to 10.0.1 Nick Desaulniers
@ 2020-09-01 0:23 ` Nick Desaulniers
2020-09-01 13:51 ` Sedat Dilek
2020-09-01 0:23 ` [PATCH v2 2/7] Revert "kbuild: disable clang's default use of -fmerge-all-constants" Nick Desaulniers
` (7 subsequent siblings)
8 siblings, 1 reply; 21+ messages in thread
From: Nick Desaulniers @ 2020-09-01 0:23 UTC (permalink / raw)
To: Andrew Morton
Cc: Kees Cook, Miguel Ojeda, Nathan Chancellor, Sedat Dilek,
Marco Elver, Andrey Konovalov, Masahiro Yamada,
clang-built-linux, Daniel Borkmann, Alexei Starovoitov,
Will Deacon, Vincenzo Frascino, linux-kernel, Nick Desaulniers
During Plumbers 2020, we voted to just support the latest release of
Clang for now. Add a compile time check for this.
We plan to remove workarounds for older versions now, which will break
in subtle and not so subtle ways.
Link: https://github.com/ClangBuiltLinux/linux/issues/9
Link: https://github.com/ClangBuiltLinux/linux/issues/941
Suggested-by: Sedat Dilek <sedat.dilek@gmail.com>
Suggested-by: Nathan Chancellor <natechancellor@gmail.com>
Suggested-by: Kees Cook <keescook@chromium.org>
Acked-by: Marco Elver <elver@google.com>
Acked-by: Nathan Chancellor <natechancellor@gmail.com>
Acked-by: Sedat Dilek <sedat.dilek@gmail.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
---
Changes V1 -> V2:
* use a more informational error, as per Kees.
* collect tags.
include/linux/compiler-clang.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h
index cee0c728d39a..230604e7f057 100644
--- a/include/linux/compiler-clang.h
+++ b/include/linux/compiler-clang.h
@@ -3,6 +3,14 @@
#error "Please don't include <linux/compiler-clang.h> directly, include <linux/compiler.h> instead."
#endif
+#define CLANG_VERSION (__clang_major__ * 10000 \
+ + __clang_minor__ * 100 \
+ + __clang_patchlevel__)
+
+#if CLANG_VERSION < 100001
+# error Sorry, your version of Clang is too old - please use 10.0.1 or newer.
+#endif
+
/* Compiler specific definitions for Clang compiler */
/* same as gcc, this was present in clang-2.6 so we can assume it works
--
2.28.0.402.g5ffc5be6b7-goog
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v2 2/7] Revert "kbuild: disable clang's default use of -fmerge-all-constants"
2020-09-01 0:23 [PATCH v2 0/7] set clang minimum version to 10.0.1 Nick Desaulniers
2020-09-01 0:23 ` [PATCH v2 1/7] compiler-clang: add build check for clang 10.0.1 Nick Desaulniers
@ 2020-09-01 0:23 ` Nick Desaulniers
2020-09-01 4:55 ` Nathan Chancellor
2020-09-01 17:36 ` Sedat Dilek
2020-09-01 0:23 ` [PATCH v2 3/7] Revert "arm64: bti: Require clang >= 10.0.1 for in-kernel BTI support" Nick Desaulniers
` (6 subsequent siblings)
8 siblings, 2 replies; 21+ messages in thread
From: Nick Desaulniers @ 2020-09-01 0:23 UTC (permalink / raw)
To: Andrew Morton
Cc: Kees Cook, Miguel Ojeda, Nathan Chancellor, Sedat Dilek,
Marco Elver, Andrey Konovalov, Masahiro Yamada,
clang-built-linux, Daniel Borkmann, Alexei Starovoitov,
Will Deacon, Vincenzo Frascino, linux-kernel, Nick Desaulniers
This reverts commit 87e0d4f0f37fb0c8c4aeeac46fff5e957738df79.
This was fixed in clang-6; the minimum supported version of clang in the
kernel is clang-10 (10.0.1).
Link: https://reviews.llvm.org/rL329300.
Link: https://github.com/ClangBuiltLinux/linux/issues/9
Suggested-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
---
Makefile | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/Makefile b/Makefile
index 37739ee53f27..144ac6a073ff 100644
--- a/Makefile
+++ b/Makefile
@@ -932,15 +932,6 @@ KBUILD_CFLAGS += $(call cc-disable-warning, maybe-uninitialized)
# disable invalid "can't wrap" optimizations for signed / pointers
KBUILD_CFLAGS += $(call cc-option,-fno-strict-overflow)
-# clang sets -fmerge-all-constants by default as optimization, but this
-# is non-conforming behavior for C and in fact breaks the kernel, so we
-# need to disable it here generally.
-KBUILD_CFLAGS += $(call cc-option,-fno-merge-all-constants)
-
-# for gcc -fno-merge-all-constants disables everything, but it is fine
-# to have actual conforming behavior enabled.
-KBUILD_CFLAGS += $(call cc-option,-fmerge-constants)
-
# Make sure -fstack-check isn't enabled (like gentoo apparently did)
KBUILD_CFLAGS += $(call cc-option,-fno-stack-check,)
--
2.28.0.402.g5ffc5be6b7-goog
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v2 3/7] Revert "arm64: bti: Require clang >= 10.0.1 for in-kernel BTI support"
2020-09-01 0:23 [PATCH v2 0/7] set clang minimum version to 10.0.1 Nick Desaulniers
2020-09-01 0:23 ` [PATCH v2 1/7] compiler-clang: add build check for clang 10.0.1 Nick Desaulniers
2020-09-01 0:23 ` [PATCH v2 2/7] Revert "kbuild: disable clang's default use of -fmerge-all-constants" Nick Desaulniers
@ 2020-09-01 0:23 ` Nick Desaulniers
2020-09-01 4:55 ` Nathan Chancellor
2020-09-01 0:23 ` [PATCH v2 4/7] Revert "arm64: vdso: Fix compilation with clang older than 8" Nick Desaulniers
` (5 subsequent siblings)
8 siblings, 1 reply; 21+ messages in thread
From: Nick Desaulniers @ 2020-09-01 0:23 UTC (permalink / raw)
To: Andrew Morton
Cc: Kees Cook, Miguel Ojeda, Nathan Chancellor, Sedat Dilek,
Marco Elver, Andrey Konovalov, Masahiro Yamada,
clang-built-linux, Daniel Borkmann, Alexei Starovoitov,
Will Deacon, Vincenzo Frascino, linux-kernel, Nick Desaulniers
This reverts commit b9249cba25a5dce5de87e5404503a5e11832c2dd.
The minimum supported version of clang is now 10.0.1.
Suggested-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
---
arch/arm64/Kconfig | 2 --
1 file changed, 2 deletions(-)
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 6d232837cbee..2a70b85b1a61 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -1630,8 +1630,6 @@ config ARM64_BTI_KERNEL
depends on CC_HAS_BRANCH_PROT_PAC_RET_BTI
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94697
depends on !CC_IS_GCC || GCC_VERSION >= 100100
- # https://reviews.llvm.org/rGb8ae3fdfa579dbf366b1bb1cbfdbf8c51db7fa55
- depends on !CC_IS_CLANG || CLANG_VERSION >= 100001
depends on !(CC_IS_CLANG && GCOV_KERNEL)
depends on (!FUNCTION_GRAPH_TRACER || DYNAMIC_FTRACE_WITH_REGS)
help
--
2.28.0.402.g5ffc5be6b7-goog
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v2 4/7] Revert "arm64: vdso: Fix compilation with clang older than 8"
2020-09-01 0:23 [PATCH v2 0/7] set clang minimum version to 10.0.1 Nick Desaulniers
` (2 preceding siblings ...)
2020-09-01 0:23 ` [PATCH v2 3/7] Revert "arm64: bti: Require clang >= 10.0.1 for in-kernel BTI support" Nick Desaulniers
@ 2020-09-01 0:23 ` Nick Desaulniers
2020-09-01 4:56 ` Nathan Chancellor
2020-09-01 0:23 ` [PATCH v2 5/7] Partial revert "ARM: 8905/1: Emit __gnu_mcount_nc when using Clang 10.0.0 or newer" Nick Desaulniers
` (4 subsequent siblings)
8 siblings, 1 reply; 21+ messages in thread
From: Nick Desaulniers @ 2020-09-01 0:23 UTC (permalink / raw)
To: Andrew Morton
Cc: Kees Cook, Miguel Ojeda, Nathan Chancellor, Sedat Dilek,
Marco Elver, Andrey Konovalov, Masahiro Yamada,
clang-built-linux, Daniel Borkmann, Alexei Starovoitov,
Will Deacon, Vincenzo Frascino, linux-kernel, Nick Desaulniers
This reverts commit 3acf4be235280f14d838581a750532219d67facc.
The minimum supported version of clang is clang 10.0.1.
Suggested-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
---
arch/arm64/kernel/vdso/Makefile | 7 -------
1 file changed, 7 deletions(-)
diff --git a/arch/arm64/kernel/vdso/Makefile b/arch/arm64/kernel/vdso/Makefile
index 45d5cfe46429..04021a93171c 100644
--- a/arch/arm64/kernel/vdso/Makefile
+++ b/arch/arm64/kernel/vdso/Makefile
@@ -43,13 +43,6 @@ ifneq ($(c-gettimeofday-y),)
CFLAGS_vgettimeofday.o += -include $(c-gettimeofday-y)
endif
-# Clang versions less than 8 do not support -mcmodel=tiny
-ifeq ($(CONFIG_CC_IS_CLANG), y)
- ifeq ($(shell test $(CONFIG_CLANG_VERSION) -lt 80000; echo $$?),0)
- CFLAGS_REMOVE_vgettimeofday.o += -mcmodel=tiny
- endif
-endif
-
# Disable gcov profiling for VDSO code
GCOV_PROFILE := n
--
2.28.0.402.g5ffc5be6b7-goog
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v2 5/7] Partial revert "ARM: 8905/1: Emit __gnu_mcount_nc when using Clang 10.0.0 or newer"
2020-09-01 0:23 [PATCH v2 0/7] set clang minimum version to 10.0.1 Nick Desaulniers
` (3 preceding siblings ...)
2020-09-01 0:23 ` [PATCH v2 4/7] Revert "arm64: vdso: Fix compilation with clang older than 8" Nick Desaulniers
@ 2020-09-01 0:23 ` Nick Desaulniers
2020-09-01 4:57 ` Nathan Chancellor
2020-09-01 0:23 ` [PATCH v2 6/7] kasan: Remove mentions of unsupported Clang versions Nick Desaulniers
` (3 subsequent siblings)
8 siblings, 1 reply; 21+ messages in thread
From: Nick Desaulniers @ 2020-09-01 0:23 UTC (permalink / raw)
To: Andrew Morton
Cc: Kees Cook, Miguel Ojeda, Nathan Chancellor, Sedat Dilek,
Marco Elver, Andrey Konovalov, Masahiro Yamada,
clang-built-linux, Daniel Borkmann, Alexei Starovoitov,
Will Deacon, Vincenzo Frascino, linux-kernel, Nick Desaulniers
This partially reverts commit b0fe66cf095016e0b238374c10ae366e1f087d11.
The minimum supported version of clang is now clang 10.0.1. We still
want to pass -meabi=gnu.
Suggested-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
---
arch/arm/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 82c197a248dd..09a7669eea1d 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -83,7 +83,7 @@ config ARM
select HAVE_FAST_GUP if ARM_LPAE
select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL
select HAVE_FUNCTION_GRAPH_TRACER if !THUMB2_KERNEL && !CC_IS_CLANG
- select HAVE_FUNCTION_TRACER if !XIP_KERNEL && (CC_IS_GCC || CLANG_VERSION >= 100000)
+ select HAVE_FUNCTION_TRACER if !XIP_KERNEL
select HAVE_GCC_PLUGINS
select HAVE_HW_BREAKPOINT if PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7)
select HAVE_IDE if PCI || ISA || PCMCIA
--
2.28.0.402.g5ffc5be6b7-goog
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v2 6/7] kasan: Remove mentions of unsupported Clang versions
2020-09-01 0:23 [PATCH v2 0/7] set clang minimum version to 10.0.1 Nick Desaulniers
` (4 preceding siblings ...)
2020-09-01 0:23 ` [PATCH v2 5/7] Partial revert "ARM: 8905/1: Emit __gnu_mcount_nc when using Clang 10.0.0 or newer" Nick Desaulniers
@ 2020-09-01 0:23 ` Nick Desaulniers
2020-09-01 4:57 ` Nathan Chancellor
2020-09-01 0:23 ` [PATCH v2 7/7] compiler-gcc: improve version error Nick Desaulniers
` (2 subsequent siblings)
8 siblings, 1 reply; 21+ messages in thread
From: Nick Desaulniers @ 2020-09-01 0:23 UTC (permalink / raw)
To: Andrew Morton
Cc: Kees Cook, Miguel Ojeda, Nathan Chancellor, Sedat Dilek,
Marco Elver, Andrey Konovalov, Masahiro Yamada,
clang-built-linux, Daniel Borkmann, Alexei Starovoitov,
Will Deacon, Vincenzo Frascino, linux-kernel, Nick Desaulniers
From: Marco Elver <elver@google.com>
Since the kernel now requires at least Clang 10.0.1, remove any mention
of old Clang versions and simplify the documentation.
Reviewed-by: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: Marco Elver <elver@google.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
---
Documentation/dev-tools/kasan.rst | 4 ++--
lib/Kconfig.kasan | 9 ++++-----
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/Documentation/dev-tools/kasan.rst b/Documentation/dev-tools/kasan.rst
index 38fd5681fade..4abc84b1798c 100644
--- a/Documentation/dev-tools/kasan.rst
+++ b/Documentation/dev-tools/kasan.rst
@@ -13,10 +13,10 @@ KASAN uses compile-time instrumentation to insert validity checks before every
memory access, and therefore requires a compiler version that supports that.
Generic KASAN is supported in both GCC and Clang. With GCC it requires version
-8.3.0 or later. With Clang it requires version 7.0.0 or later, but detection of
+8.3.0 or later. Any supported Clang version is compatible, but detection of
out-of-bounds accesses for global variables is only supported since Clang 11.
-Tag-based KASAN is only supported in Clang and requires version 7.0.0 or later.
+Tag-based KASAN is only supported in Clang.
Currently generic KASAN is supported for the x86_64, arm64, xtensa, s390 and
riscv architectures, and tag-based KASAN is supported only for arm64.
diff --git a/lib/Kconfig.kasan b/lib/Kconfig.kasan
index 047b53dbfd58..033a5bc67ac4 100644
--- a/lib/Kconfig.kasan
+++ b/lib/Kconfig.kasan
@@ -54,9 +54,9 @@ config KASAN_GENERIC
Enables generic KASAN mode.
This mode is supported in both GCC and Clang. With GCC it requires
- version 8.3.0 or later. With Clang it requires version 7.0.0 or
- later, but detection of out-of-bounds accesses for global variables
- is supported only since Clang 11.
+ version 8.3.0 or later. Any supported Clang version is compatible,
+ but detection of out-of-bounds accesses for global variables is
+ supported only since Clang 11.
This mode consumes about 1/8th of available memory at kernel start
and introduces an overhead of ~x1.5 for the rest of the allocations.
@@ -78,8 +78,7 @@ config KASAN_SW_TAGS
Enables software tag-based KASAN mode.
This mode requires Top Byte Ignore support by the CPU and therefore
- is only supported for arm64. This mode requires Clang version 7.0.0
- or later.
+ is only supported for arm64. This mode requires Clang.
This mode consumes about 1/16th of available memory at kernel start
and introduces an overhead of ~20% for the rest of the allocations.
--
2.28.0.402.g5ffc5be6b7-goog
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v2 7/7] compiler-gcc: improve version error
2020-09-01 0:23 [PATCH v2 0/7] set clang minimum version to 10.0.1 Nick Desaulniers
` (5 preceding siblings ...)
2020-09-01 0:23 ` [PATCH v2 6/7] kasan: Remove mentions of unsupported Clang versions Nick Desaulniers
@ 2020-09-01 0:23 ` Nick Desaulniers
2020-09-01 5:00 ` Nathan Chancellor
2020-09-01 8:12 ` Miguel Ojeda
2020-09-01 13:55 ` [PATCH v2 0/7] set clang minimum version to 10.0.1 Sedat Dilek
2020-09-01 20:01 ` Kees Cook
8 siblings, 2 replies; 21+ messages in thread
From: Nick Desaulniers @ 2020-09-01 0:23 UTC (permalink / raw)
To: Andrew Morton
Cc: Kees Cook, Miguel Ojeda, Nathan Chancellor, Sedat Dilek,
Marco Elver, Andrey Konovalov, Masahiro Yamada,
clang-built-linux, Daniel Borkmann, Alexei Starovoitov,
Will Deacon, Vincenzo Frascino, linux-kernel, Nick Desaulniers
As Kees suggests, do so provides developers with two useful pieces of
information:
- The kernel build was attempting to use GCC.
(Maybe they accidentally poked the wrong configs in a CI.)
- They need 4.9 or better.
("Upgrade to what version?" doesn't need to be dug out of documentation,
headers, etc.)
Suggested-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
---
include/linux/compiler-gcc.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 7a3769040d7d..d1e3c6896b71 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -12,7 +12,7 @@
/* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58145 */
#if GCC_VERSION < 40900
-# error Sorry, your compiler is too old - please upgrade it.
+# error Sorry, your version of GCC is too old - please use 4.9 or newer.
#endif
/* Optimization barrier */
--
2.28.0.402.g5ffc5be6b7-goog
^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH v2 2/7] Revert "kbuild: disable clang's default use of -fmerge-all-constants"
2020-09-01 0:23 ` [PATCH v2 2/7] Revert "kbuild: disable clang's default use of -fmerge-all-constants" Nick Desaulniers
@ 2020-09-01 4:55 ` Nathan Chancellor
2020-09-01 16:55 ` Fangrui Song
2020-09-01 17:36 ` Sedat Dilek
1 sibling, 1 reply; 21+ messages in thread
From: Nathan Chancellor @ 2020-09-01 4:55 UTC (permalink / raw)
To: Nick Desaulniers
Cc: Andrew Morton, Kees Cook, Miguel Ojeda, Sedat Dilek, Marco Elver,
Andrey Konovalov, Masahiro Yamada, clang-built-linux,
Daniel Borkmann, Alexei Starovoitov, Will Deacon,
Vincenzo Frascino, linux-kernel
On Mon, Aug 31, 2020 at 05:23:21PM -0700, Nick Desaulniers wrote:
> This reverts commit 87e0d4f0f37fb0c8c4aeeac46fff5e957738df79.
>
> This was fixed in clang-6; the minimum supported version of clang in the
> kernel is clang-10 (10.0.1).
>
> Link: https://reviews.llvm.org/rL329300.
> Link: https://github.com/ClangBuiltLinux/linux/issues/9
> Suggested-by: Nathan Chancellor <natechancellor@gmail.com>
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
> Makefile | 9 ---------
> 1 file changed, 9 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 37739ee53f27..144ac6a073ff 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -932,15 +932,6 @@ KBUILD_CFLAGS += $(call cc-disable-warning, maybe-uninitialized)
> # disable invalid "can't wrap" optimizations for signed / pointers
> KBUILD_CFLAGS += $(call cc-option,-fno-strict-overflow)
>
> -# clang sets -fmerge-all-constants by default as optimization, but this
> -# is non-conforming behavior for C and in fact breaks the kernel, so we
> -# need to disable it here generally.
> -KBUILD_CFLAGS += $(call cc-option,-fno-merge-all-constants)
> -
> -# for gcc -fno-merge-all-constants disables everything, but it is fine
> -# to have actual conforming behavior enabled.
> -KBUILD_CFLAGS += $(call cc-option,-fmerge-constants)
> -
> # Make sure -fstack-check isn't enabled (like gentoo apparently did)
> KBUILD_CFLAGS += $(call cc-option,-fno-stack-check,)
>
> --
> 2.28.0.402.g5ffc5be6b7-goog
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 3/7] Revert "arm64: bti: Require clang >= 10.0.1 for in-kernel BTI support"
2020-09-01 0:23 ` [PATCH v2 3/7] Revert "arm64: bti: Require clang >= 10.0.1 for in-kernel BTI support" Nick Desaulniers
@ 2020-09-01 4:55 ` Nathan Chancellor
0 siblings, 0 replies; 21+ messages in thread
From: Nathan Chancellor @ 2020-09-01 4:55 UTC (permalink / raw)
To: Nick Desaulniers
Cc: Andrew Morton, Kees Cook, Miguel Ojeda, Sedat Dilek, Marco Elver,
Andrey Konovalov, Masahiro Yamada, clang-built-linux,
Daniel Borkmann, Alexei Starovoitov, Will Deacon,
Vincenzo Frascino, linux-kernel
On Mon, Aug 31, 2020 at 05:23:22PM -0700, Nick Desaulniers wrote:
> This reverts commit b9249cba25a5dce5de87e5404503a5e11832c2dd.
>
> The minimum supported version of clang is now 10.0.1.
>
> Suggested-by: Nathan Chancellor <natechancellor@gmail.com>
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
> arch/arm64/Kconfig | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index 6d232837cbee..2a70b85b1a61 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -1630,8 +1630,6 @@ config ARM64_BTI_KERNEL
> depends on CC_HAS_BRANCH_PROT_PAC_RET_BTI
> # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94697
> depends on !CC_IS_GCC || GCC_VERSION >= 100100
> - # https://reviews.llvm.org/rGb8ae3fdfa579dbf366b1bb1cbfdbf8c51db7fa55
> - depends on !CC_IS_CLANG || CLANG_VERSION >= 100001
> depends on !(CC_IS_CLANG && GCOV_KERNEL)
> depends on (!FUNCTION_GRAPH_TRACER || DYNAMIC_FTRACE_WITH_REGS)
> help
> --
> 2.28.0.402.g5ffc5be6b7-goog
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 4/7] Revert "arm64: vdso: Fix compilation with clang older than 8"
2020-09-01 0:23 ` [PATCH v2 4/7] Revert "arm64: vdso: Fix compilation with clang older than 8" Nick Desaulniers
@ 2020-09-01 4:56 ` Nathan Chancellor
0 siblings, 0 replies; 21+ messages in thread
From: Nathan Chancellor @ 2020-09-01 4:56 UTC (permalink / raw)
To: Nick Desaulniers
Cc: Andrew Morton, Kees Cook, Miguel Ojeda, Sedat Dilek, Marco Elver,
Andrey Konovalov, Masahiro Yamada, clang-built-linux,
Daniel Borkmann, Alexei Starovoitov, Will Deacon,
Vincenzo Frascino, linux-kernel
On Mon, Aug 31, 2020 at 05:23:23PM -0700, Nick Desaulniers wrote:
> This reverts commit 3acf4be235280f14d838581a750532219d67facc.
>
> The minimum supported version of clang is clang 10.0.1.
>
> Suggested-by: Nathan Chancellor <natechancellor@gmail.com>
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
> arch/arm64/kernel/vdso/Makefile | 7 -------
> 1 file changed, 7 deletions(-)
>
> diff --git a/arch/arm64/kernel/vdso/Makefile b/arch/arm64/kernel/vdso/Makefile
> index 45d5cfe46429..04021a93171c 100644
> --- a/arch/arm64/kernel/vdso/Makefile
> +++ b/arch/arm64/kernel/vdso/Makefile
> @@ -43,13 +43,6 @@ ifneq ($(c-gettimeofday-y),)
> CFLAGS_vgettimeofday.o += -include $(c-gettimeofday-y)
> endif
>
> -# Clang versions less than 8 do not support -mcmodel=tiny
> -ifeq ($(CONFIG_CC_IS_CLANG), y)
> - ifeq ($(shell test $(CONFIG_CLANG_VERSION) -lt 80000; echo $$?),0)
> - CFLAGS_REMOVE_vgettimeofday.o += -mcmodel=tiny
> - endif
> -endif
> -
> # Disable gcov profiling for VDSO code
> GCOV_PROFILE := n
>
> --
> 2.28.0.402.g5ffc5be6b7-goog
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 5/7] Partial revert "ARM: 8905/1: Emit __gnu_mcount_nc when using Clang 10.0.0 or newer"
2020-09-01 0:23 ` [PATCH v2 5/7] Partial revert "ARM: 8905/1: Emit __gnu_mcount_nc when using Clang 10.0.0 or newer" Nick Desaulniers
@ 2020-09-01 4:57 ` Nathan Chancellor
0 siblings, 0 replies; 21+ messages in thread
From: Nathan Chancellor @ 2020-09-01 4:57 UTC (permalink / raw)
To: Nick Desaulniers
Cc: Andrew Morton, Kees Cook, Miguel Ojeda, Sedat Dilek, Marco Elver,
Andrey Konovalov, Masahiro Yamada, clang-built-linux,
Daniel Borkmann, Alexei Starovoitov, Will Deacon,
Vincenzo Frascino, linux-kernel
Nit: Partially in commit message?
On Mon, Aug 31, 2020 at 05:23:24PM -0700, Nick Desaulniers wrote:
> This partially reverts commit b0fe66cf095016e0b238374c10ae366e1f087d11.
>
> The minimum supported version of clang is now clang 10.0.1. We still
> want to pass -meabi=gnu.
Thank you for calling this out.
> Suggested-by: Nathan Chancellor <natechancellor@gmail.com>
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
> arch/arm/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index 82c197a248dd..09a7669eea1d 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -83,7 +83,7 @@ config ARM
> select HAVE_FAST_GUP if ARM_LPAE
> select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL
> select HAVE_FUNCTION_GRAPH_TRACER if !THUMB2_KERNEL && !CC_IS_CLANG
> - select HAVE_FUNCTION_TRACER if !XIP_KERNEL && (CC_IS_GCC || CLANG_VERSION >= 100000)
> + select HAVE_FUNCTION_TRACER if !XIP_KERNEL
> select HAVE_GCC_PLUGINS
> select HAVE_HW_BREAKPOINT if PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7)
> select HAVE_IDE if PCI || ISA || PCMCIA
> --
> 2.28.0.402.g5ffc5be6b7-goog
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 6/7] kasan: Remove mentions of unsupported Clang versions
2020-09-01 0:23 ` [PATCH v2 6/7] kasan: Remove mentions of unsupported Clang versions Nick Desaulniers
@ 2020-09-01 4:57 ` Nathan Chancellor
0 siblings, 0 replies; 21+ messages in thread
From: Nathan Chancellor @ 2020-09-01 4:57 UTC (permalink / raw)
To: Nick Desaulniers
Cc: Andrew Morton, Kees Cook, Miguel Ojeda, Sedat Dilek, Marco Elver,
Andrey Konovalov, Masahiro Yamada, clang-built-linux,
Daniel Borkmann, Alexei Starovoitov, Will Deacon,
Vincenzo Frascino, linux-kernel
On Mon, Aug 31, 2020 at 05:23:25PM -0700, Nick Desaulniers wrote:
> From: Marco Elver <elver@google.com>
>
> Since the kernel now requires at least Clang 10.0.1, remove any mention
> of old Clang versions and simplify the documentation.
>
> Reviewed-by: Andrey Konovalov <andreyknvl@google.com>
> Signed-off-by: Marco Elver <elver@google.com>
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
> Documentation/dev-tools/kasan.rst | 4 ++--
> lib/Kconfig.kasan | 9 ++++-----
> 2 files changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/Documentation/dev-tools/kasan.rst b/Documentation/dev-tools/kasan.rst
> index 38fd5681fade..4abc84b1798c 100644
> --- a/Documentation/dev-tools/kasan.rst
> +++ b/Documentation/dev-tools/kasan.rst
> @@ -13,10 +13,10 @@ KASAN uses compile-time instrumentation to insert validity checks before every
> memory access, and therefore requires a compiler version that supports that.
>
> Generic KASAN is supported in both GCC and Clang. With GCC it requires version
> -8.3.0 or later. With Clang it requires version 7.0.0 or later, but detection of
> +8.3.0 or later. Any supported Clang version is compatible, but detection of
> out-of-bounds accesses for global variables is only supported since Clang 11.
>
> -Tag-based KASAN is only supported in Clang and requires version 7.0.0 or later.
> +Tag-based KASAN is only supported in Clang.
>
> Currently generic KASAN is supported for the x86_64, arm64, xtensa, s390 and
> riscv architectures, and tag-based KASAN is supported only for arm64.
> diff --git a/lib/Kconfig.kasan b/lib/Kconfig.kasan
> index 047b53dbfd58..033a5bc67ac4 100644
> --- a/lib/Kconfig.kasan
> +++ b/lib/Kconfig.kasan
> @@ -54,9 +54,9 @@ config KASAN_GENERIC
> Enables generic KASAN mode.
>
> This mode is supported in both GCC and Clang. With GCC it requires
> - version 8.3.0 or later. With Clang it requires version 7.0.0 or
> - later, but detection of out-of-bounds accesses for global variables
> - is supported only since Clang 11.
> + version 8.3.0 or later. Any supported Clang version is compatible,
> + but detection of out-of-bounds accesses for global variables is
> + supported only since Clang 11.
>
> This mode consumes about 1/8th of available memory at kernel start
> and introduces an overhead of ~x1.5 for the rest of the allocations.
> @@ -78,8 +78,7 @@ config KASAN_SW_TAGS
> Enables software tag-based KASAN mode.
>
> This mode requires Top Byte Ignore support by the CPU and therefore
> - is only supported for arm64. This mode requires Clang version 7.0.0
> - or later.
> + is only supported for arm64. This mode requires Clang.
>
> This mode consumes about 1/16th of available memory at kernel start
> and introduces an overhead of ~20% for the rest of the allocations.
> --
> 2.28.0.402.g5ffc5be6b7-goog
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 7/7] compiler-gcc: improve version error
2020-09-01 0:23 ` [PATCH v2 7/7] compiler-gcc: improve version error Nick Desaulniers
@ 2020-09-01 5:00 ` Nathan Chancellor
2020-09-01 8:12 ` Miguel Ojeda
1 sibling, 0 replies; 21+ messages in thread
From: Nathan Chancellor @ 2020-09-01 5:00 UTC (permalink / raw)
To: Nick Desaulniers
Cc: Andrew Morton, Kees Cook, Miguel Ojeda, Sedat Dilek, Marco Elver,
Andrey Konovalov, Masahiro Yamada, clang-built-linux,
Daniel Borkmann, Alexei Starovoitov, Will Deacon,
Vincenzo Frascino, linux-kernel
On Mon, Aug 31, 2020 at 05:23:26PM -0700, Nick Desaulniers wrote:
> As Kees suggests, do so provides developers with two useful pieces of
> information:
> - The kernel build was attempting to use GCC.
> (Maybe they accidentally poked the wrong configs in a CI.)
> - They need 4.9 or better.
> ("Upgrade to what version?" doesn't need to be dug out of documentation,
> headers, etc.)
>
> Suggested-by: Kees Cook <keescook@chromium.org>
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
It would be nice if there was some easy way to link the documentation
here so that patches like commit 0bddd227f3dc ("Documentation: update
for gcc 4.9 requirement") did not need to happen or be remembered.
> ---
> include/linux/compiler-gcc.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
> index 7a3769040d7d..d1e3c6896b71 100644
> --- a/include/linux/compiler-gcc.h
> +++ b/include/linux/compiler-gcc.h
> @@ -12,7 +12,7 @@
>
> /* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58145 */
> #if GCC_VERSION < 40900
> -# error Sorry, your compiler is too old - please upgrade it.
> +# error Sorry, your version of GCC is too old - please use 4.9 or newer.
> #endif
>
> /* Optimization barrier */
> --
> 2.28.0.402.g5ffc5be6b7-goog
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 7/7] compiler-gcc: improve version error
2020-09-01 0:23 ` [PATCH v2 7/7] compiler-gcc: improve version error Nick Desaulniers
2020-09-01 5:00 ` Nathan Chancellor
@ 2020-09-01 8:12 ` Miguel Ojeda
1 sibling, 0 replies; 21+ messages in thread
From: Miguel Ojeda @ 2020-09-01 8:12 UTC (permalink / raw)
To: Nick Desaulniers
Cc: Andrew Morton, Kees Cook, Nathan Chancellor, Sedat Dilek,
Marco Elver, Andrey Konovalov, Masahiro Yamada,
clang-built-linux, Daniel Borkmann, Alexei Starovoitov,
Will Deacon, Vincenzo Frascino, linux-kernel
On Tue, Sep 1, 2020 at 2:23 AM Nick Desaulniers <ndesaulniers@google.com> wrote:
>
> do so provides developers
"doing so"? "to do so"?
> include/linux/compiler-gcc.h | 2 +-
Reviewed-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Cheers,
Miguel
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 1/7] compiler-clang: add build check for clang 10.0.1
2020-09-01 0:23 ` [PATCH v2 1/7] compiler-clang: add build check for clang 10.0.1 Nick Desaulniers
@ 2020-09-01 13:51 ` Sedat Dilek
0 siblings, 0 replies; 21+ messages in thread
From: Sedat Dilek @ 2020-09-01 13:51 UTC (permalink / raw)
To: Nick Desaulniers
Cc: Andrew Morton, Kees Cook, Miguel Ojeda, Nathan Chancellor,
Marco Elver, Andrey Konovalov, Masahiro Yamada,
Clang-Built-Linux ML, Daniel Borkmann, Alexei Starovoitov,
Will Deacon, Vincenzo Frascino, linux-kernel
On Tue, Sep 1, 2020 at 2:23 AM Nick Desaulniers <ndesaulniers@google.com> wrote:
>
> During Plumbers 2020, we voted to just support the latest release of
> Clang for now. Add a compile time check for this.
>
> We plan to remove workarounds for older versions now, which will break
> in subtle and not so subtle ways.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/9
> Link: https://github.com/ClangBuiltLinux/linux/issues/941
> Suggested-by: Sedat Dilek <sedat.dilek@gmail.com>
> Suggested-by: Nathan Chancellor <natechancellor@gmail.com>
> Suggested-by: Kees Cook <keescook@chromium.org>
> Acked-by: Marco Elver <elver@google.com>
> Acked-by: Nathan Chancellor <natechancellor@gmail.com>
> Acked-by: Sedat Dilek <sedat.dilek@gmail.com>
> Reviewed-by: Kees Cook <keescook@chromium.org>
> Reviewed-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Sedat Dilek <sedat.dilek@gmail.com>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
- Sedat -
> ---
> Changes V1 -> V2:
> * use a more informational error, as per Kees.
> * collect tags.
>
> include/linux/compiler-clang.h | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h
> index cee0c728d39a..230604e7f057 100644
> --- a/include/linux/compiler-clang.h
> +++ b/include/linux/compiler-clang.h
> @@ -3,6 +3,14 @@
> #error "Please don't include <linux/compiler-clang.h> directly, include <linux/compiler.h> instead."
> #endif
>
> +#define CLANG_VERSION (__clang_major__ * 10000 \
> + + __clang_minor__ * 100 \
> + + __clang_patchlevel__)
> +
> +#if CLANG_VERSION < 100001
> +# error Sorry, your version of Clang is too old - please use 10.0.1 or newer.
> +#endif
> +
> /* Compiler specific definitions for Clang compiler */
>
> /* same as gcc, this was present in clang-2.6 so we can assume it works
> --
> 2.28.0.402.g5ffc5be6b7-goog
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 0/7] set clang minimum version to 10.0.1
2020-09-01 0:23 [PATCH v2 0/7] set clang minimum version to 10.0.1 Nick Desaulniers
` (6 preceding siblings ...)
2020-09-01 0:23 ` [PATCH v2 7/7] compiler-gcc: improve version error Nick Desaulniers
@ 2020-09-01 13:55 ` Sedat Dilek
2020-09-01 20:01 ` Kees Cook
8 siblings, 0 replies; 21+ messages in thread
From: Sedat Dilek @ 2020-09-01 13:55 UTC (permalink / raw)
To: Nick Desaulniers
Cc: Andrew Morton, Kees Cook, Miguel Ojeda, Nathan Chancellor,
Marco Elver, Andrey Konovalov, Masahiro Yamada,
Clang-Built-Linux ML, Daniel Borkmann, Alexei Starovoitov,
Will Deacon, Vincenzo Frascino, linux-kernel
On Tue, Sep 1, 2020 at 2:23 AM Nick Desaulniers <ndesaulniers@google.com> wrote:
>
> Adds a compile time #error to compiler-clang.h setting the effective
> minimum supported version to clang 10.0.1. A separate patch has already
> been picked up into the Documentation/ tree also confirming the version.
>
> Next are a series of reverts. One for 32b arm is a partial revert.
>
> Then Marco suggested fixes to KASAN docs.
>
> Finally, improve the warning for GCC too as per Kees.
>
> Patches after 001 are new for v2.
>
> Marco Elver (1):
> kasan: Remove mentions of unsupported Clang versions
>
> Nick Desaulniers (6):
> compiler-clang: add build check for clang 10.0.1
> Revert "kbuild: disable clang's default use of -fmerge-all-constants"
> Revert "arm64: bti: Require clang >= 10.0.1 for in-kernel BTI support"
> Revert "arm64: vdso: Fix compilation with clang older than 8"
> Partial revert "ARM: 8905/1: Emit __gnu_mcount_nc when using Clang
> 10.0.0 or newer"
> compiler-gcc: improve version warning
>
I have tested theses 7 patches together with v2 of "Documentation: add
minimum clang/llvm version".
- Sedat -
> Documentation/dev-tools/kasan.rst | 4 ++--
> Makefile | 9 ---------
> arch/arm/Kconfig | 2 +-
> arch/arm64/Kconfig | 2 --
> arch/arm64/kernel/vdso/Makefile | 7 -------
> include/linux/compiler-clang.h | 8 ++++++++
> include/linux/compiler-gcc.h | 2 +-
> lib/Kconfig.kasan | 9 ++++-----
> 8 files changed, 16 insertions(+), 27 deletions(-)
>
> --
> 2.28.0.402.g5ffc5be6b7-goog
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 2/7] Revert "kbuild: disable clang's default use of -fmerge-all-constants"
2020-09-01 4:55 ` Nathan Chancellor
@ 2020-09-01 16:55 ` Fangrui Song
0 siblings, 0 replies; 21+ messages in thread
From: Fangrui Song @ 2020-09-01 16:55 UTC (permalink / raw)
To: Nathan Chancellor, Nick Desaulniers
Cc: Andrew Morton, Kees Cook, Miguel Ojeda, Sedat Dilek, Marco Elver,
Andrey Konovalov, Masahiro Yamada, clang-built-linux,
Daniel Borkmann, Alexei Starovoitov, Will Deacon,
Vincenzo Frascino, linux-kernel
On 2020-08-31, Nathan Chancellor wrote:
>On Mon, Aug 31, 2020 at 05:23:21PM -0700, Nick Desaulniers wrote:
>> This reverts commit 87e0d4f0f37fb0c8c4aeeac46fff5e957738df79.
>>
>> This was fixed in clang-6; the minimum supported version of clang in the
>> kernel is clang-10 (10.0.1).
>>
>> Link: https://reviews.llvm.org/rL329300.
>> Link: https://github.com/ClangBuiltLinux/linux/issues/9
>> Suggested-by: Nathan Chancellor <natechancellor@gmail.com>
>> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
>
>Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
How about expanding "This was fixed in clang-6" to be
-fno-merge-all-constants has been the default since clang-6?
(Both gcc|clang -fmerge-all-constants can cause an assertion failure for
the example on https://bugs.llvm.org/show_bug.cgi?id=18538 )
Reviewed-by: Fangrui Song <maskray@google.com>
>> ---
>> Makefile | 9 ---------
>> 1 file changed, 9 deletions(-)
>>
>> diff --git a/Makefile b/Makefile
>> index 37739ee53f27..144ac6a073ff 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -932,15 +932,6 @@ KBUILD_CFLAGS += $(call cc-disable-warning, maybe-uninitialized)
>> # disable invalid "can't wrap" optimizations for signed / pointers
>> KBUILD_CFLAGS += $(call cc-option,-fno-strict-overflow)
>>
>> -# clang sets -fmerge-all-constants by default as optimization, but this
>> -# is non-conforming behavior for C and in fact breaks the kernel, so we
>> -# need to disable it here generally.
>> -KBUILD_CFLAGS += $(call cc-option,-fno-merge-all-constants)
>> -
>> -# for gcc -fno-merge-all-constants disables everything, but it is fine
>> -# to have actual conforming behavior enabled.
>> -KBUILD_CFLAGS += $(call cc-option,-fmerge-constants)
>> -
>> # Make sure -fstack-check isn't enabled (like gentoo apparently did)
>> KBUILD_CFLAGS += $(call cc-option,-fno-stack-check,)
>>
>> --
>> 2.28.0.402.g5ffc5be6b7-goog
>>
>
>--
>You received this message because you are subscribed to the Google Groups "Clang Built Linux" group.
>To unsubscribe from this group and stop receiving emails from it, send an email to clang-built-linux+unsubscribe@googlegroups.com.
>To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20200901045516.GA1561318%40ubuntu-n2-xlarge-x86.
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 2/7] Revert "kbuild: disable clang's default use of -fmerge-all-constants"
2020-09-01 0:23 ` [PATCH v2 2/7] Revert "kbuild: disable clang's default use of -fmerge-all-constants" Nick Desaulniers
2020-09-01 4:55 ` Nathan Chancellor
@ 2020-09-01 17:36 ` Sedat Dilek
1 sibling, 0 replies; 21+ messages in thread
From: Sedat Dilek @ 2020-09-01 17:36 UTC (permalink / raw)
To: Nick Desaulniers
Cc: Andrew Morton, Kees Cook, Miguel Ojeda, Nathan Chancellor,
Marco Elver, Andrey Konovalov, Masahiro Yamada,
Clang-Built-Linux ML, Daniel Borkmann, Alexei Starovoitov,
Will Deacon, Vincenzo Frascino, linux-kernel
On Tue, Sep 1, 2020 at 2:23 AM Nick Desaulniers <ndesaulniers@google.com> wrote:
>
> This reverts commit 87e0d4f0f37fb0c8c4aeeac46fff5e957738df79.
>
> This was fixed in clang-6; the minimum supported version of clang in the
> kernel is clang-10 (10.0.1).
>
> Link: https://reviews.llvm.org/rL329300.
> Link: https://github.com/ClangBuiltLinux/linux/issues/9
> Suggested-by: Nathan Chancellor <natechancellor@gmail.com>
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Sedat Dilek <sedat.dilek@gmail.com>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
- Sedat -
> ---
> Makefile | 9 ---------
> 1 file changed, 9 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 37739ee53f27..144ac6a073ff 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -932,15 +932,6 @@ KBUILD_CFLAGS += $(call cc-disable-warning, maybe-uninitialized)
> # disable invalid "can't wrap" optimizations for signed / pointers
> KBUILD_CFLAGS += $(call cc-option,-fno-strict-overflow)
>
> -# clang sets -fmerge-all-constants by default as optimization, but this
> -# is non-conforming behavior for C and in fact breaks the kernel, so we
> -# need to disable it here generally.
> -KBUILD_CFLAGS += $(call cc-option,-fno-merge-all-constants)
> -
> -# for gcc -fno-merge-all-constants disables everything, but it is fine
> -# to have actual conforming behavior enabled.
> -KBUILD_CFLAGS += $(call cc-option,-fmerge-constants)
> -
> # Make sure -fstack-check isn't enabled (like gentoo apparently did)
> KBUILD_CFLAGS += $(call cc-option,-fno-stack-check,)
>
> --
> 2.28.0.402.g5ffc5be6b7-goog
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 0/7] set clang minimum version to 10.0.1
2020-09-01 0:23 [PATCH v2 0/7] set clang minimum version to 10.0.1 Nick Desaulniers
` (7 preceding siblings ...)
2020-09-01 13:55 ` [PATCH v2 0/7] set clang minimum version to 10.0.1 Sedat Dilek
@ 2020-09-01 20:01 ` Kees Cook
2020-09-02 19:28 ` Nick Desaulniers
8 siblings, 1 reply; 21+ messages in thread
From: Kees Cook @ 2020-09-01 20:01 UTC (permalink / raw)
To: Nick Desaulniers
Cc: Andrew Morton, Miguel Ojeda, Nathan Chancellor, Sedat Dilek,
Marco Elver, Andrey Konovalov, Masahiro Yamada,
clang-built-linux, Daniel Borkmann, Alexei Starovoitov,
Will Deacon, Vincenzo Frascino, linux-kernel
On Mon, Aug 31, 2020 at 05:23:19PM -0700, Nick Desaulniers wrote:
> Adds a compile time #error to compiler-clang.h setting the effective
> minimum supported version to clang 10.0.1. A separate patch has already
> been picked up into the Documentation/ tree also confirming the version.
>
> Next are a series of reverts. One for 32b arm is a partial revert.
>
> Then Marco suggested fixes to KASAN docs.
>
> Finally, improve the warning for GCC too as per Kees.
> [...]
> 8 files changed, 16 insertions(+), 27 deletions(-)
A nice simplification!
Reviewed-by: Kees Cook <keescook@chromium.org>
(I do note that for Ubuntu 20.04, they're going to need to do an LLVM
10.0.0 -> 10.0.1 bump to do kernel builds for their latest LTS...)
--
Kees Cook
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 0/7] set clang minimum version to 10.0.1
2020-09-01 20:01 ` Kees Cook
@ 2020-09-02 19:28 ` Nick Desaulniers
0 siblings, 0 replies; 21+ messages in thread
From: Nick Desaulniers @ 2020-09-02 19:28 UTC (permalink / raw)
To: Kees Cook, Andrew Morton
Cc: Miguel Ojeda, Nathan Chancellor, Sedat Dilek, Marco Elver,
Andrey Konovalov, Masahiro Yamada, clang-built-linux,
Daniel Borkmann, Alexei Starovoitov, Will Deacon,
Vincenzo Frascino, LKML
On Tue, Sep 1, 2020 at 1:01 PM Kees Cook <keescook@chromium.org> wrote:
>
> On Mon, Aug 31, 2020 at 05:23:19PM -0700, Nick Desaulniers wrote:
> > Adds a compile time #error to compiler-clang.h setting the effective
> > minimum supported version to clang 10.0.1. A separate patch has already
> > been picked up into the Documentation/ tree also confirming the version.
> >
> > Next are a series of reverts. One for 32b arm is a partial revert.
> >
> > Then Marco suggested fixes to KASAN docs.
> >
> > Finally, improve the warning for GCC too as per Kees.
> > [...]
> > 8 files changed, 16 insertions(+), 27 deletions(-)
>
> A nice simplification!
>
> Reviewed-by: Kees Cook <keescook@chromium.org>
>
> (I do note that for Ubuntu 20.04, they're going to need to do an LLVM
> 10.0.0 -> 10.0.1 bump to do kernel builds for their latest LTS...)
>
> --
> Kees Cook
I'll collect relevant tags and fixup feedback and send akpm a v3,
maybe this afternoon. Thanks everyone for the reviews+feedback.
--
Thanks,
~Nick Desaulniers
^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2020-09-02 19:28 UTC | newest]
Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-01 0:23 [PATCH v2 0/7] set clang minimum version to 10.0.1 Nick Desaulniers
2020-09-01 0:23 ` [PATCH v2 1/7] compiler-clang: add build check for clang 10.0.1 Nick Desaulniers
2020-09-01 13:51 ` Sedat Dilek
2020-09-01 0:23 ` [PATCH v2 2/7] Revert "kbuild: disable clang's default use of -fmerge-all-constants" Nick Desaulniers
2020-09-01 4:55 ` Nathan Chancellor
2020-09-01 16:55 ` Fangrui Song
2020-09-01 17:36 ` Sedat Dilek
2020-09-01 0:23 ` [PATCH v2 3/7] Revert "arm64: bti: Require clang >= 10.0.1 for in-kernel BTI support" Nick Desaulniers
2020-09-01 4:55 ` Nathan Chancellor
2020-09-01 0:23 ` [PATCH v2 4/7] Revert "arm64: vdso: Fix compilation with clang older than 8" Nick Desaulniers
2020-09-01 4:56 ` Nathan Chancellor
2020-09-01 0:23 ` [PATCH v2 5/7] Partial revert "ARM: 8905/1: Emit __gnu_mcount_nc when using Clang 10.0.0 or newer" Nick Desaulniers
2020-09-01 4:57 ` Nathan Chancellor
2020-09-01 0:23 ` [PATCH v2 6/7] kasan: Remove mentions of unsupported Clang versions Nick Desaulniers
2020-09-01 4:57 ` Nathan Chancellor
2020-09-01 0:23 ` [PATCH v2 7/7] compiler-gcc: improve version error Nick Desaulniers
2020-09-01 5:00 ` Nathan Chancellor
2020-09-01 8:12 ` Miguel Ojeda
2020-09-01 13:55 ` [PATCH v2 0/7] set clang minimum version to 10.0.1 Sedat Dilek
2020-09-01 20:01 ` Kees Cook
2020-09-02 19:28 ` Nick Desaulniers
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).