1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 04:37:44 +00:00

Kernel: Set "pledge_violation" coredump metadata in REQUIRE_PROMISE()

Similar to LibC storing an assertion message before aborting, process
death by pledge violation now sets a "pledge_violation" key with the
respective pledge name as value in its coredump metadata, which the
CrashReporter will then show.
This commit is contained in:
Linus Groh 2021-01-20 20:10:13 +01:00 committed by Andreas Kling
parent 7e5c49b755
commit 678919e9c1
2 changed files with 6 additions and 0 deletions

View file

@ -499,6 +499,7 @@ public:
void unblock_waiters(Thread::WaitBlocker::UnblockFlags, u8 signal = 0);
Thread::WaitBlockCondition& wait_block_condition() { return m_wait_block_condition; }
HashMap<String, String>& coredump_metadata() { return m_coredump_metadata; }
const HashMap<String, String>& coredump_metadata() const { return m_coredump_metadata; }
PerformanceEventBuffer* perf_events() { return m_perf_event_buffer; }
@ -778,6 +779,8 @@ inline u32 Thread::effective_priority() const
&& !Process::current()->has_promised(Pledge::promise)) { \
dbgln("Has not pledged {}", #promise); \
cli(); \
Process::current()->coredump_metadata().set( \
"pledge_violation", #promise); \
Process::current()->crash(SIGABRT, 0); \
ASSERT_NOT_REACHED(); \
} \