1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-25 22:05:07 +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

@ -868,6 +868,7 @@ ErrorOr<void> Process::require_no_promises() const
if (!has_promises())
return {};
dbgln("Has made a promise");
Thread::current()->set_promise_violation_pending(true);
return EPROMISEVIOLATION;
}
@ -880,6 +881,7 @@ ErrorOr<void> Process::require_promise(Pledge promise)
return {};
dbgln("Has not pledged {}", to_string(promise));
Thread::current()->set_promise_violation_pending(true);
(void)try_set_coredump_property("pledge_violation"sv, to_string(promise));
return EPROMISEVIOLATION;
}