* [PATCH] kcsan: select CONFIG_CONSTRUCTORS @ 2023-02-15 9:14 Arnd Bergmann 2023-02-15 9:25 ` Marco Elver 0 siblings, 1 reply; 6+ messages in thread From: Arnd Bergmann @ 2023-02-15 9:14 UTC (permalink / raw) To: Marco Elver Cc: Arnd Bergmann, Kees Cook, Dmitry Vyukov, Josh Poimboeuf, Peter Zijlstra (Intel), Miroslav Benes, kasan-dev, linux-kernel From: Arnd Bergmann <arnd@arndb.de> Building a kcsan enabled kernel for x86_64 with gcc-11 results in a lot of build warnings or errors without CONFIG_CONSTRUCTORS: x86_64-linux-ld: error: unplaced orphan section `.ctors.65436' from `arch/x86/lib/copy_mc.o' x86_64-linux-ld: error: unplaced orphan section `.ctors.65436' from `arch/x86/lib/cpu.o' x86_64-linux-ld: error: unplaced orphan section `.ctors.65436' from `arch/x86/lib/csum-partial_64.o' x86_64-linux-ld: error: unplaced orphan section `.ctors.65436' from `arch/x86/lib/csum-wrappers_64.o' x86_64-linux-ld: error: unplaced orphan section `.ctors.65436' from `arch/x86/lib/insn-eval.o' x86_64-linux-ld: error: unplaced orphan section `.ctors.65436' from `arch/x86/lib/insn.o' x86_64-linux-ld: error: unplaced orphan section `.ctors.65436' from `arch/x86/lib/misc.o' The same thing has been reported for mips64. I can't reproduce it for any other compiler version, so I don't know if constructors are always required here or if this is a gcc-11 specific implementation detail. I see no harm in always enabling constructors here, and this reliably fixes the build warnings for me. Link: https://lore.kernel.org/lkml/202204181801.r3MMkwJv-lkp@intel.com/T/ Cc: Kees Cook <keescook@chromium.org> See-also: 3e6631485fae ("vmlinux.lds.h: Keep .ctors.* with .ctors") Signed-off-by: Arnd Bergmann <arnd@arndb.de> --- lib/Kconfig.kcsan | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/Kconfig.kcsan b/lib/Kconfig.kcsan index 4dedd61e5192..609ddfc73de5 100644 --- a/lib/Kconfig.kcsan +++ b/lib/Kconfig.kcsan @@ -14,6 +14,7 @@ menuconfig KCSAN bool "KCSAN: dynamic data race detector" depends on HAVE_ARCH_KCSAN && HAVE_KCSAN_COMPILER depends on DEBUG_KERNEL && !KASAN + select CONSTRUCTORS select STACKTRACE help The Kernel Concurrency Sanitizer (KCSAN) is a dynamic -- 2.39.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] kcsan: select CONFIG_CONSTRUCTORS 2023-02-15 9:14 [PATCH] kcsan: select CONFIG_CONSTRUCTORS Arnd Bergmann @ 2023-02-15 9:25 ` Marco Elver 2023-02-15 9:48 ` Arnd Bergmann 0 siblings, 1 reply; 6+ messages in thread From: Marco Elver @ 2023-02-15 9:25 UTC (permalink / raw) To: Arnd Bergmann Cc: Arnd Bergmann, Kees Cook, Dmitry Vyukov, Josh Poimboeuf, Peter Zijlstra (Intel), Miroslav Benes, kasan-dev, linux-kernel, Paul E. McKenney On Wed, 15 Feb 2023 at 10:15, Arnd Bergmann <arnd@kernel.org> wrote: > > From: Arnd Bergmann <arnd@arndb.de> > > Building a kcsan enabled kernel for x86_64 with gcc-11 results in a lot > of build warnings or errors without CONFIG_CONSTRUCTORS: > > x86_64-linux-ld: error: unplaced orphan section `.ctors.65436' from `arch/x86/lib/copy_mc.o' > x86_64-linux-ld: error: unplaced orphan section `.ctors.65436' from `arch/x86/lib/cpu.o' > x86_64-linux-ld: error: unplaced orphan section `.ctors.65436' from `arch/x86/lib/csum-partial_64.o' > x86_64-linux-ld: error: unplaced orphan section `.ctors.65436' from `arch/x86/lib/csum-wrappers_64.o' > x86_64-linux-ld: error: unplaced orphan section `.ctors.65436' from `arch/x86/lib/insn-eval.o' > x86_64-linux-ld: error: unplaced orphan section `.ctors.65436' from `arch/x86/lib/insn.o' > x86_64-linux-ld: error: unplaced orphan section `.ctors.65436' from `arch/x86/lib/misc.o' > > The same thing has been reported for mips64. I can't reproduce it for > any other compiler version, so I don't know if constructors are always > required here or if this is a gcc-11 specific implementation detail. > > I see no harm in always enabling constructors here, and this reliably > fixes the build warnings for me. > > Link: https://lore.kernel.org/lkml/202204181801.r3MMkwJv-lkp@intel.com/T/ > Cc: Kees Cook <keescook@chromium.org> > See-also: 3e6631485fae ("vmlinux.lds.h: Keep .ctors.* with .ctors") > Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Marco Elver <elver@google.com> Looks like KASAN does select CONSTRUCTORS already, so KCSAN should as well. Do you have a tree to take this through, or should it go through -rcu as usual for KCSAN patches? Thanks, -- Marco > --- > lib/Kconfig.kcsan | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/lib/Kconfig.kcsan b/lib/Kconfig.kcsan > index 4dedd61e5192..609ddfc73de5 100644 > --- a/lib/Kconfig.kcsan > +++ b/lib/Kconfig.kcsan > @@ -14,6 +14,7 @@ menuconfig KCSAN > bool "KCSAN: dynamic data race detector" > depends on HAVE_ARCH_KCSAN && HAVE_KCSAN_COMPILER > depends on DEBUG_KERNEL && !KASAN > + select CONSTRUCTORS > select STACKTRACE > help > The Kernel Concurrency Sanitizer (KCSAN) is a dynamic > -- > 2.39.1 > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] kcsan: select CONFIG_CONSTRUCTORS 2023-02-15 9:25 ` Marco Elver @ 2023-02-15 9:48 ` Arnd Bergmann 2023-02-15 22:42 ` Paul E. McKenney 0 siblings, 1 reply; 6+ messages in thread From: Arnd Bergmann @ 2023-02-15 9:48 UTC (permalink / raw) To: Marco Elver, Arnd Bergmann Cc: Kees Cook, Dmitry Vyukov, Josh Poimboeuf, Peter Zijlstra, Miroslav Benes, kasan-dev, linux-kernel, Paul E. McKenney On Wed, Feb 15, 2023, at 10:25, Marco Elver wrote: > On Wed, 15 Feb 2023 at 10:15, Arnd Bergmann <arnd@kernel.org> wrote: > Looks like KASAN does select CONSTRUCTORS already, so KCSAN should as well. > > Do you have a tree to take this through, or should it go through -rcu > as usual for KCSAN patches? I don't have a tree for taking these build fixes, so it would be good if you could forward it as appropriate. Thanks, Arnd ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] kcsan: select CONFIG_CONSTRUCTORS 2023-02-15 9:48 ` Arnd Bergmann @ 2023-02-15 22:42 ` Paul E. McKenney 2023-02-16 7:00 ` Marco Elver 0 siblings, 1 reply; 6+ messages in thread From: Paul E. McKenney @ 2023-02-15 22:42 UTC (permalink / raw) To: Arnd Bergmann Cc: Marco Elver, Arnd Bergmann, Kees Cook, Dmitry Vyukov, Josh Poimboeuf, Peter Zijlstra, Miroslav Benes, kasan-dev, linux-kernel On Wed, Feb 15, 2023 at 10:48:11AM +0100, Arnd Bergmann wrote: > On Wed, Feb 15, 2023, at 10:25, Marco Elver wrote: > > On Wed, 15 Feb 2023 at 10:15, Arnd Bergmann <arnd@kernel.org> wrote: > > > Looks like KASAN does select CONSTRUCTORS already, so KCSAN should as well. > > > > Do you have a tree to take this through, or should it go through -rcu > > as usual for KCSAN patches? > > I don't have a tree for taking these build fixes, so it would be good if you could forward it as appropriate. Queued and pushed, thank you both! Is this ready for the upcoming merge window, or would you rather that I hold off until the v6.4 merge window? (I am tempted to treat this as a bug fix, thus sending it earlier rather than later, but figured I should ask.) Thanx, Paul ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] kcsan: select CONFIG_CONSTRUCTORS 2023-02-15 22:42 ` Paul E. McKenney @ 2023-02-16 7:00 ` Marco Elver 2023-02-16 18:36 ` Paul E. McKenney 0 siblings, 1 reply; 6+ messages in thread From: Marco Elver @ 2023-02-16 7:00 UTC (permalink / raw) To: paulmck Cc: Arnd Bergmann, Arnd Bergmann, Kees Cook, Dmitry Vyukov, Josh Poimboeuf, Peter Zijlstra, Miroslav Benes, kasan-dev, linux-kernel On Wed, 15 Feb 2023 at 23:42, Paul E. McKenney <paulmck@kernel.org> wrote: > > On Wed, Feb 15, 2023 at 10:48:11AM +0100, Arnd Bergmann wrote: > > On Wed, Feb 15, 2023, at 10:25, Marco Elver wrote: > > > On Wed, 15 Feb 2023 at 10:15, Arnd Bergmann <arnd@kernel.org> wrote: > > > > > Looks like KASAN does select CONSTRUCTORS already, so KCSAN should as well. > > > > > > Do you have a tree to take this through, or should it go through -rcu > > > as usual for KCSAN patches? > > > > I don't have a tree for taking these build fixes, so it would be good if you could forward it as appropriate. > > Queued and pushed, thank you both! > > Is this ready for the upcoming merge window, or would you rather that > I hold off until the v6.4 merge window? (I am tempted to treat this > as a bug fix, thus sending it earlier rather than later, but figured I > should ask.) I'd consider it a bug fix. If it survives the usual -next exposure, no harm in sending it as a fix. Thanks, -- Marco ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] kcsan: select CONFIG_CONSTRUCTORS 2023-02-16 7:00 ` Marco Elver @ 2023-02-16 18:36 ` Paul E. McKenney 0 siblings, 0 replies; 6+ messages in thread From: Paul E. McKenney @ 2023-02-16 18:36 UTC (permalink / raw) To: Marco Elver Cc: Arnd Bergmann, Arnd Bergmann, Kees Cook, Dmitry Vyukov, Josh Poimboeuf, Peter Zijlstra, Miroslav Benes, kasan-dev, linux-kernel On Thu, Feb 16, 2023 at 08:00:00AM +0100, Marco Elver wrote: > On Wed, 15 Feb 2023 at 23:42, Paul E. McKenney <paulmck@kernel.org> wrote: > > > > On Wed, Feb 15, 2023 at 10:48:11AM +0100, Arnd Bergmann wrote: > > > On Wed, Feb 15, 2023, at 10:25, Marco Elver wrote: > > > > On Wed, 15 Feb 2023 at 10:15, Arnd Bergmann <arnd@kernel.org> wrote: > > > > > > > Looks like KASAN does select CONSTRUCTORS already, so KCSAN should as well. > > > > > > > > Do you have a tree to take this through, or should it go through -rcu > > > > as usual for KCSAN patches? > > > > > > I don't have a tree for taking these build fixes, so it would be good if you could forward it as appropriate. > > > > Queued and pushed, thank you both! > > > > Is this ready for the upcoming merge window, or would you rather that > > I hold off until the v6.4 merge window? (I am tempted to treat this > > as a bug fix, thus sending it earlier rather than later, but figured I > > should ask.) > > I'd consider it a bug fix. If it survives the usual -next exposure, no > harm in sending it as a fix. It passed overnight tests, so I have sent it along to -next. If there are no issues, I will push it by the end of this coming week (which is the first weke of the merge window). Thanx, Paul ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-02-16 18:36 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-02-15 9:14 [PATCH] kcsan: select CONFIG_CONSTRUCTORS Arnd Bergmann 2023-02-15 9:25 ` Marco Elver 2023-02-15 9:48 ` Arnd Bergmann 2023-02-15 22:42 ` Paul E. McKenney 2023-02-16 7:00 ` Marco Elver 2023-02-16 18:36 ` Paul E. McKenney
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).