Re: [PATCH] objtool: Fix stack overflow in validate_branch()
From: Josh Poimboeuf
Date: Tue Dec 02 2025 - 11:49:41 EST
On Tue, Dec 02, 2025 at 05:20:22PM +0100, Ingo Molnar wrote:
>
> * Josh Poimboeuf <jpoimboe@xxxxxxxxxx> wrote:
>
> > On an allmodconfig kernel compiled with Clang, objtool is segfaulting in
> > drivers/scsi/qla2xxx/qla2xxx.o due to a stack overflow in
> > validate_branch().
> >
> > Due in part to KASAN being enabled, the qla2xxx code has a large number
> > of conditional jumps, causing objtool to go quite deep in its recursion.
> >
> > By far the biggest offender of stack usage is the recently added
> > 'prev_state' stack variable in validate_insn(), coming in at 328 bytes.
>
> That's weird - how can a user-space tool run into stack
> limits, are they set particularly conservatively?
On my Fedora system, "ulimit -s" is 8MB. You'd think that would be
enough :-)
In this case, objtool had over 20,000 stack frames caused by recursively
following over 7,000(!) conditional jumps in a single function.
> In any case, applied to tip:objtool/urgent, thanks!
Looks good now, thanks for fixing that up!
--
Josh