Skip to content

Commit 452f1e8

Browse files
committed
rust: Mention that RUST_OPT_LEVEL_0/1 can cause excessive stack usage
At least on ppc64le, RUST_OPT_LEVEL_0/1 causes some functions to be generated that use up to 20KB of stack. This leads to stack overflow, which may exhibit as a panic: Kernel panic - not syncing: corrupted stack end detected inside scheduler CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.12.0-rc3+ #1 But may also cause other crashes, depending on what is overwritten by the overflow. Add a note to the Kconfig for RUST_OPT_LEVEL_0/1 that this can happen. Signed-off-by: Michael Ellerman <[email protected]>
1 parent cbc28c7 commit 452f1e8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/Kconfig.debug

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2607,12 +2607,18 @@ config RUST_OPT_LEVEL_0
26072607
directly). Use the corresponding configuration options to control
26082608
that instead, orthogonally.
26092609

2610+
Note this level may cause excessive stack usage, which can lead to stack
2611+
overflow and subsequent crashes.
2612+
26102613
config RUST_OPT_LEVEL_1
26112614
bool "Basic optimizations (-Copt-level=1)"
26122615
help
26132616
Useful for debugging without getting too lost, but without
26142617
the overhead and boilerplate of no optimizations at all.
26152618

2619+
Note this level may cause excessive stack usage, which can lead to stack
2620+
overflow and subsequent crashes.
2621+
26162622
config RUST_OPT_LEVEL_2
26172623
bool "Some optimizations (-Copt-level=2)"
26182624
help

0 commit comments

Comments
 (0)