Re: [PATCH 6.4 000/206] 6.4.11-rc1 review

Daniel Díaz
2023-08-14T18:13:39Z

Hello!

We see this warning on x86 (real machine and Qemu) with Clang:

-----8<-----
[ 1.364590] ------------[ cut here ]------------
[ 1.364685] missing return thunk: __ret+0x5/0x7e-__ret+0x0/0x7e: e9 f6 ff ff ff
[ 1.364691] WARNING: CPU: 0 PID: 0 at arch/x86/kernel/alternative.c:630 apply_returns+0x2c9/0x420
[ 1.366684] Modules linked in:
[ 1.367685] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 6.4.11-rc1 #1
[ 1.368684] Hardware name: Supermicro SYS-5019S-ML/X11SSH-F, BIOS 2.0b 07/27/2017
[ 1.369685] RIP: 0010:apply_returns+0x2c9/0x420
[ 1.370685] Code: ff ff 0f 0b e9 b5 fd ff ff c6 05 a8 97 fa 01 01 48 c7 c7 e6 b5 9f a7 4c 89 ee 4c 89 e2 b9 05 00 00 00 4d 89 e8 e8 57 c2 11 00 <0f> 0b e9 8d fd ff ff 4d 85 e4 0f 84 1f ff ff ff 48 c7 c7 bf 44 98
[ 1.371684] RSP: 0000:ffffffffa7c03e00 EFLAGS: 00010246
[ 1.372684] RAX: 8bcba40230adee00 RBX: ffffffffa8150ba4 RCX: ffffffffa7c72440
[ 1.373684] RDX: ffffffffa7c03c88 RSI: 00000000ffffdfff RDI: 0000000000000001
[ 1.374684] RBP: ffffffffa7c03ed8 R08: 0000000000001fff R09: ffffffffa7c726d0
[ 1.375684] R10: 0000000000005ffd R11: 0000000000000004 R12: ffffffffa7182140
[ 1.376684] R13: ffffffffa7182145 R14: ffffffffa8150b9c R15: ffffffffa71821f0
[ 1.377684] FS: 0000000000000000(0000) GS:ffff8adb1fc00000(0000) knlGS:0000000000000000
[ 1.378684] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 1.379684] CR2: ffff8ad8b7001000 CR3: 00000001f6640001 CR4: 00000000003706f0
[ 1.380684] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 1.381684] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[ 1.382684] Call Trace:
[ 1.383685] <TASK>
[ 1.384685] ? show_regs+0x61/0x70
[ 1.385685] ? __warn+0xce/0x1d0
[ 1.386684] ? apply_returns+0x2c9/0x420
[ 1.387685] ? report_bug+0x160/0x210
[ 1.388685] ? handle_bug+0x41/0x70
[ 1.389684] ? exc_invalid_op+0x1f/0x50
[ 1.390685] ? asm_exc_invalid_op+0x1f/0x30
[ 1.391684] ? srso_safe_ret+0x30/0x30
[ 1.392685] ? __ret+0x5/0x7e
[ 1.393684] ? zen_untrain_ret+0x1/0x1
[ 1.394685] ? apply_returns+0x2c9/0x420
[ 1.395685] ? __ret+0x5/0x7e
[ 1.396684] ? __ret+0x14/0x7e
[ 1.397684] ? __ret+0xa/0x7e
[ 1.398685] alternative_instructions+0x50/0x120
[ 1.399685] arch_cpu_finalize_init+0x30/0x60
[ 1.400684] start_kernel+0x30e/0x3e0
[ 1.401685] x86_64_start_reservations+0x28/0x30
[ 1.402684] x86_64_start_kernel+0xaf/0xc0
[ 1.403685] secondary_startup_64_no_verify+0x107/0x10b
[ 1.404685] </TASK>
[ 1.405685] ---[ end trace 0000000000000000 ]---
-----8>-----

Full log here of one of those instances:
https://lkft.validation.linaro.org/scheduler/job/6664660#L671

There is a ClangBuiltLinux issue addressing this [1]. Nathan refers Peter's second patch [2] in his series fixes this problem.

This was introduced in v6.4.9 (which we did not review). Clang builds failed for v6.4.10 [3][4] and are now fixed, so this is the first time we're seeing this warning.

Rest of the report as follows:

## Build
* kernel: 6.4.11-rc1
* git: https://gitlab.com/Linaro/lkft/mirrors/stable/linux-stable-rc
* git branch: linux-6.4.y
* git commit: 427a3a47257b870ef6dce995a40bb7aca1bfc6ec
* git describe: v6.4.10-207-g427a3a47257b
* test details: https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-6.4.y/build/v6.4.10-207-g427a3a47257b

## Test Regressions (compared to v6.4.10)
* x86, log-parser-boot
- check-kernel-warning

Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>

## No metric regressions (compared to v6.4.10)

## Test Fixes (compared to v6.4.10)
* x86_64, build
- clang-17-allmodconfig
- clang-17-lkftconfig
- clang-17-lkftconfig-compat
- clang-17-lkftconfig-kcsan
- clang-17-lkftconfig-no-kselftest-frag
- clang-17-x86_64_defconfig
- clang-lkftconfig
- clang-nightly-lkftconfig
- clang-nightly-lkftconfig-kselftest
- clang-nightly-x86_64_defconfig

## No metric fixes (compared to v6.4.10)

## Test result summary
total: 172870, pass: 149103, fail: 3038, skip: 20556, xfail: 173

## Build Summary
* arc: 5 total, 5 passed, 0 failed
* arm: 145 total, 144 passed, 1 failed
* arm64: 54 total, 52 passed, 2 failed
* i386: 41 total, 40 passed, 1 failed
* mips: 30 total, 28 passed, 2 failed
* parisc: 4 total, 4 passed, 0 failed
* powerpc: 38 total, 36 passed, 2 failed
* riscv: 26 total, 24 passed, 2 failed
* s390: 16 total, 14 passed, 2 failed
* sh: 14 total, 12 passed, 2 failed
* sparc: 8 total, 8 passed, 0 failed
* x86_64: 46 total, 45 passed, 1 failed

## Test suites summary
* boot
* kselftest-android
* kselftest-arm64
* kselftest-breakpoints
* kselftest-capabilities
* kselftest-cgroup
* kselftest-clone3
* kselftest-core
* kselftest-cpu-hotplug
* kselftest-cpufreq
* kselftest-drivers-dma-buf
* kselftest-efivarfs
* kselftest-exec
* kselftest-filesystems
* kselftest-filesystems-binderfs
* kselftest-filesystems-epoll
* kselftest-firmware
* kselftest-fpu
* kselftest-ftrace
* kselftest-futex
* kselftest-gpio
* kselftest-intel_pstate
* kselftest-ipc
* kselftest-ir
* kselftest-kcmp
* kselftest-kexec
* kselftest-kvm
* kselftest-lib
* kselftest-livepatch
* kselftest-membarrier
* kselftest-memfd
* kselftest-memory-hotplug
* kselftest-mincore
* kselftest-mount
* kselftest-mqueue
* kselftest-net
* kselftest-net-forwarding
* kselftest-net-mptcp
* kselftest-netfilter
* kselftest-nsfs
* kselftest-openat2
* kselftest-pid_namespace
* kselftest-pidfd
* kselftest-proc
* kselftest-pstore
* kselftest-ptrace
* kselftest-rseq
* kselftest-rtc
* kselftest-seccomp
* kselftest-sigaltstack
* kselftest-size
* kselftest-splice
* kselftest-static_keys
* kselftest-sync
* kselftest-sysctl
* kselftest-tc-testing
* kselftest-timens
* kselftest-timers
* kselftest-tmpfs
* kselftest-tpm2
* kselftest-user
* kselftest-user_events
* kselftest-vDSO
* kselftest-vm
* kselftest-watchdog
* kselftest-x86
* kselftest-zram
* kunit
* kvm-unit-tests
* libgpiod
* libhugetlbfs
* log-parser-boot
* log-parser-test
* ltp-cap_bounds
* ltp-commands
* ltp-containers
* ltp-controllers
* ltp-cpuhotplug
* ltp-crypto
* ltp-cve
* ltp-dio
* ltp-fcntl-locktests
* ltp-filecaps
* ltp-fs
* ltp-fs_bind
* ltp-fs_perms_simple
* ltp-fsx
* ltp-hugetlb
* ltp-io
* ltp-ipc
* ltp-math
* ltp-mm
* ltp-nptl
* ltp-pty
* ltp-sched
* ltp-securebits
* ltp-smoke
* ltp-syscalls
* ltp-tracing
* network-basic-tests
* perf
* rcutorture
* v4l2-compliance

Greetings!

Daniel Díaz
daniel.diaz@linaro.org

[1] https://github.com/ClangBuiltLinux/linux/issues/1911
[2] https://lore.kernel.org/20230809072200.543939260@infradead.org/
[3] https://lore.kernel.org/stable/CA+G9fYuoajK0n7RNhSqm-ycO6Md3W4ah_Sc=b_KVAQwY=Rt6YQ@mail.gmail.com/
[4] https://github.com/ClangBuiltLinux/linux/issues/1907

--
Linaro LKFT