summaryrefslogtreecommitdiff
path: root/Kernel/Process.cpp
diff options
context:
space:
mode:
authorBrian Gianforcaro <bgianf@serenityos.org>2021-12-29 04:11:51 -0800
committerAndreas Kling <kling@serenityos.org>2021-12-29 18:08:15 +0100
commit018dc4bb5ca7f67ed5a0acb8d51c9310371a2267 (patch)
treea4012dbdc29cd4b0b9099daf2bc15b12f2a3da5b /Kernel/Process.cpp
parent54b9a4ec1e7c08a99508d30d150fa17bfe1ee2dc (diff)
downloadserenity-018dc4bb5ca7f67ed5a0acb8d51c9310371a2267.zip
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>
Diffstat (limited to 'Kernel/Process.cpp')
-rw-r--r--Kernel/Process.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp
index 8496b68a08..3e9c70af93 100644
--- a/Kernel/Process.cpp
+++ b/Kernel/Process.cpp
@@ -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;
}