* [PATCH mips-next] vmlinux.lds.h: catch more UBSAN symbols into .data
@ 2021-02-16 8:55 Alexander Lobakin
2021-02-16 17:10 ` Thomas Bogendoerfer
2021-02-16 17:56 ` Nick Desaulniers
0 siblings, 2 replies; 5+ messages in thread
From: Alexander Lobakin @ 2021-02-16 8:55 UTC (permalink / raw)
To: Thomas Bogendoerfer
Cc: Arnd Bergmann, Nathan Chancellor, Nick Desaulniers, Huacai Chen,
Pei Huang, Kees Cook, Sami Tolvanen, Alexander Lobakin,
Fangrui Song, Jiaxun Yang, Ralf Baechle, Corey Minyard,
kernel test robot, linux-mips, linux-kernel, linux-arch,
clang-built-linux
LKP triggered lots of LD orphan warnings [0]:
mipsel-linux-ld: warning: orphan section `.data.$Lubsan_data299' from
`init/do_mounts_rd.o' being placed in section `.data.$Lubsan_data299'
mipsel-linux-ld: warning: orphan section `.data.$Lubsan_data183' from
`init/do_mounts_rd.o' being placed in section `.data.$Lubsan_data183'
mipsel-linux-ld: warning: orphan section `.data.$Lubsan_type3' from
`init/do_mounts_rd.o' being placed in section `.data.$Lubsan_type3'
mipsel-linux-ld: warning: orphan section `.data.$Lubsan_type2' from
`init/do_mounts_rd.o' being placed in section `.data.$Lubsan_type2'
mipsel-linux-ld: warning: orphan section `.data.$Lubsan_type0' from
`init/do_mounts_rd.o' being placed in section `.data.$Lubsan_type0'
[...]
Seems like "unnamed data" isn't the only type of symbols that UBSAN
instrumentation can emit.
Catch these into .data with the wildcard as well.
[0] https://lore.kernel.org/linux-mm/202102160741.k57GCNSR-lkp@intel.com
Fixes: f41b233de0ae ("vmlinux.lds.h: catch UBSAN's "unnamed data" into data")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Alexander Lobakin <alobakin@pm.me>
---
include/asm-generic/vmlinux.lds.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index cc659e77fcb0..83537e5ee78f 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -95,7 +95,7 @@
*/
#ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
#define TEXT_MAIN .text .text.[0-9a-zA-Z_]*
-#define DATA_MAIN .data .data.[0-9a-zA-Z_]* .data..L* .data..compoundliteral* .data.$__unnamed_*
+#define DATA_MAIN .data .data.[0-9a-zA-Z_]* .data..L* .data..compoundliteral* .data.$__unnamed_* .data.$Lubsan_*
#define SDATA_MAIN .sdata .sdata.[0-9a-zA-Z_]*
#define RODATA_MAIN .rodata .rodata.[0-9a-zA-Z_]* .rodata..L*
#define BSS_MAIN .bss .bss.[0-9a-zA-Z_]* .bss..compoundliteral*
--
2.30.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH mips-next] vmlinux.lds.h: catch more UBSAN symbols into .data
2021-02-16 8:55 [PATCH mips-next] vmlinux.lds.h: catch more UBSAN symbols into .data Alexander Lobakin
@ 2021-02-16 17:10 ` Thomas Bogendoerfer
2021-02-16 17:56 ` Nick Desaulniers
1 sibling, 0 replies; 5+ messages in thread
From: Thomas Bogendoerfer @ 2021-02-16 17:10 UTC (permalink / raw)
To: Alexander Lobakin
Cc: Arnd Bergmann, Nathan Chancellor, Nick Desaulniers, Huacai Chen,
Pei Huang, Kees Cook, Sami Tolvanen, Fangrui Song, Jiaxun Yang,
Ralf Baechle, Corey Minyard, kernel test robot, linux-mips,
linux-kernel, linux-arch, clang-built-linux
On Tue, Feb 16, 2021 at 08:55:25AM +0000, Alexander Lobakin wrote:
> LKP triggered lots of LD orphan warnings [0]:
>
> mipsel-linux-ld: warning: orphan section `.data.$Lubsan_data299' from
> `init/do_mounts_rd.o' being placed in section `.data.$Lubsan_data299'
> mipsel-linux-ld: warning: orphan section `.data.$Lubsan_data183' from
> `init/do_mounts_rd.o' being placed in section `.data.$Lubsan_data183'
> mipsel-linux-ld: warning: orphan section `.data.$Lubsan_type3' from
> `init/do_mounts_rd.o' being placed in section `.data.$Lubsan_type3'
> mipsel-linux-ld: warning: orphan section `.data.$Lubsan_type2' from
> `init/do_mounts_rd.o' being placed in section `.data.$Lubsan_type2'
> mipsel-linux-ld: warning: orphan section `.data.$Lubsan_type0' from
> `init/do_mounts_rd.o' being placed in section `.data.$Lubsan_type0'
>
> [...]
>
> Seems like "unnamed data" isn't the only type of symbols that UBSAN
> instrumentation can emit.
> Catch these into .data with the wildcard as well.
>
> [0] https://lore.kernel.org/linux-mm/202102160741.k57GCNSR-lkp@intel.com
>
> Fixes: f41b233de0ae ("vmlinux.lds.h: catch UBSAN's "unnamed data" into data")
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Alexander Lobakin <alobakin@pm.me>
> ---
> include/asm-generic/vmlinux.lds.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
applied to mips-next.
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH mips-next] vmlinux.lds.h: catch more UBSAN symbols into .data
2021-02-16 8:55 [PATCH mips-next] vmlinux.lds.h: catch more UBSAN symbols into .data Alexander Lobakin
2021-02-16 17:10 ` Thomas Bogendoerfer
@ 2021-02-16 17:56 ` Nick Desaulniers
2021-02-16 18:54 ` Nathan Chancellor
2021-02-16 19:03 ` Alexander Lobakin
1 sibling, 2 replies; 5+ messages in thread
From: Nick Desaulniers @ 2021-02-16 17:56 UTC (permalink / raw)
To: Alexander Lobakin
Cc: Thomas Bogendoerfer, Arnd Bergmann, Nathan Chancellor,
Huacai Chen, Pei Huang, Kees Cook, Sami Tolvanen, Fangrui Song,
Jiaxun Yang, Ralf Baechle, Corey Minyard, kernel test robot,
linux-mips, LKML, linux-arch, clang-built-linux
On Tue, Feb 16, 2021 at 12:55 AM Alexander Lobakin <alobakin@pm.me> wrote:
>
> LKP triggered lots of LD orphan warnings [0]:
Thanks for the patch, just some questions.
With which linker? Was there a particular config from the bot's
report that triggered this?
>
> mipsel-linux-ld: warning: orphan section `.data.$Lubsan_data299' from
> `init/do_mounts_rd.o' being placed in section `.data.$Lubsan_data299'
> mipsel-linux-ld: warning: orphan section `.data.$Lubsan_data183' from
> `init/do_mounts_rd.o' being placed in section `.data.$Lubsan_data183'
> mipsel-linux-ld: warning: orphan section `.data.$Lubsan_type3' from
> `init/do_mounts_rd.o' being placed in section `.data.$Lubsan_type3'
> mipsel-linux-ld: warning: orphan section `.data.$Lubsan_type2' from
> `init/do_mounts_rd.o' being placed in section `.data.$Lubsan_type2'
> mipsel-linux-ld: warning: orphan section `.data.$Lubsan_type0' from
> `init/do_mounts_rd.o' being placed in section `.data.$Lubsan_type0'
>
> [...]
>
> Seems like "unnamed data" isn't the only type of symbols that UBSAN
> instrumentation can emit.
> Catch these into .data with the wildcard as well.
>
> [0] https://lore.kernel.org/linux-mm/202102160741.k57GCNSR-lkp@intel.com
>
> Fixes: f41b233de0ae ("vmlinux.lds.h: catch UBSAN's "unnamed data" into data")
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Alexander Lobakin <alobakin@pm.me>
> ---
> include/asm-generic/vmlinux.lds.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
> index cc659e77fcb0..83537e5ee78f 100644
> --- a/include/asm-generic/vmlinux.lds.h
> +++ b/include/asm-generic/vmlinux.lds.h
> @@ -95,7 +95,7 @@
> */
> #ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
> #define TEXT_MAIN .text .text.[0-9a-zA-Z_]*
> -#define DATA_MAIN .data .data.[0-9a-zA-Z_]* .data..L* .data..compoundliteral* .data.$__unnamed_*
> +#define DATA_MAIN .data .data.[0-9a-zA-Z_]* .data..L* .data..compoundliteral* .data.$__unnamed_* .data.$Lubsan_*
Are these sections only created when
CONFIG_LD_DEAD_CODE_DATA_ELIMINATION is selected? (Same with
.data.$__unnamed_*)
> #define SDATA_MAIN .sdata .sdata.[0-9a-zA-Z_]*
> #define RODATA_MAIN .rodata .rodata.[0-9a-zA-Z_]* .rodata..L*
> #define BSS_MAIN .bss .bss.[0-9a-zA-Z_]* .bss..compoundliteral*
> --
> 2.30.1
>
>
--
Thanks,
~Nick Desaulniers
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH mips-next] vmlinux.lds.h: catch more UBSAN symbols into .data
2021-02-16 17:56 ` Nick Desaulniers
@ 2021-02-16 18:54 ` Nathan Chancellor
2021-02-16 19:03 ` Alexander Lobakin
1 sibling, 0 replies; 5+ messages in thread
From: Nathan Chancellor @ 2021-02-16 18:54 UTC (permalink / raw)
To: Nick Desaulniers
Cc: Alexander Lobakin, Thomas Bogendoerfer, Arnd Bergmann,
Nathan Chancellor, Huacai Chen, Pei Huang, Kees Cook,
Sami Tolvanen, Fangrui Song, Jiaxun Yang, Ralf Baechle,
Corey Minyard, kernel test robot, linux-mips, LKML, linux-arch,
clang-built-linux
On Tue, Feb 16, 2021 at 09:56:32AM -0800, 'Nick Desaulniers' via Clang Built Linux wrote:
> On Tue, Feb 16, 2021 at 12:55 AM Alexander Lobakin <alobakin@pm.me> wrote:
> >
> > LKP triggered lots of LD orphan warnings [0]:
>
> Thanks for the patch, just some questions.
>
> With which linker? Was there a particular config from the bot's
> report that triggered this?
Looks like GNU ld 2.34 (see below).
> >
> > mipsel-linux-ld: warning: orphan section `.data.$Lubsan_data299' from
> > `init/do_mounts_rd.o' being placed in section `.data.$Lubsan_data299'
> > mipsel-linux-ld: warning: orphan section `.data.$Lubsan_data183' from
> > `init/do_mounts_rd.o' being placed in section `.data.$Lubsan_data183'
> > mipsel-linux-ld: warning: orphan section `.data.$Lubsan_type3' from
> > `init/do_mounts_rd.o' being placed in section `.data.$Lubsan_type3'
> > mipsel-linux-ld: warning: orphan section `.data.$Lubsan_type2' from
> > `init/do_mounts_rd.o' being placed in section `.data.$Lubsan_type2'
> > mipsel-linux-ld: warning: orphan section `.data.$Lubsan_type0' from
> > `init/do_mounts_rd.o' being placed in section `.data.$Lubsan_type0'
> >
> > [...]
> >
> > Seems like "unnamed data" isn't the only type of symbols that UBSAN
> > instrumentation can emit.
> > Catch these into .data with the wildcard as well.
> >
> > [0] https://lore.kernel.org/linux-mm/202102160741.k57GCNSR-lkp@intel.com
> >
> > Fixes: f41b233de0ae ("vmlinux.lds.h: catch UBSAN's "unnamed data" into data")
> > Reported-by: kernel test robot <lkp@intel.com>
> > Signed-off-by: Alexander Lobakin <alobakin@pm.me>
> > ---
> > include/asm-generic/vmlinux.lds.h | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
> > index cc659e77fcb0..83537e5ee78f 100644
> > --- a/include/asm-generic/vmlinux.lds.h
> > +++ b/include/asm-generic/vmlinux.lds.h
> > @@ -95,7 +95,7 @@
> > */
> > #ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
> > #define TEXT_MAIN .text .text.[0-9a-zA-Z_]*
> > -#define DATA_MAIN .data .data.[0-9a-zA-Z_]* .data..L* .data..compoundliteral* .data.$__unnamed_*
> > +#define DATA_MAIN .data .data.[0-9a-zA-Z_]* .data..L* .data..compoundliteral* .data.$__unnamed_* .data.$Lubsan_*
>
> Are these sections only created when
> CONFIG_LD_DEAD_CODE_DATA_ELIMINATION is selected? (Same with
> .data.$__unnamed_*)
Most likely, as that config is set in the problematic config. My guess
is that these are GCC's equivalent of Clang's .data.$__unnamed_...
$ crl https://lore.kernel.org/linux-mm/202102160741.k57GCNSR-lkp@intel.com/2-a.bin | gzip -d | rg "CONFIG_LD_DEAD_CODE|CONFIG_LD_VERSION"
CONFIG_LD_VERSION=234000000
CONFIG_LD_DEAD_CODE_DATA_ELIMINATION=y
> > #define SDATA_MAIN .sdata .sdata.[0-9a-zA-Z_]*
> > #define RODATA_MAIN .rodata .rodata.[0-9a-zA-Z_]* .rodata..L*
> > #define BSS_MAIN .bss .bss.[0-9a-zA-Z_]* .bss..compoundliteral*
> > --
> > 2.30.1
> >
> >
>
>
> --
> Thanks,
> ~Nick Desaulniers
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH mips-next] vmlinux.lds.h: catch more UBSAN symbols into .data
2021-02-16 17:56 ` Nick Desaulniers
2021-02-16 18:54 ` Nathan Chancellor
@ 2021-02-16 19:03 ` Alexander Lobakin
1 sibling, 0 replies; 5+ messages in thread
From: Alexander Lobakin @ 2021-02-16 19:03 UTC (permalink / raw)
To: Nick Desaulniers
Cc: Alexander Lobakin, Thomas Bogendoerfer, Arnd Bergmann,
Nathan Chancellor, Huacai Chen, Pei Huang, Kees Cook,
Sami Tolvanen, Fangrui Song, Jiaxun Yang, Ralf Baechle,
Corey Minyard, kernel test robot, linux-mips, LKML, linux-arch,
clang-built-linux
From: Nick Desaulniers <ndesaulniers@google.com>
Date: Tue, 16 Feb 2021 09:56:32 -0800
> On Tue, Feb 16, 2021 at 12:55 AM Alexander Lobakin <alobakin@pm.me> wrote:
> >
> > LKP triggered lots of LD orphan warnings [0]:
>
> Thanks for the patch, just some questions.
>
> With which linker? Was there a particular config from the bot's
> report that triggered this?
All the info can be found by going through the link from the commit
message. Compiler was GCC 9.3, so I suppose BFD was used as a linker.
I mentioned CONFIG_LD_DEAD_CODE_DATA_ELIMINATION=y in the attached
dotconfig, the warnings and the fix are relevant only for this case.
> >
> > mipsel-linux-ld: warning: orphan section `.data.$Lubsan_data299' from
> > `init/do_mounts_rd.o' being placed in section `.data.$Lubsan_data299'
> > mipsel-linux-ld: warning: orphan section `.data.$Lubsan_data183' from
> > `init/do_mounts_rd.o' being placed in section `.data.$Lubsan_data183'
> > mipsel-linux-ld: warning: orphan section `.data.$Lubsan_type3' from
> > `init/do_mounts_rd.o' being placed in section `.data.$Lubsan_type3'
> > mipsel-linux-ld: warning: orphan section `.data.$Lubsan_type2' from
> > `init/do_mounts_rd.o' being placed in section `.data.$Lubsan_type2'
> > mipsel-linux-ld: warning: orphan section `.data.$Lubsan_type0' from
> > `init/do_mounts_rd.o' being placed in section `.data.$Lubsan_type0'
> >
> > [...]
> >
> > Seems like "unnamed data" isn't the only type of symbols that UBSAN
> > instrumentation can emit.
> > Catch these into .data with the wildcard as well.
> >
> > [0] https://lore.kernel.org/linux-mm/202102160741.k57GCNSR-lkp@intel.com
> >
> > Fixes: f41b233de0ae ("vmlinux.lds.h: catch UBSAN's "unnamed data" into data")
> > Reported-by: kernel test robot <lkp@intel.com>
> > Signed-off-by: Alexander Lobakin <alobakin@pm.me>
> > ---
> > include/asm-generic/vmlinux.lds.h | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
> > index cc659e77fcb0..83537e5ee78f 100644
> > --- a/include/asm-generic/vmlinux.lds.h
> > +++ b/include/asm-generic/vmlinux.lds.h
> > @@ -95,7 +95,7 @@
> > */
> > #ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
> > #define TEXT_MAIN .text .text.[0-9a-zA-Z_]*
> > -#define DATA_MAIN .data .data.[0-9a-zA-Z_]* .data..L* .data..compoundliteral* .data.$__unnamed_*
> > +#define DATA_MAIN .data .data.[0-9a-zA-Z_]* .data..L* .data..compoundliteral* .data.$__unnamed_* .data.$Lubsan_*
>
> Are these sections only created when
> CONFIG_LD_DEAD_CODE_DATA_ELIMINATION is selected? (Same with
> .data.$__unnamed_*)
>
> > #define SDATA_MAIN .sdata .sdata.[0-9a-zA-Z_]*
> > #define RODATA_MAIN .rodata .rodata.[0-9a-zA-Z_]* .rodata..L*
> > #define BSS_MAIN .bss .bss.[0-9a-zA-Z_]* .bss..compoundliteral*
> > --
> > 2.30.1
> >
> >
>
>
> --
> Thanks,
> ~Nick Desaulniers
Al
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-02-16 19:56 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-16 8:55 [PATCH mips-next] vmlinux.lds.h: catch more UBSAN symbols into .data Alexander Lobakin
2021-02-16 17:10 ` Thomas Bogendoerfer
2021-02-16 17:56 ` Nick Desaulniers
2021-02-16 18:54 ` Nathan Chancellor
2021-02-16 19:03 ` Alexander Lobakin
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).