2021-11-29 20:28:34

by Nathan Chancellor

[permalink] [raw]
Subject: [PATCH RFC 0/6] Bump minimum supported version of LLVM to 11.0.0

This patch series raises the minimum supported version of LLVM to
11.0.0.

Patch #1 outlines the issue, goes over the potential impact of the
change, and does the actual bump. Subsequent patches clean up the
various checks that are always true after the bump.

I have marked this revision as RFC to give various parties the option to
comment on this bump before it is done, namely KernelCI and Linaro's
LKFT, who are still testing clang-10. I have added some other folks to
CC that I know are testing with clang to see if this impacts them in any
way (as I would like to impact as few people as possible) but as far as
I am aware, most other CIs and developers are testing closer to tip of
tree. If that is not true, scream so that we can see what can be done
about that. If I missed anyone who is actively testing with clang,
please key them in and I will make sure to include them in future
revisions (if any are needed).

It probably makes sense for this series to live in -mm.

Nathan Chancellor (6):
Documentation: Raise the minimum supported version of LLVM to 11.0.0
mm, slab: Remove compiler check in __kmalloc_index
arch/Kconfig: Remove CLANG_VERSION check in HAS_LTO_CLANG
Revert "ARM: 9070/1: Make UNWINDER_ARM depend on ld.bfd or ld.lld
11.0.0+"
gcov: Remove compiler version check
init/Kconfig: Drop linker version check for LD_ORPHAN_WARN

Documentation/process/changes.rst | 2 +-
arch/Kconfig | 3 +--
arch/arm/Kconfig.debug | 2 --
include/linux/slab.h | 3 +--
init/Kconfig | 1 -
kernel/gcov/Kconfig | 1 -
scripts/min-tool-version.sh | 2 +-
7 files changed, 4 insertions(+), 10 deletions(-)


base-commit: d58071a8a76d779eedab38033ae4c821c30295a5
--
2.34.1



2021-11-29 20:28:34

by Nathan Chancellor

[permalink] [raw]
Subject: [PATCH RFC 3/6] arch/Kconfig: Remove CLANG_VERSION check in HAS_LTO_CLANG

The minimum supported version of LLVM has been raised to 11.0.0, meaning
this check is always true, so it can be dropped.

Signed-off-by: Nathan Chancellor <[email protected]>
---
arch/Kconfig | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/Kconfig b/arch/Kconfig
index d3c4ab249e9c..86e071f693ce 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -648,8 +648,7 @@ config ARCH_SUPPORTS_LTO_CLANG_THIN

config HAS_LTO_CLANG
def_bool y
- # Clang >= 11: https://github.com/ClangBuiltLinux/linux/issues/510
- depends on CC_IS_CLANG && CLANG_VERSION >= 110000 && LD_IS_LLD && AS_IS_LLVM
+ depends on CC_IS_CLANG && LD_IS_LLD && AS_IS_LLVM
depends on $(success,$(NM) --help | head -n 1 | grep -qi llvm)
depends on $(success,$(AR) --help | head -n 1 | grep -qi llvm)
depends on ARCH_SUPPORTS_LTO_CLANG
--
2.34.1


2021-11-29 20:47:11

by Miguel Ojeda

[permalink] [raw]
Subject: Re: [PATCH RFC 0/6] Bump minimum supported version of LLVM to 11.0.0

On Mon, Nov 29, 2021 at 6:01 PM Nathan Chancellor <[email protected]> wrote:
>
> tree. If that is not true, scream so that we can see what can be done

The patches themselves look good to me. Let's see if somebody screams! :)

Reviewed-by: Miguel Ojeda <[email protected]>

Cheers,
Miguel

2021-11-29 22:38:01

by Nick Desaulniers

[permalink] [raw]
Subject: Re: [PATCH RFC 0/6] Bump minimum supported version of LLVM to 11.0.0

On Mon, Nov 29, 2021 at 9:01 AM Nathan Chancellor <[email protected]> wrote:
>
> This patch series raises the minimum supported version of LLVM to
> 11.0.0.
>
> Patch #1 outlines the issue, goes over the potential impact of the
> change, and does the actual bump. Subsequent patches clean up the
> various checks that are always true after the bump.
>
> I have marked this revision as RFC to give various parties the option to
> comment on this bump before it is done, namely KernelCI and Linaro's
> LKFT, who are still testing clang-10. I have added some other folks to
> CC that I know are testing with clang to see if this impacts them in any
> way (as I would like to impact as few people as possible) but as far as
> I am aware, most other CIs and developers are testing closer to tip of
> tree. If that is not true, scream so that we can see what can be done
> about that. If I missed anyone who is actively testing with clang,
> please key them in and I will make sure to include them in future
> revisions (if any are needed).
>
> It probably makes sense for this series to live in -mm.

Series looks good to me. Thanks for the patch, and cleanups!
Reviewed-by: Nick Desaulniers <[email protected]>

>
> Nathan Chancellor (6):
> Documentation: Raise the minimum supported version of LLVM to 11.0.0
> mm, slab: Remove compiler check in __kmalloc_index
> arch/Kconfig: Remove CLANG_VERSION check in HAS_LTO_CLANG
> Revert "ARM: 9070/1: Make UNWINDER_ARM depend on ld.bfd or ld.lld
> 11.0.0+"
> gcov: Remove compiler version check
> init/Kconfig: Drop linker version check for LD_ORPHAN_WARN
>
> Documentation/process/changes.rst | 2 +-
> arch/Kconfig | 3 +--
> arch/arm/Kconfig.debug | 2 --
> include/linux/slab.h | 3 +--
> init/Kconfig | 1 -
> kernel/gcov/Kconfig | 1 -
> scripts/min-tool-version.sh | 2 +-
> 7 files changed, 4 insertions(+), 10 deletions(-)
>
>
> base-commit: d58071a8a76d779eedab38033ae4c821c30295a5
> --
> 2.34.1
>
>


--
Thanks,
~Nick Desaulniers

2021-12-01 19:41:32

by Kees Cook

[permalink] [raw]
Subject: Re: [PATCH RFC 0/6] Bump minimum supported version of LLVM to 11.0.0

On Mon, Nov 29, 2021 at 09:57:57AM -0700, Nathan Chancellor wrote:
> This patch series raises the minimum supported version of LLVM to
> 11.0.0.
>
> Patch #1 outlines the issue, goes over the potential impact of the
> change, and does the actual bump. Subsequent patches clean up the
> various checks that are always true after the bump.
>
> I have marked this revision as RFC to give various parties the option to
> comment on this bump before it is done, namely KernelCI and Linaro's
> LKFT, who are still testing clang-10. I have added some other folks to
> CC that I know are testing with clang to see if this impacts them in any
> way (as I would like to impact as few people as possible) but as far as
> I am aware, most other CIs and developers are testing closer to tip of
> tree. If that is not true, scream so that we can see what can be done
> about that. If I missed anyone who is actively testing with clang,
> please key them in and I will make sure to include them in future
> revisions (if any are needed).
>
> It probably makes sense for this series to live in -mm.

Sounds good to me. Thanks!

Reviewed-by: Kees Cook <[email protected]>

--
Kees Cook

2021-12-02 08:27:36

by Masahiro Yamada

[permalink] [raw]
Subject: Re: [PATCH RFC 0/6] Bump minimum supported version of LLVM to 11.0.0

On Thu, Dec 2, 2021 at 4:41 AM Kees Cook <[email protected]> wrote:
>
> On Mon, Nov 29, 2021 at 09:57:57AM -0700, Nathan Chancellor wrote:
> > This patch series raises the minimum supported version of LLVM to
> > 11.0.0.
> >
> > Patch #1 outlines the issue, goes over the potential impact of the
> > change, and does the actual bump. Subsequent patches clean up the
> > various checks that are always true after the bump.
> >
> > I have marked this revision as RFC to give various parties the option to
> > comment on this bump before it is done, namely KernelCI and Linaro's
> > LKFT, who are still testing clang-10. I have added some other folks to
> > CC that I know are testing with clang to see if this impacts them in any
> > way (as I would like to impact as few people as possible) but as far as
> > I am aware, most other CIs and developers are testing closer to tip of
> > tree. If that is not true, scream so that we can see what can be done
> > about that. If I missed anyone who is actively testing with clang,
> > please key them in and I will make sure to include them in future
> > revisions (if any are needed).
> >
> > It probably makes sense for this series to live in -mm.
>
> Sounds good to me. Thanks!
>
> Reviewed-by: Kees Cook <[email protected]>
>
> --
> Kees Cook


Only positive feedback so far.

All applied to linux-kbuild.


--
Best Regards
Masahiro Yamada

2021-12-03 13:38:29

by Marco Elver

[permalink] [raw]
Subject: Re: [PATCH RFC 0/6] Bump minimum supported version of LLVM to 11.0.0

On Thu, Dec 02, 2021 at 05:26PM +0900, Masahiro Yamada wrote:
> On Thu, Dec 2, 2021 at 4:41 AM Kees Cook <[email protected]> wrote:
> >
> > On Mon, Nov 29, 2021 at 09:57:57AM -0700, Nathan Chancellor wrote:
> > > This patch series raises the minimum supported version of LLVM to
> > > 11.0.0.
[...]
> Only positive feedback so far.
>
> All applied to linux-kbuild.

Some of the "dynamic" checks for compiler support unfortunately aren't
as easily grepable -- as far as I can tell, we can also include the
below, which would save us 2 cc-option invocations for all clang builds.

And just in case:

Acked-by: Marco Elver <[email protected]>

for the rest as well.

Thanks,
-- Marco

------ >8 ------

From: Marco Elver <[email protected]>
Date: Fri, 3 Dec 2021 14:18:44 +0100
Subject: [PATCH] Revert "ubsan, kcsan: Don't combine sanitizer with kcov on
clang"

This reverts commit ea91a1d45d19469001a4955583187b0d75915759.

The minimum Clang version is now 11.0, which fixed the UBSAN/KCSAN vs.
KCOV incompatibilities.

Link: https://bugs.llvm.org/show_bug.cgi?id=45831
Signed-off-by: Marco Elver <[email protected]>
---
lib/Kconfig.kcsan | 11 -----------
lib/Kconfig.ubsan | 12 ------------
2 files changed, 23 deletions(-)

diff --git a/lib/Kconfig.kcsan b/lib/Kconfig.kcsan
index e0a93ffdef30..b81454b2a0d0 100644
--- a/lib/Kconfig.kcsan
+++ b/lib/Kconfig.kcsan
@@ -10,21 +10,10 @@ config HAVE_KCSAN_COMPILER
For the list of compilers that support KCSAN, please see
<file:Documentation/dev-tools/kcsan.rst>.

-config KCSAN_KCOV_BROKEN
- def_bool KCOV && CC_HAS_SANCOV_TRACE_PC
- depends on CC_IS_CLANG
- depends on !$(cc-option,-Werror=unused-command-line-argument -fsanitize=thread -fsanitize-coverage=trace-pc)
- help
- Some versions of clang support either KCSAN and KCOV but not the
- combination of the two.
- See https://bugs.llvm.org/show_bug.cgi?id=45831 for the status
- in newer releases.
-
menuconfig KCSAN
bool "KCSAN: dynamic data race detector"
depends on HAVE_ARCH_KCSAN && HAVE_KCSAN_COMPILER
depends on DEBUG_KERNEL && !KASAN
- depends on !KCSAN_KCOV_BROKEN
select STACKTRACE
help
The Kernel Concurrency Sanitizer (KCSAN) is a dynamic
diff --git a/lib/Kconfig.ubsan b/lib/Kconfig.ubsan
index e5372a13511d..31f38e7fe948 100644
--- a/lib/Kconfig.ubsan
+++ b/lib/Kconfig.ubsan
@@ -27,16 +27,6 @@ config UBSAN_TRAP
the system. For some system builders this is an acceptable
trade-off.

-config UBSAN_KCOV_BROKEN
- def_bool KCOV && CC_HAS_SANCOV_TRACE_PC
- depends on CC_IS_CLANG
- depends on !$(cc-option,-Werror=unused-command-line-argument -fsanitize=bounds -fsanitize-coverage=trace-pc)
- help
- Some versions of clang support either UBSAN or KCOV but not the
- combination of the two.
- See https://bugs.llvm.org/show_bug.cgi?id=45831 for the status
- in newer releases.
-
config CC_HAS_UBSAN_BOUNDS
def_bool $(cc-option,-fsanitize=bounds)

@@ -46,7 +36,6 @@ config CC_HAS_UBSAN_ARRAY_BOUNDS
config UBSAN_BOUNDS
bool "Perform array index bounds checking"
default UBSAN
- depends on !UBSAN_KCOV_BROKEN
depends on CC_HAS_UBSAN_ARRAY_BOUNDS || CC_HAS_UBSAN_BOUNDS
help
This option enables detection of directly indexed out of bounds
@@ -72,7 +61,6 @@ config UBSAN_ARRAY_BOUNDS
config UBSAN_LOCAL_BOUNDS
bool "Perform array local bounds checking"
depends on UBSAN_TRAP
- depends on !UBSAN_KCOV_BROKEN
depends on $(cc-option,-fsanitize=local-bounds)
help
This option enables -fsanitize=local-bounds which traps when an
--
2.34.0.384.gca35af8252-goog


2021-12-03 15:51:16

by Nathan Chancellor

[permalink] [raw]
Subject: Re: [PATCH RFC 0/6] Bump minimum supported version of LLVM to 11.0.0

On Fri, Dec 03, 2021 at 02:38:17PM +0100, Marco Elver wrote:
> On Thu, Dec 02, 2021 at 05:26PM +0900, Masahiro Yamada wrote:
> > On Thu, Dec 2, 2021 at 4:41 AM Kees Cook <[email protected]> wrote:
> > >
> > > On Mon, Nov 29, 2021 at 09:57:57AM -0700, Nathan Chancellor wrote:
> > > > This patch series raises the minimum supported version of LLVM to
> > > > 11.0.0.
> [...]
> > Only positive feedback so far.
> >
> > All applied to linux-kbuild.
>
> Some of the "dynamic" checks for compiler support unfortunately aren't
> as easily grepable -- as far as I can tell, we can also include the
> below, which would save us 2 cc-option invocations for all clang builds.
>
> And just in case:
>
> Acked-by: Marco Elver <[email protected]>
>
> for the rest as well.
>
> Thanks,
> -- Marco
>
> ------ >8 ------
>
> From: Marco Elver <[email protected]>
> Date: Fri, 3 Dec 2021 14:18:44 +0100
> Subject: [PATCH] Revert "ubsan, kcsan: Don't combine sanitizer with kcov on
> clang"
>
> This reverts commit ea91a1d45d19469001a4955583187b0d75915759.
>
> The minimum Clang version is now 11.0, which fixed the UBSAN/KCSAN vs.
> KCOV incompatibilities.
>
> Link: https://bugs.llvm.org/show_bug.cgi?id=45831
> Signed-off-by: Marco Elver <[email protected]>

Thanks!

Reviewed-by: Nathan Chancellor <[email protected]>

> ---
> lib/Kconfig.kcsan | 11 -----------
> lib/Kconfig.ubsan | 12 ------------
> 2 files changed, 23 deletions(-)
>
> diff --git a/lib/Kconfig.kcsan b/lib/Kconfig.kcsan
> index e0a93ffdef30..b81454b2a0d0 100644
> --- a/lib/Kconfig.kcsan
> +++ b/lib/Kconfig.kcsan
> @@ -10,21 +10,10 @@ config HAVE_KCSAN_COMPILER
> For the list of compilers that support KCSAN, please see
> <file:Documentation/dev-tools/kcsan.rst>.
>
> -config KCSAN_KCOV_BROKEN
> - def_bool KCOV && CC_HAS_SANCOV_TRACE_PC
> - depends on CC_IS_CLANG
> - depends on !$(cc-option,-Werror=unused-command-line-argument -fsanitize=thread -fsanitize-coverage=trace-pc)
> - help
> - Some versions of clang support either KCSAN and KCOV but not the
> - combination of the two.
> - See https://bugs.llvm.org/show_bug.cgi?id=45831 for the status
> - in newer releases.
> -
> menuconfig KCSAN
> bool "KCSAN: dynamic data race detector"
> depends on HAVE_ARCH_KCSAN && HAVE_KCSAN_COMPILER
> depends on DEBUG_KERNEL && !KASAN
> - depends on !KCSAN_KCOV_BROKEN
> select STACKTRACE
> help
> The Kernel Concurrency Sanitizer (KCSAN) is a dynamic
> diff --git a/lib/Kconfig.ubsan b/lib/Kconfig.ubsan
> index e5372a13511d..31f38e7fe948 100644
> --- a/lib/Kconfig.ubsan
> +++ b/lib/Kconfig.ubsan
> @@ -27,16 +27,6 @@ config UBSAN_TRAP
> the system. For some system builders this is an acceptable
> trade-off.
>
> -config UBSAN_KCOV_BROKEN
> - def_bool KCOV && CC_HAS_SANCOV_TRACE_PC
> - depends on CC_IS_CLANG
> - depends on !$(cc-option,-Werror=unused-command-line-argument -fsanitize=bounds -fsanitize-coverage=trace-pc)
> - help
> - Some versions of clang support either UBSAN or KCOV but not the
> - combination of the two.
> - See https://bugs.llvm.org/show_bug.cgi?id=45831 for the status
> - in newer releases.
> -
> config CC_HAS_UBSAN_BOUNDS
> def_bool $(cc-option,-fsanitize=bounds)
>
> @@ -46,7 +36,6 @@ config CC_HAS_UBSAN_ARRAY_BOUNDS
> config UBSAN_BOUNDS
> bool "Perform array index bounds checking"
> default UBSAN
> - depends on !UBSAN_KCOV_BROKEN
> depends on CC_HAS_UBSAN_ARRAY_BOUNDS || CC_HAS_UBSAN_BOUNDS
> help
> This option enables detection of directly indexed out of bounds
> @@ -72,7 +61,6 @@ config UBSAN_ARRAY_BOUNDS
> config UBSAN_LOCAL_BOUNDS
> bool "Perform array local bounds checking"
> depends on UBSAN_TRAP
> - depends on !UBSAN_KCOV_BROKEN
> depends on $(cc-option,-fsanitize=local-bounds)
> help
> This option enables -fsanitize=local-bounds which traps when an
> --
> 2.34.0.384.gca35af8252-goog
>