public inbox for linux-next@vger.kernel.org 
 help / color / mirror / Atom feed
* [syzbot] linux-next build error (20)
@ 2025-02-23  6:02 syzbot
  2025-03-19  5:10 ` Aleksandr Nogikh
  0 siblings, 1 reply; 4+ messages in thread
From: syzbot @ 2025-02-23  6:02 UTC (permalink / raw)
  To: linux-kernel, linux-next, sfr, syzkaller-bugs

Hello,

syzbot found the following issue on:

HEAD commit:    d4b0fd87ff0d Add linux-next specific files for 20250221
git tree:       linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=17a5bae4580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=76d7299d72819017
dashboard link: https://syzkaller.appspot.com/bug?extid=06fd1a3613c50d36129e
compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+06fd1a3613c50d36129e@syzkaller•appspotmail.com

<stdin>:4:15: error: use of undeclared identifier '__ref_stack_chk_guard'

---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups•com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

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

* Re: [syzbot] linux-next build error (20)
  2025-02-23  6:02 [syzbot] linux-next build error (20) syzbot
@ 2025-03-19  5:10 ` Aleksandr Nogikh
  2025-03-19  8:38   ` Ard Biesheuvel
  0 siblings, 1 reply; 4+ messages in thread
From: Aleksandr Nogikh @ 2025-03-19  5:10 UTC (permalink / raw)
  To: syzbot, brgerst
  Cc: linux-kernel, linux-next, sfr, syzkaller-bugs, Dmitry Vyukov,
	ardb

On Sat, Feb 22, 2025 at 10:02 PM syzbot
<syzbot+06fd1a3613c50d36129e@syzkaller•appspotmail.com> wrote:
>
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit:    d4b0fd87ff0d Add linux-next specific files for 20250221
> git tree:       linux-next
> console output: https://syzkaller.appspot.com/x/log.txt?x=17a5bae4580000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=76d7299d72819017
> dashboard link: https://syzkaller.appspot.com/bug?extid=06fd1a3613c50d36129e
> compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+06fd1a3613c50d36129e@syzkaller•appspotmail.com
>
> <stdin>:4:15: error: use of undeclared identifier '__ref_stack_chk_guard'

Manual bisection pointed to the commits from this patch series:

[PATCH v5 00/16] x86-64: Stack protector and percpu improvements
https://lore.kernel.org/lkml/20241105155801.1779119-1-brgerst@gmail.com/

Brian, could you please take a look at this syzbot report?

The latest build log (for next-20250318) is here:
https://syzkaller.appspot.com/text?tag=CrashLog&x=10a745e4580000

It failed with the following error:

<stdin>:4:15: error: use of undeclared identifier '__ref_stack_chk_guard'
EXPORT_SYMBOL(__ref_stack_chk_guard);
              ^
1 error generated.
make[4]: *** [scripts/Makefile.build:335: arch/x86/entry/entry.o] Error 1
make[4]: *** Deleting file 'arch/x86/entry/entry.o'
make[4]: *** Waiting for unfinished jobs....

-- 
Aleksandr


>
> ---
> This report is generated by a bot. It may contain errors.
> See https://goo.gl/tpsmEJ for more information about syzbot.
> syzbot engineers can be reached at syzkaller@googlegroups•com.
>
> syzbot will keep track of this issue. See:
> https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
>
> If the report is already addressed, let syzbot know by replying with:
> #syz fix: exact-commit-title
>
> If you want to overwrite report's subsystems, reply with:
> #syz set subsystems: new-subsystem
> (See the list of subsystem names on the web dashboard)
>
> If the report is a duplicate of another one, reply with:
> #syz dup: exact-subject-of-another-report
>
> If you want to undo deduplication, reply with:
> #syz undup
>
> --
> You received this message because you are subscribed to the Google Groups "syzkaller-bugs" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to syzkaller-bugs+unsubscribe@googlegroups•com.
> To view this discussion visit https://groups.google.com/d/msgid/syzkaller-bugs/67bab9f0.050a0220.bbfd1.000e.GAE%40google.com.

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

* Re: [syzbot] linux-next build error (20)
  2025-03-19  5:10 ` Aleksandr Nogikh
@ 2025-03-19  8:38   ` Ard Biesheuvel
  2025-03-19 18:45     ` Sami Tolvanen
  0 siblings, 1 reply; 4+ messages in thread
From: Ard Biesheuvel @ 2025-03-19  8:38 UTC (permalink / raw)
  To: Aleksandr Nogikh, Sami Tolvanen, Masahiro Yamada
  Cc: syzbot, brgerst, linux-kernel, linux-next, sfr, syzkaller-bugs,
	Dmitry Vyukov, Ingo Molnar

(cc Sami, Masahiro)

On Wed, 19 Mar 2025 at 06:10, Aleksandr Nogikh <nogikh@google•com> wrote:
>
> On Sat, Feb 22, 2025 at 10:02 PM syzbot
> <syzbot+06fd1a3613c50d36129e@syzkaller•appspotmail.com> wrote:
> >
> > Hello,
> >
> > syzbot found the following issue on:
> >
> > HEAD commit:    d4b0fd87ff0d Add linux-next specific files for 20250221
> > git tree:       linux-next
> > console output: https://syzkaller.appspot.com/x/log.txt?x=17a5bae4580000
> > kernel config:  https://syzkaller.appspot.com/x/.config?x=76d7299d72819017
> > dashboard link: https://syzkaller.appspot.com/bug?extid=06fd1a3613c50d36129e
> > compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
> >
> > IMPORTANT: if you fix the issue, please add the following tag to the commit:
> > Reported-by: syzbot+06fd1a3613c50d36129e@syzkaller•appspotmail.com
> >
> > <stdin>:4:15: error: use of undeclared identifier '__ref_stack_chk_guard'
>
> Manual bisection pointed to the commits from this patch series:
>
> [PATCH v5 00/16] x86-64: Stack protector and percpu improvements
> https://lore.kernel.org/lkml/20241105155801.1779119-1-brgerst@gmail.com/
>
> Brian, could you please take a look at this syzbot report?
>
> The latest build log (for next-20250318) is here:
> https://syzkaller.appspot.com/text?tag=CrashLog&x=10a745e4580000
>
> It failed with the following error:
>
> <stdin>:4:15: error: use of undeclared identifier '__ref_stack_chk_guard'
> EXPORT_SYMBOL(__ref_stack_chk_guard);
>               ^
> 1 error generated.
> make[4]: *** [scripts/Makefile.build:335: arch/x86/entry/entry.o] Error 1
> make[4]: *** Deleting file 'arch/x86/entry/entry.o'
> make[4]: *** Waiting for unfinished jobs....
>

This appears to be an interaction with gendwarfksyms:

# AS      arch/x86/entry/entry.o
  clang-15 -Wp,-MMD,arch/x86/entry/.entry.o.d -nostdinc
-I/usr/local/google/home/ardb/linux/arch/x86/include
-I./arch/x86/include/generated
-I/usr/local/google/home/ardb/linux/include -I./include
-I/usr/local/google/home/ardb/linux/arch/x86/include/uapi
-I./arch/x86/include/generated/uapi
-I/usr/local/google/home/ardb/linux/include/uapi
-I./include/generated/uapi -include
/usr/local/google/home/ardb/linux/include/linux/compiler-version.h
-include /usr/local/google/home/ardb/linux/include/linux/kconfig.h
-D__KERNEL__ --target=x86_64-linux-gnu -fintegrated-as
-Werror=unknown-warning-option -Werror=ignored-optimization-argument
-Werror=option-ignored -Werror=unused-command-line-argument
-fmacro-prefix-map=/usr/local/google/home/ardb/linux/= -D__ASSEMBLY__
-fno-PIE -m64 -g -gdwarf-4
-I/usr/local/google/home/ardb/linux/arch/x86/entry -Iarch/x86/entry
-DKBUILD_MODFILE='"arch/x86/entry/entry"' -DKBUILD_MODNAME='"entry"'
-D__KBUILD_MODNAME=kmod_entry -c -o arch/x86/entry/entry.o
/usr/local/google/home/ardb/linux/arch/x86/entry/entry.S
# cmd_gen_symversions_S arch/x86/entry/entry.o
  if llvm-nm-15 arch/x86/entry/entry.o 2>/dev/null | grep -q '
__export_symbol_'; then { echo "#include <linux/kernel.h>" ; echo
"#include <linux/string.h>" ; echo "#include <asm/asm-prototypes.h>" ;
llvm-nm-15 arch/x86/entry/entry.o | sed -n 's/.*
__export_symbol_\(.*\)/EXPORT_SYMBOL(\1);/p' ; } | clang-15 ... -c -o
arch/x86/entry/entry.gendwarfksyms.o -xc -; llvm-nm-15
arch/x86/entry/entry.o | sed -n 's/.* __export_symbol_\(.*\)/\1/p' |
./scripts/gendwarfksyms/gendwarfksyms
arch/x86/entry/entry.gendwarfksyms.o >> arch/x86/entry/.entry.o.cmd;
fi
<stdin>:4:15: error: use of undeclared identifier '__ref_stack_chk_guard'
EXPORT_SYMBOL(__ref_stack_chk_guard);
              ^
1 error generated.

The issue here is that we deliberately hide __ref_stack_chk_guard from
the compiler, because Clang will otherwise generate incorrect code.
[0]

I managed to work around this issue using the hack below, but I'm not
too familiar with the gendwarfksyms code, so I'll leave it up to Sami
and Masahiro to decide whether this is the right approach before
sending out a patch.


--- a/arch/x86/include/asm/asm-prototypes.h
+++ b/arch/x86/include/asm/asm-prototypes.h
@@ -20,6 +20,7 @@
 extern void cmpxchg8b_emu(void);
 #endif

-#if defined(__GENKSYMS__) && defined(CONFIG_STACKPROTECTOR)
+#if (defined(__GENKSYMS__) || defined(__GENDWARFKSYMS__)) \
+       && defined(CONFIG_STACKPROTECTOR)
 extern unsigned long __ref_stack_chk_guard;
 #endif

--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -311,7 +311,8 @@
 ifdef CONFIG_GENDWARFKSYMS
 cmd_gensymtypes_S =                                                    \
        $(getasmexports) |                                              \
-       $(CC) $(c_flags) -c -o $(@:.o=.gendwarfksyms.o) -xc -;          \
+       $(CC) -D__GENDWARFKSYMS__                                       \
+               $(c_flags) -c -o $(@:.o=.gendwarfksyms.o) -xc -;        \
        $(call getexportsymbols,\1) |                                   \
        $(gendwarfksyms) $(@:.o=.gendwarfksyms.o)
 else

(Note that simply #define'ing __GENKSYMS__ here and relying on that in
asm-prototypes.h doesn't work.)


[0] 577c134d311b ("x86/stackprotector: Work around strict Clang TLS
symbol requirements")

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

* Re: [syzbot] linux-next build error (20)
  2025-03-19  8:38   ` Ard Biesheuvel
@ 2025-03-19 18:45     ` Sami Tolvanen
  0 siblings, 0 replies; 4+ messages in thread
From: Sami Tolvanen @ 2025-03-19 18:45 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: Aleksandr Nogikh, Masahiro Yamada, syzbot, brgerst, linux-kernel,
	linux-next, sfr, syzkaller-bugs, Dmitry Vyukov, Ingo Molnar

Hi Ard,

On Wed, Mar 19, 2025 at 8:38 AM Ard Biesheuvel <ardb@kernel•org> wrote:
>
> The issue here is that we deliberately hide __ref_stack_chk_guard from
> the compiler, because Clang will otherwise generate incorrect code.
> [0]
>
> I managed to work around this issue using the hack below, but I'm not
> too familiar with the gendwarfksyms code, so I'll leave it up to Sami
> and Masahiro to decide whether this is the right approach before
> sending out a patch.
>
>
> --- a/arch/x86/include/asm/asm-prototypes.h
> +++ b/arch/x86/include/asm/asm-prototypes.h
> @@ -20,6 +20,7 @@
>  extern void cmpxchg8b_emu(void);
>  #endif
>
> -#if defined(__GENKSYMS__) && defined(CONFIG_STACKPROTECTOR)
> +#if (defined(__GENKSYMS__) || defined(__GENDWARFKSYMS__)) \
> +       && defined(CONFIG_STACKPROTECTOR)
>  extern unsigned long __ref_stack_chk_guard;
>  #endif
>
> --- a/scripts/Makefile.build
> +++ b/scripts/Makefile.build
> @@ -311,7 +311,8 @@
>  ifdef CONFIG_GENDWARFKSYMS
>  cmd_gensymtypes_S =                                                    \
>         $(getasmexports) |                                              \
> -       $(CC) $(c_flags) -c -o $(@:.o=.gendwarfksyms.o) -xc -;          \
> +       $(CC) -D__GENDWARFKSYMS__                                       \
> +               $(c_flags) -c -o $(@:.o=.gendwarfksyms.o) -xc -;        \
>         $(call getexportsymbols,\1) |                                   \
>         $(gendwarfksyms) $(@:.o=.gendwarfksyms.o)
>  else

The patch looks reasonable to me. Thanks for figuring this out!

Sami

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

end of thread, other threads:[~2025-03-19 18:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-23  6:02 [syzbot] linux-next build error (20) syzbot
2025-03-19  5:10 ` Aleksandr Nogikh
2025-03-19  8:38   ` Ard Biesheuvel
2025-03-19 18:45     ` Sami Tolvanen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox