2024-03-25 13:11:56

by kernel test robot

[permalink] [raw]
Subject: [linus:master] [x86/retpoline] 4461438a84: WARNING:at_arch/x86/kernel/cpu/bugs.c:#__warn_thunk


hi, Josh Poimboeuf,

the WARN_ONCE added in this commit was hit in our tests. below full report FYI.


Hello,

kernel test robot noticed "WARNING:at_arch/x86/kernel/cpu/bugs.c:#__warn_thunk" on:

commit: 4461438a8405e800f90e0e40409e5f3d07eed381 ("x86/retpoline: Ensure default return thunk isn't used at runtime")
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git master

[test failed on linus/master f6cef5f8c37f58a3bc95b3754c3ae98e086631ca]
[test failed on linux-next/master 2e93f143ca010a5013528e1cfdc895f024fe8c21]

in testcase: boot

compiler: gcc-12
test machine: qemu-system-x86_64 -enable-kvm -cpu SandyBridge -smp 2 -m 16G

(please refer to attached dmesg/kmsg for entire log/backtrace)


+-----------------------------------------------------+------------+------------+
| | 0911b8c52c | 4461438a84 |
+-----------------------------------------------------+------------+------------+
| WARNING:at_arch/x86/kernel/cpu/bugs.c:#__warn_thunk | 0 | 24 |
| RIP:__warn_thunk | 0 | 24 |
+-----------------------------------------------------+------------+------------+


If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-lkp/[email protected]


[ 8.964931][ T1] ------------[ cut here ]------------
[ 8.966085][ T1] Unpatched return thunk in use. This should not happen!
[ 8.967448][ T1] WARNING: CPU: 0 PID: 1 at arch/x86/kernel/cpu/bugs.c:2856 __warn_thunk (arch/x86/kernel/cpu/bugs.c:2856 (discriminator 3))
[ 8.968229][ T1] Modules linked in:
[ 8.969058][ T1] CPU: 0 PID: 1 Comm: swapper Tainted: G T 6.7.0-01738-g4461438a8405 #1 e41218aca9131c31f31eb52746294819f64dd29b
[ 8.971429][ T1] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
[ 8.973422][ T1] RIP: 0010:__warn_thunk (arch/x86/kernel/cpu/bugs.c:2856 (discriminator 3))
[ 8.974508][ T1] Code: 90 90 90 90 90 80 3d 75 0e eb 04 00 74 05 c3 cc cc cc cc 55 48 c7 c7 c0 da 02 84 c6 05 5f 0e eb 04 01 48 89 e5 e8 db 0d 0e 00 <0f> 0b 5d c3 cc cc cc cc cc cc cc 90 90 90 90 90 90 90 90 90 90 90
All code
========
0: 90 nop
1: 90 nop
2: 90 nop
3: 90 nop
4: 90 nop
5: 80 3d 75 0e eb 04 00 cmpb $0x0,0x4eb0e75(%rip) # 0x4eb0e81
c: 74 05 je 0x13
e: c3 ret
f: cc int3
10: cc int3
11: cc int3
12: cc int3
13: 55 push %rbp
14: 48 c7 c7 c0 da 02 84 mov $0xffffffff8402dac0,%rdi
1b: c6 05 5f 0e eb 04 01 movb $0x1,0x4eb0e5f(%rip) # 0x4eb0e81
22: 48 89 e5 mov %rsp,%rbp
25: e8 db 0d 0e 00 call 0xe0e05
2a:* 0f 0b ud2 <-- trapping instruction
2c: 5d pop %rbp
2d: c3 ret
2e: cc int3
2f: cc int3
30: cc int3
31: cc int3
32: cc int3
33: cc int3
34: cc int3
35: 90 nop
36: 90 nop
37: 90 nop
38: 90 nop
39: 90 nop
3a: 90 nop
3b: 90 nop
3c: 90 nop
3d: 90 nop
3e: 90 nop
3f: 90 nop

Code starting with the faulting instruction
===========================================
0: 0f 0b ud2
2: 5d pop %rbp
3: c3 ret
4: cc int3
5: cc int3
6: cc int3
7: cc int3
8: cc int3
9: cc int3
a: cc int3
b: 90 nop
c: 90 nop
d: 90 nop
e: 90 nop
f: 90 nop
10: 90 nop
11: 90 nop
12: 90 nop
13: 90 nop
14: 90 nop
15: 90 nop
[ 8.977710][ T1] RSP: 0000:ffffc9000001fd48 EFLAGS: 00010282
[ 8.978937][ T1] RAX: dffffc0000000000 RBX: 1ffff92000003fb7 RCX: ffffc9000001fb60
[ 8.980510][ T1] RDX: dffffc0000000000 RSI: 0000000000000000 RDI: ffffc9000001fac8
[ 8.982147][ T1] RBP: ffffc9000001fd48 R08: 0000000000000001 R09: fffff52000003f59
[ 8.983731][ T1] R10: ffffc9000001facf R11: 0000000000000001 R12: ffffffff85fdbcf0
[ 8.985364][ T1] R13: 0000000000000000 R14: dffffc0000000000 R15: ffffc9000001fe38
[ 8.987025][ T1] FS: 0000000000000000(0000) GS:ffffffff850d2000(0000) knlGS:0000000000000000
[ 8.988184][ T1] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 8.989452][ T1] CR2: ffff88843ffff000 CR3: 00000000050a6000 CR4: 00000000000406f0
[ 8.991078][ T1] Call Trace:
[ 8.991825][ T1] <TASK>
[ 8.992516][ T1] ? show_regs (arch/x86/kernel/dumpstack.c:479)
[ 8.993382][ T1] ? __warn (kernel/panic.c:677)
[ 8.994235][ T1] ? console_trylock (arch/x86/include/asm/atomic.h:23 include/linux/atomic/atomic-arch-fallback.h:457 include/linux/atomic/atomic-instrumented.h:33 kernel/printk/printk.c:347 kernel/printk/printk.c:2612 kernel/printk/printk.c:2657)
[ 8.995222][ T1] ? __warn_thunk (arch/x86/kernel/cpu/bugs.c:2856 (discriminator 3))
[ 8.996179][ T1] ? report_bug (lib/bug.c:180 lib/bug.c:219)
[ 8.997120][ T1] ? vprintk_emit (kernel/printk/printk.c:2303)
[ 8.997962][ T1] ? handle_bug (arch/x86/kernel/traps.c:237)
[ 8.998826][ T1] ? exc_invalid_op (arch/x86/kernel/traps.c:258 (discriminator 1))
[ 8.999813][ T1] ? asm_exc_invalid_op (arch/x86/include/asm/idtentry.h:568)
[ 9.000845][ T1] ? ia32_binfmt_init (kbuild/obj/consumer/x86_64-randconfig-a005-20230528/arch/x86/entry/vdso/vdso-image-64.c:508)
[ 9.001794][ T1] ? __warn_thunk (arch/x86/kernel/cpu/bugs.c:2856 (discriminator 3))
[ 9.002723][ T1] ? __warn_thunk (arch/x86/kernel/cpu/bugs.c:2856 (discriminator 3))
[ 9.003698][ T1] warn_thunk_thunk (arch/x86/entry/entry.S:26)
[ 9.004689][ T1] ? apply_alternatives (arch/x86/kernel/alternative.c:508 (discriminator 156))
[ 9.005745][ T1] ? optimize_nops_inplace (arch/x86/include/asm/irqflags.h:42 (discriminator 1) arch/x86/include/asm/irqflags.h:77 (discriminator 1) arch/x86/include/asm/irqflags.h:135 (discriminator 1) arch/x86/kernel/alternative.c:264 (discriminator 1))
[ 9.006664][ T1] do_one_initcall (init/main.c:1236)
[ 9.007562][ T1] ? __pfx_do_one_initcall (init/main.c:1227)
[ 9.007960][ T1] ? __pfx_parse_args (kernel/params.c:171)
[ 9.008957][ T1] ? __kmalloc (include/trace/events/kmem.h:54 mm/slub.c:3982 mm/slub.c:3994)
[ 9.009894][ T1] ? do_initcalls (init/main.c:1308)
[ 9.010835][ T1] do_initcalls (init/main.c:1297 init/main.c:1314)
[ 9.011777][ T1] kernel_init_freeable (init/main.c:1555)
[ 9.012872][ T1] ? __pfx_kernel_init (init/main.c:1433)
[ 9.013875][ T1] ? __pfx_kernel_init (init/main.c:1433)
[ 9.014892][ T1] kernel_init (init/main.c:1443)
[ 9.015752][ T1] ? __switch_to_asm (arch/x86/entry/entry_64.S:203)
[ 9.016746][ T1] ret_from_fork (arch/x86/kernel/process.c:153)
[ 9.017637][ T1] ? __pfx_kernel_init (init/main.c:1433)
[ 9.018667][ T1] ret_from_fork_asm (arch/x86/entry/entry_64.S:250)
[ 9.019632][ T1] </TASK>
[ 9.020297][ T1] irq event stamp: 0
[ 9.021144][ T1] hardirqs last enabled at (0): 0x0
[ 9.022509][ T1] hardirqs last disabled at (0): copy_process (kernel/fork.c:2439)
[ 9.024326][ T1] softirqs last enabled at (0): copy_process (kernel/fork.c:2440)
[ 9.026138][ T1] softirqs last disabled at (0): 0x0
[ 9.027536][ T1] ---[ end trace 0000000000000000 ]---



The kernel config and materials to reproduce are available at:
https://download.01.org/0day-ci/archive/20240325/[email protected]



--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki



Subject: [tip: x86/urgent] x86/vdso: Fix rethunk patching for vdso-image-x32.o too

The following commit has been merged into the x86/urgent branch of tip:

Commit-ID: 4969d75dd9077e19e175e60f3c5a6c7653252e63
Gitweb: https://git.kernel.org/tip/4969d75dd9077e19e175e60f3c5a6c7653252e63
Author: Borislav Petkov (AMD) <[email protected]>
AuthorDate: Tue, 26 Mar 2024 10:47:14 +01:00
Committer: Borislav Petkov (AMD) <[email protected]>
CommitterDate: Tue, 26 Mar 2024 10:47:14 +01:00

x86/vdso: Fix rethunk patching for vdso-image-x32.o too

In a similar fashion to

b388e57d4628 ("x86/vdso: Fix rethunk patching for vdso-image-{32,64}.o")

annotate vdso-image-x32.o too for objtool so that it gets annotated
properly and the unused return thunk warning doesn't fire.

Reported-by: kernel test robot <[email protected]>
Closes: https://lore.kernel.org/oe-lkp/[email protected]
Signed-off-by: Borislav Petkov (AMD) <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
---
arch/x86/entry/vdso/Makefile | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/x86/entry/vdso/Makefile b/arch/x86/entry/vdso/Makefile
index fd63051..3d64bcc 100644
--- a/arch/x86/entry/vdso/Makefile
+++ b/arch/x86/entry/vdso/Makefile
@@ -41,6 +41,7 @@ obj-$(CONFIG_X86_X32_ABI) += vdso-image-x32.o
obj-$(CONFIG_COMPAT_32) += vdso-image-32.o vdso32-setup.o

OBJECT_FILES_NON_STANDARD_vdso-image-32.o := n
+OBJECT_FILES_NON_STANDARD_vdso-image-x32.o := n
OBJECT_FILES_NON_STANDARD_vdso-image-64.o := n
OBJECT_FILES_NON_STANDARD_vdso32-setup.o := n