linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kcsan: fix section mismatch for __write_once_size/blacklisted_initcalls
@ 2020-05-05 14:11 Arnd Bergmann
  2020-05-05 14:17 ` Marco Elver
  0 siblings, 1 reply; 4+ messages in thread
From: Arnd Bergmann @ 2020-05-05 14:11 UTC (permalink / raw)
  To: Paul E. McKenney, Marco Elver
  Cc: Arnd Bergmann, Andrew Morton, Masami Hiramatsu,
	Steven Rostedt (VMware),
	Kees Cook, Mike Rapoport, Arvind Sankar, Dominik Brodowski,
	Alexander Potapenko, linux-kernel, clang-built-linux

Moving __write_once_size out of line causes a section mismatch warning
with clang in one instance:

WARNING: modpost: vmlinux.o(.text+0x8dc): Section mismatch in reference from the function __write_once_size() to the variable .init.data:blacklisted_initcalls
The function __write_once_size() references
the variable __initdata blacklisted_initcalls.
This is often because __write_once_size lacks a __initdata
annotation or the annotation of blacklisted_initcalls is wrong.

Remove the __init_or_module annotation from the variable as a workaround.

Fixes: dfd402a4c4ba ("kcsan: Add Kernel Concurrency Sanitizer infrastructure")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
So far, my randconfig checks found two such instances, one for read_once
and one for write_once. There are probably a couple more in random
configurations, but I guess they are rare enough that we can just work
around them like this.
---
 init/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/init/main.c b/init/main.c
index 8f78399697e3..441c384a73cd 100644
--- a/init/main.c
+++ b/init/main.c
@@ -1020,7 +1020,7 @@ struct blacklist_entry {
 	char *buf;
 };
 
-static __initdata_or_module LIST_HEAD(blacklisted_initcalls);
+static LIST_HEAD(blacklisted_initcalls);
 
 static int __init initcall_blacklist(char *str)
 {
-- 
2.26.0


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

* Re: [PATCH] kcsan: fix section mismatch for __write_once_size/blacklisted_initcalls
  2020-05-05 14:11 [PATCH] kcsan: fix section mismatch for __write_once_size/blacklisted_initcalls Arnd Bergmann
@ 2020-05-05 14:17 ` Marco Elver
  2020-05-05 15:05   ` Arnd Bergmann
  0 siblings, 1 reply; 4+ messages in thread
From: Marco Elver @ 2020-05-05 14:17 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Paul E. McKenney, Andrew Morton, Masami Hiramatsu,
	Steven Rostedt (VMware),
	Kees Cook, Mike Rapoport, Arvind Sankar, Dominik Brodowski,
	Alexander Potapenko, LKML, clang-built-linux, Will Deacon

On Tue, 5 May 2020 at 16:11, Arnd Bergmann <arnd@arndb.de> wrote:
>
> Moving __write_once_size out of line causes a section mismatch warning
> with clang in one instance:
>
> WARNING: modpost: vmlinux.o(.text+0x8dc): Section mismatch in reference from the function __write_once_size() to the variable .init.data:blacklisted_initcalls
> The function __write_once_size() references
> the variable __initdata blacklisted_initcalls.
> This is often because __write_once_size lacks a __initdata
> annotation or the annotation of blacklisted_initcalls is wrong.
>
> Remove the __init_or_module annotation from the variable as a workaround.
>
> Fixes: dfd402a4c4ba ("kcsan: Add Kernel Concurrency Sanitizer infrastructure")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> So far, my randconfig checks found two such instances, one for read_once
> and one for write_once. There are probably a couple more in random
> configurations, but I guess they are rare enough that we can just work
> around them like this.

[+Cc Will]

Thanks for testing and fixing this. Note that this may no longer be
necessary once Will's patches land. Also noted here:
https://lkml.kernel.org/r/CANpmjNNw6M9Gqj6WGTHH4Cegu8roTVu5x6Vqs_tCBxX3gPwL4A@mail.gmail.com

For reference, Will's series:
https://lore.kernel.org/lkml/20200421151537.19241-1-will@kernel.org/

Thanks,
-- Marco


> ---
>  init/main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/init/main.c b/init/main.c
> index 8f78399697e3..441c384a73cd 100644
> --- a/init/main.c
> +++ b/init/main.c
> @@ -1020,7 +1020,7 @@ struct blacklist_entry {
>         char *buf;
>  };
>
> -static __initdata_or_module LIST_HEAD(blacklisted_initcalls);
> +static LIST_HEAD(blacklisted_initcalls);
>
>  static int __init initcall_blacklist(char *str)
>  {
> --
> 2.26.0
>

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

* Re: [PATCH] kcsan: fix section mismatch for __write_once_size/blacklisted_initcalls
  2020-05-05 14:17 ` Marco Elver
@ 2020-05-05 15:05   ` Arnd Bergmann
  2020-05-05 15:11     ` Will Deacon
  0 siblings, 1 reply; 4+ messages in thread
From: Arnd Bergmann @ 2020-05-05 15:05 UTC (permalink / raw)
  To: Marco Elver
  Cc: Paul E. McKenney, Andrew Morton, Masami Hiramatsu,
	Steven Rostedt (VMware),
	Kees Cook, Mike Rapoport, Arvind Sankar, Dominik Brodowski,
	Alexander Potapenko, LKML, clang-built-linux, Will Deacon

On Tue, May 5, 2020 at 4:17 PM 'Marco Elver' via Clang Built Linux
<clang-built-linux@googlegroups.com> wrote:
> On Tue, 5 May 2020 at 16:11, Arnd Bergmann <arnd@arndb.de> wrote:
> > So far, my randconfig checks found two such instances, one for read_once
> > and one for write_once. There are probably a couple more in random
> > configurations, but I guess they are rare enough that we can just work
> > around them like this.
>
> [+Cc Will]
>
> Thanks for testing and fixing this. Note that this may no longer be
> necessary once Will's patches land. Also noted here:
> https://lkml.kernel.org/r/CANpmjNNw6M9Gqj6WGTHH4Cegu8roTVu5x6Vqs_tCBxX3gPwL4A@mail.gmail.com
>
> For reference, Will's series:
> https://lore.kernel.org/lkml/20200421151537.19241-1-will@kernel.org/

Right, good point. If that is going to get merged for the same release, we don't
need my workarounds and I'll just keep them applied locally in my linux-next
randconfig tree for the moment.

      Arnd

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

* Re: [PATCH] kcsan: fix section mismatch for __write_once_size/blacklisted_initcalls
  2020-05-05 15:05   ` Arnd Bergmann
@ 2020-05-05 15:11     ` Will Deacon
  0 siblings, 0 replies; 4+ messages in thread
From: Will Deacon @ 2020-05-05 15:11 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Marco Elver, Paul E. McKenney, Andrew Morton, Masami Hiramatsu,
	Steven Rostedt (VMware),
	Kees Cook, Mike Rapoport, Arvind Sankar, Dominik Brodowski,
	Alexander Potapenko, LKML, clang-built-linux

On Tue, May 05, 2020 at 05:05:36PM +0200, Arnd Bergmann wrote:
> On Tue, May 5, 2020 at 4:17 PM 'Marco Elver' via Clang Built Linux
> <clang-built-linux@googlegroups.com> wrote:
> > On Tue, 5 May 2020 at 16:11, Arnd Bergmann <arnd@arndb.de> wrote:
> > > So far, my randconfig checks found two such instances, one for read_once
> > > and one for write_once. There are probably a couple more in random
> > > configurations, but I guess they are rare enough that we can just work
> > > around them like this.
> >
> > [+Cc Will]
> >
> > Thanks for testing and fixing this. Note that this may no longer be
> > necessary once Will's patches land. Also noted here:
> > https://lkml.kernel.org/r/CANpmjNNw6M9Gqj6WGTHH4Cegu8roTVu5x6Vqs_tCBxX3gPwL4A@mail.gmail.com
> >
> > For reference, Will's series:
> > https://lore.kernel.org/lkml/20200421151537.19241-1-will@kernel.org/
> 
> Right, good point. If that is going to get merged for the same release, we don't
> need my workarounds and I'll just keep them applied locally in my linux-next
> randconfig tree for the moment.

I'll send out a new version based on the kcsan stuff this week, so fingers
crossed for 5.8!

Will

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

end of thread, other threads:[~2020-05-05 15:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-05 14:11 [PATCH] kcsan: fix section mismatch for __write_once_size/blacklisted_initcalls Arnd Bergmann
2020-05-05 14:17 ` Marco Elver
2020-05-05 15:05   ` Arnd Bergmann
2020-05-05 15:11     ` Will Deacon

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).