summaryrefslogtreecommitdiff
path: root/Kernel/Arch
diff options
context:
space:
mode:
authorBrian Gianforcaro <bgianf@serenityos.org>2021-11-20 00:45:14 -0800
committerAndreas Kling <kling@serenityos.org>2021-11-30 11:16:35 +0100
commita5cec06135be8415545765785a45227839ef2018 (patch)
tree27dc0588653f2657255f469b6b767eb4d47e093f /Kernel/Arch
parent4cc41ea186cb3983466ff6103afa236312ca8ddd (diff)
downloadserenity-a5cec06135be8415545765785a45227839ef2018.zip
Kernel: Handle string format error in page_fault_handler(..) :^)
Utilize the new KString::formatted to provide a fallback if formatting fails because of OOM or whatever reason.
Diffstat (limited to 'Kernel/Arch')
-rw-r--r--Kernel/Arch/x86/common/Interrupts.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/Kernel/Arch/x86/common/Interrupts.cpp b/Kernel/Arch/x86/common/Interrupts.cpp
index d5ddc1d2a6..64e41af52f 100644
--- a/Kernel/Arch/x86/common/Interrupts.cpp
+++ b/Kernel/Arch/x86/common/Interrupts.cpp
@@ -403,7 +403,9 @@ void page_fault_handler(TrapFrame* trap)
if (current_thread) {
auto& current_process = current_thread->process();
if (current_process.is_user_process()) {
- (void)current_process.try_set_coredump_property("fault_address"sv, String::formatted("{:p}", fault_address));
+ auto fault_address_string = KString::formatted("{:p}", fault_address);
+ auto fault_address_view = fault_address_string.is_error() ? ""sv : fault_address_string.value()->view();
+ (void)current_process.try_set_coredump_property("fault_address"sv, fault_address_view);
(void)current_process.try_set_coredump_property("fault_type"sv, fault.type() == PageFault::Type::PageNotPresent ? "NotPresent"sv : "ProtectionViolation"sv);
StringView fault_access;
if (fault.is_instruction_fetch())