mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +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:
parent
7e5c49b755
commit
678919e9c1
Notes:
sideshowbarker
2024-07-18 23:02:10 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/678919e9c14 Pull-request: https://github.com/SerenityOS/serenity/pull/5022
2 changed files with 6 additions and 0 deletions
|
@ -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(); \
|
||||
} \
|
||||
|
|
|
@ -57,6 +57,8 @@ struct [[gnu::packed]] ProcessInfo {
|
|||
// - "pid" (int)
|
||||
// - "termination_signal" (u8)
|
||||
// - "executable_path" (String)
|
||||
// - "arguments" (Vector<String>)
|
||||
// - "environment" (Vector<String>)
|
||||
char json_data[]; // Null terminated
|
||||
};
|
||||
|
||||
|
@ -91,6 +93,7 @@ struct [[gnu::packed]] Metadata {
|
|||
//
|
||||
// Well-known keys:
|
||||
// - "assertion": Used by LibC's __assertion_failed() to store assertion info
|
||||
// - "pledge_violation": Used by the Kernel's REQUIRE_PROMISE() to store pledge violation info
|
||||
char json_data[]; // Null terminated
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue