Re: [BUG] CONFIG_KMSAN breaks objtool and building of the kernel

From: Alexander Potapenko

Date: Thu Jun 18 2026 - 04:46:49 EST


On Wed, Jun 17, 2026 at 8:47 PM Dmitry Voytik <voytikd@xxxxxxxxx> wrote:
>
> Hi Peter,
>
> On Wed, Jun 17, 2026 at 9:48 AM Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
> >
> > On Wed, Jun 17, 2026 at 12:14:26AM +0200, Dmitry Voytik wrote:
> > > Enabling CONFIG_KMSAN=y triggers the following build error:
> > > make LLVM=1 -j(nproc)
> > > SYNC include/config/auto.conf
> > > DESCEND objtool
> > > INSTALL libsubcmd_headers
> > > LD vmlinux.o
> > > vmlinux.o: warning: objtool: intel_pt_interrupt+0xde9: undefined stack state
> > > vmlinux.o: warning: objtool: folio_zero_user+0x7cc: undefined stack state
> > > vmlinux.o: error: objtool: intel_pt_interrupt+0xde4: unknown cfa base reg -1
> > > make[2]: *** [scripts/Makefile.vmlinux_o:76: vmlinux.o] Error 255
> > > make[2]: *** Deleting file 'vmlinux.o'
> > >
> > > ↪ git log --oneline | head -n1
> > > 062871f1371b (HEAD -> master, origin/master, origin/HEAD) Merge tag
> > > 'pinctrl-v7.1-3' of
> > > git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl
> > >
> > > ↪ clang --version
> > > clang version 22.1.6
> > > Target: x86_64-pc-linux-gnu
> > >
> > > Please let me know if you need my .config (basically, it's the default
> > > Arch Linux config + make oldconfg)
> >
> > Using v7.1-2765-g6b5a2b7d9bc1, clang-22.1.0 (debian) and defconfig+KMSAN, I
> > cannot reproduce :/
>
> Thanks for double checking that.
> Indeed, defconfig + KMSAN is OK.
>
> It took me quite some time to narrow down the following combinations:
> defconfig + CONFIG_KMSAN + CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT
> defconfig + CONFIG_KMSAN + CONFIG_DEBUG_INFO_DWARF4
> defconfig + CONFIG_KMSAN + CONFIG_DEBUG_INFO_DWARF5
>
> make mrproper
> make LLVM=1 defconfig
> ./scripts/config -e CONFIG_KMSAN -e CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT
> make LLVM=1 olddefconfig
> make LLVM=1 -j(nproc) vmlinux
>
> vmlinux.o: warning: objtool: folio_zero_user+0x801: undefined stack state
> vmlinux.o: error: objtool: folio_zero_user+0x801: unknown CFA base reg -1
> make[2]: *** [scripts/Makefile.vmlinux_o:76: vmlinux.o] Error 255
> make[2]: *** Deleting file 'vmlinux.o'
> make[1]: *** [/home/voyt/p/linux/Makefile:1326: vmlinux_o] Error 2
> make: *** [Makefile:248: __sub-make] Error 2

I could reproduce it on both 7.0 and 7.1, but it seems to be just
regular register pressure (caused by KMSAN instrumentation), not a
compiler bug.