Commit 0c314a8
objtool: Fix stack overflow in validate_branch()
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.
Move that variable (and its tracing usage) to handle_insn_ops() and make
handle_insn_ops() noinline to keep its stack frame outside the recursive
call chain.
Reported-by: Nathan Chancellor <nathan@kernel.org>
Fixes: fcb268b ("objtool: Trace instruction state changes during function validation")
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://patch.msgid.link/21bb161c23ca0d8c942a960505c0d327ca2dc7dc.1764691895.git.jpoimboe@kernel.org
Closes: https://lore.kernel.org/20251201202329.GA3225984@ax1621 parent 4a26e70 commit 0c314a8
1 file changed
Lines changed: 13 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3282 | 3282 | | |
3283 | 3283 | | |
3284 | 3284 | | |
3285 | | - | |
3286 | | - | |
3287 | | - | |
| 3285 | + | |
| 3286 | + | |
| 3287 | + | |
3288 | 3288 | | |
| 3289 | + | |
3289 | 3290 | | |
3290 | | - | |
| 3291 | + | |
3291 | 3292 | | |
3292 | 3293 | | |
3293 | 3294 | | |
3294 | 3295 | | |
3295 | 3296 | | |
3296 | | - | |
| 3297 | + | |
3297 | 3298 | | |
3298 | 3299 | | |
3299 | 3300 | | |
| |||
3303 | 3304 | | |
3304 | 3305 | | |
3305 | 3306 | | |
3306 | | - | |
| 3307 | + | |
| 3308 | + | |
3307 | 3309 | | |
3308 | 3310 | | |
3309 | 3311 | | |
| |||
3319 | 3321 | | |
3320 | 3322 | | |
3321 | 3323 | | |
3322 | | - | |
| 3324 | + | |
| 3325 | + | |
| 3326 | + | |
| 3327 | + | |
3323 | 3328 | | |
3324 | 3329 | | |
3325 | 3330 | | |
| |||
3694 | 3699 | | |
3695 | 3700 | | |
3696 | 3701 | | |
3697 | | - | |
3698 | | - | |
3699 | 3702 | | |
3700 | 3703 | | |
3701 | 3704 | | |
| |||
3798 | 3801 | | |
3799 | 3802 | | |
3800 | 3803 | | |
3801 | | - | |
3802 | | - | |
3803 | | - | |
3804 | | - | |
3805 | | - | |
| 3804 | + | |
3806 | 3805 | | |
3807 | 3806 | | |
3808 | 3807 | | |
| |||
0 commit comments