Re: objtool: undefined stack state in folio_zero_user()
From: Alexander Potapenko
Date: Tue Jun 30 2026 - 10:15:26 EST
> diff --git a/tools/objtool/check.c b/tools/objtool/check.c
> index 10b18cf9c360..53a67b322856 100644
> --- a/tools/objtool/check.c
> +++ b/tools/objtool/check.c
> @@ -3149,8 +3149,25 @@ static int update_cfi_state(struct instruction *insn,
> /* drap: mov disp(%rbp), %reg */
> restore_reg(cfi, op->dest.reg);
>
> + } else if (op->src.reg == CFI_SP &&
> + regs[CFI_SP].base == CFI_CFA &&
> + op->src.offset == regs[CFI_SP].offset + cfi->stack_size) {
> +
> + /*
> + * Clang RSP musical chains:
s/chains/chairs if you're going to submit that ;)
I am not sure we can do much on the compiler side here.
KMSAN just heavily increases register pressure, and this is how the
backend handles it.
We can't even influence it from the middle-end where the instrumentation occurs.
I remember Clang having more than one regallocator (we used to fall
back to PBQP for some huge files when instrumenting Chrome), but
switching to the non-default one will probably open a can of worms.