diff --git a/Kernel/Process.h b/Kernel/Process.h index 1b5922d053..a78f519f6d 100644 --- a/Kernel/Process.h +++ b/Kernel/Process.h @@ -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& coredump_metadata() { return m_coredump_metadata; } const HashMap& 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(); \ } \ diff --git a/Userland/Libraries/LibELF/CoreDump.h b/Userland/Libraries/LibELF/CoreDump.h index 58ba114195..658b830217 100644 --- a/Userland/Libraries/LibELF/CoreDump.h +++ b/Userland/Libraries/LibELF/CoreDump.h @@ -57,6 +57,8 @@ struct [[gnu::packed]] ProcessInfo { // - "pid" (int) // - "termination_signal" (u8) // - "executable_path" (String) + // - "arguments" (Vector) + // - "environment" (Vector) 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 };