From 1a7d6508e37d598fbd050589a059342c8ce3eaf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?kleines=20Filmr=C3=B6llchen?= Date: Fri, 2 Sep 2022 20:59:01 +0200 Subject: [PATCH] Kernel: By default, don't dump regions when a userspace crash happens There is the DUMP_REGIONS_ON_CRASH debug macro which re-enables this (old) behavior. --- Kernel/Debug.h.in | 4 ++++ Kernel/Process.cpp | 4 +++- Meta/CMake/all_the_debug_macros.cmake | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Kernel/Debug.h.in b/Kernel/Debug.h.in index 04f814867b..b12b5f03a9 100644 --- a/Kernel/Debug.h.in +++ b/Kernel/Debug.h.in @@ -55,6 +55,10 @@ #cmakedefine01 CONTIGUOUS_VMOBJECT_DEBUG #endif +#ifndef DUMP_REGIONS_ON_CRASH +#cmakedefine01 DUMP_REGIONS_ON_CRASH +#endif + #ifndef E1000_DEBUG #cmakedefine01 E1000_DEBUG #endif diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index 19227ea138..63b9bb0b12 100644 --- a/Kernel/Process.cpp +++ b/Kernel/Process.cpp @@ -412,7 +412,9 @@ void Process::crash(int signal, FlatPtr ip, bool out_of_memory) protected_data.termination_signal = signal; }); set_should_generate_coredump(!out_of_memory); - address_space().with([](auto& space) { space->dump_regions(); }); + if constexpr (DUMP_REGIONS_ON_CRASH) { + address_space().with([](auto& space) { space->dump_regions(); }); + } VERIFY(is_user_process()); die(); // We can not return from here, as there is nowhere diff --git a/Meta/CMake/all_the_debug_macros.cmake b/Meta/CMake/all_the_debug_macros.cmake index 7af4b6e31a..738c244d45 100644 --- a/Meta/CMake/all_the_debug_macros.cmake +++ b/Meta/CMake/all_the_debug_macros.cmake @@ -36,6 +36,7 @@ set(DIFF_DEBUG ON) set(DISASM_DUMP_DEBUG ON) set(DOUBLECLICK_DEBUG ON) set(DRAG_DEBUG ON) +set(DUMP_REGIONS_ON_CRASH ON) set(DWARF_DEBUG ON) set(DYNAMIC_LOAD_DEBUG ON) set(E1000_DEBUG ON)