]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
rust: mention that RUST_OPT_LEVEL_0/1 can cause excessive stack usage
authorMichael Ellerman <mpe@ellerman.id.au>
Tue, 13 Apr 2021 13:38:00 +0000 (23:38 +1000)
committerMiguel Ojeda <ojeda@kernel.org>
Tue, 27 Apr 2021 03:06:13 +0000 (05:06 +0200)
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 <mpe@ellerman.id.au>
[normalized title]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
lib/Kconfig.debug

index acf4993baddc481b36609785c92392612242ae4d..3f5924c153687125f31055aedc478a9b302e82ac 100644 (file)
@@ -2607,12 +2607,18 @@ config RUST_OPT_LEVEL_0
          directly). Use the corresponding configuration options to control
          that instead, orthogonally.
 
+         Note this level may cause excessive stack usage, which can lead to stack
+         overflow and subsequent crashes.
+
 config RUST_OPT_LEVEL_1
        bool "Basic optimizations (-Copt-level=1)"
        help
          Useful for debugging without getting too lost, but without
          the overhead and boilerplate of no optimizations at all.
 
+         Note this level may cause excessive stack usage, which can lead to stack
+         overflow and subsequent crashes.
+
 config RUST_OPT_LEVEL_2
        bool "Some optimizations (-Copt-level=2)"
        help