summaryrefslogtreecommitdiff
path: root/Kernel/Arch/i386/CPU.h
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-05-06 21:11:38 +0200
committerAndreas Kling <kling@serenityos.org>2020-05-06 22:28:23 +0200
commit6fe83b0ac4f734f0dfe159b99136a4c56c83a7d0 (patch)
tree00f7b5bbca6b6506413c95821e8ecb3e6c2f9002 /Kernel/Arch/i386/CPU.h
parentc633c1c2eab688284d9339a8c6dfab525e776aca (diff)
downloadserenity-6fe83b0ac4f734f0dfe159b99136a4c56c83a7d0.zip
Kernel: Crash the current process on OOM (instead of panicking kernel)
This patch adds PageFaultResponse::OutOfMemory which informs the fault handler that we were unable to allocate a necessary physical page and cannot continue. In response to this, the kernel will crash the current process. Because we are OOM, we can't symbolicate the crash like we normally would (since the ELF symbolication code needs to allocate), so we also communicate to Process::crash() that we're out of memory. Now we can survive "allocate 300 MB" (only the allocate process dies.) This is definitely not perfect and can easily end up killing a random innocent other process who happened to allocate one page at the wrong time, but it's a *lot* better than panicking on OOM. :^)
Diffstat (limited to 'Kernel/Arch/i386/CPU.h')
-rw-r--r--Kernel/Arch/i386/CPU.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/Kernel/Arch/i386/CPU.h b/Kernel/Arch/i386/CPU.h
index 02f3162f8b..5b3b532122 100644
--- a/Kernel/Arch/i386/CPU.h
+++ b/Kernel/Arch/i386/CPU.h
@@ -265,7 +265,7 @@ u16 gdt_alloc_entry();
void gdt_free_entry(u16);
Descriptor& get_gdt_entry(u16 selector);
void write_gdt_entry(u16 selector, Descriptor&);
-void handle_crash(RegisterState&, const char* description, int signal);
+void handle_crash(RegisterState&, const char* description, int signal, bool out_of_memory = false);
[[noreturn]] static inline void hang()
{