diff options
author | Rob Barnes <robbarnes@google.com> | 2023-05-03 16:26:59 -0600 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-05-11 17:59:48 +0000 |
commit | 26e4fe44baff34a40173581246b19f576e9597d5 (patch) | |
tree | 36528d14696d0ae13d0fda8b0e4ccc24f9a2f9f7 | |
parent | 18022d98d9905692debf7add00083c119f52547f (diff) | |
download | chrome-ec-26e4fe44baff34a40173581246b19f576e9597d5.tar.gz |
panic_output: Do not use ccprintf to induce stack overflow
The console command to induce a stack overflow crash uses ccprintf,
which acquires a mutex lock internally. The exception handler aborts
the thread (shell_uart) when the stack overflow is detected, but the
mutex is not released. This causes system safe mode to deadlock.
Switch to panic_printf to avoid this deadlock. A more robust long
term fix may be to change Zephyr internals to release mutexes on aborted
threads.
LOW_COVERAGE_REASON=Swapping single function call
BUG=b:278792557
TEST=Able to start system safe mode after a stack overflow on skyrim
Change-Id: Ib7b50487d27e77fdd5b6cec5176060074868dca3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4504115
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Boris Mittelberg <bmbm@google.com>
Auto-Submit: Rob Barnes <robbarnes@google.com>
Commit-Queue: Rob Barnes <robbarnes@google.com>
Tested-by: Rob Barnes <robbarnes@google.com>
-rw-r--r-- | common/panic_output.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/common/panic_output.c b/common/panic_output.c index a32303f52a..8dd5143277 100644 --- a/common/panic_output.c +++ b/common/panic_output.c @@ -329,7 +329,7 @@ DISABLE_GCC_WARNING("-Winfinite-recursion") #endif static void stack_overflow_recurse(int n) { - ccprintf("+%d", n); + panic_printf("+%d", n); /* * Force task context switch, since that's where we do stack overflow @@ -343,7 +343,7 @@ static void stack_overflow_recurse(int n) * Do work after the recursion, or else the compiler uses tail-chaining * and we don't actually consume additional stack. */ - ccprintf("-%d", n); + panic_printf("-%d", n); } ENABLE_CLANG_WARNING("-Winfinite-recursion") #if __GNUC__ >= 12 |