Re: [PATCH] x86/mm: fix objtool failure with KMSAN enabled
Dmitry Voytik <[email protected]> Fri, 3 Jul 2026 12:34:14 +0200
| Newsgroups | org.kernel.vger.linux-toolchains,dev.linux.lists.llvm,org.kernel.vger.linux-kernel,org.kvack.linux-mm |
|---|---|
| Message-ID | <CAAX90H3Nw+=gKOxPXpOwvDrbvWzUjgtyGoRJhCwsWz61s2XbQw@mail.gmail.com> |
Hi Thomas, On Thu, Jul 2, 2026 at 10:05=E2=80=AFPM Thomas Gleixner <[email protected]> w= rote: > > On Thu, Jul 02 2026 at 21:46, Thomas Gleixner wrote: > > On Thu, Jul 02 2026 at 13:15, Peter Zijlstra wrote: > >> A quick test with folio_zero_user() seems to suggest the > >> ASM_CALL_CONSTRAINT movement (your patch) generates the same code for > >> defconfg as does the unmodified code. The change from the thread linke= d > >> above (input constraint on __builtin_frame_address(0)) generates > >> different code. > >> > >> A third option is to force FRAME_POINTER=3Dy for KMSAN builds -- for n= ow, > >> until clang is taught to be less insane. > > > > With FRAME_POINTER=3Dy I get now with clang-22 > > > > vmlinux.o: warning: objtool: folio_zero_user+0xa7b: stack state mismatc= h: reg1[4]=3D-1+0 reg2[4]=3D-2-336 > > vmlinux.o: warning: objtool: set_ftrace_ops_ro+0x64: relocation to !END= BR: machine_kexec_prepare+0x8f0 > > > > That's with your objtool patch applied. When I remove that then the > > folio_zero_user one goes away. The relocation to !ENDBR stays. > > > > Oh well... > > And none of this boots when KMSAN=3Dy .... Thanks for checking this! I wonder if we are debugging clang here because I just retested the patch w= ith CONFIG_FRAME_POINTER on the current Linus' tree and it works in my env: clang --version clang version 22.1.6 git pull -r git show -s --oneline -2 21f3d2b2069e (HEAD -> master) x86/mm: fix objtool failure with KMSAN enable= d d2c9a99135da (origin/master, origin/HEAD) Merge tag 'device-id-rework' of git://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux make mrproper make LLVM=3D1 defconfig ./scripts/config \ -e CONFIG_KMSAN \ -e CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT \ -e UNWINDER_FRAME_POINTER make LLVM=3D1 olddefconfig make LLVM=3D1 W=3Dce -j(nproc) bzImage grep -e CONFIG_KMSAN=3D -e CONFIG_FRAME_POINTER \ -e CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT .config CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=3Dy CONFIG_FRAME_POINTER=3Dy CONFIG_KMSAN=3Dy qemu-system-x86_64 \ -kernel arch/x86/boot/bzImage \ -accel kvm \ -append "console=3DttyS0" \ -nographic \ -m 8G -smp 4 \ -serial file:serial_out.log grep -e 'Linux version' -A1 -e KernelMemorySanitizer -e 'append a correct' serial_out.log [ 0.000000] Linux version 7.2.0-rc1-00009-gb0b29f0286be (voyt@voyt-laptop-dell) (clang version 22.1.6, LLD 22.1.6) #1 SMP PREEMPT_DYNAMIC Fri Jul 3 11:55:02 CEST 2026 [ 0.000000] Command line: console=3DttyS0 -- [ 0.218380] Starting KernelMemorySanitizer [ 0.218382] ATTENTION: KMSAN is a debugging tool! Do not use it on production machines! -- [ 4.037384] Please append a correct "root=3D" boot option; here are the available partitions: [ 4.037772] 0b00 1048575 sr0 Could another CONFIG_ be the culprit on your side? Or, has your clang version some different (buggy?) behaviour?