1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 06:58:11 +00:00

Kernel: Add verification promise violations are propagated properly

This change adds a thread member variable to track if we have a pending
promise violation on a kernel thread. This ensures that all code
properly propagates promise violations up to the syscall handler.

Suggested-by: Andreas Kling <kling@serenityos.org>
This commit is contained in:
Brian Gianforcaro 2021-12-29 04:11:51 -08:00 committed by Andreas Kling
parent 54b9a4ec1e
commit 018dc4bb5c
3 changed files with 12 additions and 1 deletions

View file

@ -235,8 +235,13 @@ NEVER_INLINE void syscall_handler(TrapFrame* trap)
current_thread->die_if_needed();
// Crash any processes which have commited a promise violation during syscall handling.
if (result.is_error() && result.error().code() == EPROMISEVIOLATION)
if (result.is_error() && result.error().code() == EPROMISEVIOLATION) {
VERIFY(current_thread->is_promise_violation_pending());
current_thread->set_promise_violation_pending(false);
process.crash(SIGABRT, 0);
} else {
VERIFY(!current_thread->is_promise_violation_pending());
}
VERIFY(!g_scheduler_lock.is_locked_by_current_processor());
}