aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPer Larsen <perlarsen@google.com>2022-01-28 11:07:55 +0000
committerArmelle Laine <armellel@google.com>2023-07-21 09:49:23 +0000
commit99fa0468524c330ade10087f96ee2512c015975f (patch)
tree04af635187ceae6ec9c28b95608b9f06007f23e2 /lib
parent174d72365dbcd13d13e8bf250023fc66979ce272 (diff)
downloadcommon-99fa0468524c330ade10087f96ee2512c015975f.tar.gz
Reset thread cookie upon exit
Once a thread cookie has been corrupted, we cannot use the existing test facility to exit a thread on panics without resetting its cookie such that it can exit without triggering additional panics. We only do so for test threads that have the exit-on-panic flag set. If this flag is set, we are also more lenient w.r.t. the thread state. In thread_resched, the call to get_top_thread is moved past the first call to thread_cookie_check. This is necessary to cleanly exit a test thread with a corrupted cookie because thread_preempt might have put said thread at the head of its run queue. Bug: 215740695 Change-Id: I68a95cff523f323370c5fc55851679e146214684 Signed-off-by: Per Larsen <perlarsen@google.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/debug/debug.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/debug/debug.c b/lib/debug/debug.c
index 46d43588..10f330e9 100644
--- a/lib/debug/debug.c
+++ b/lib/debug/debug.c
@@ -62,7 +62,7 @@ void _panic(const char *fmt, ...)
dump_backtrace();
if (curr && thread_get_flag_exit_on_panic(curr)) {
- thread_exit(ERR_FAULT);
+ thread_exit_from_panic();
}
va_start(ap, fmt);