summaryrefslogtreecommitdiff
path: root/Kernel/Syscalls/execve.cpp
diff options
context:
space:
mode:
authorGunnar Beutner <gbeutner@serenityos.org>2021-05-13 13:09:00 +0200
committerAndreas Kling <kling@serenityos.org>2021-05-19 22:51:42 +0200
commit277f333b2bbf2ca24d0d4c7695edbaed21dc0ba3 (patch)
tree8b66ccf59698ae554250ccf9163f9d42ec0e4ae4 /Kernel/Syscalls/execve.cpp
parent572bbf28ccd1cd5f8e4f17a38d0fbd989b1d56bf (diff)
downloadserenity-277f333b2bbf2ca24d0d4c7695edbaed21dc0ba3.zip
Kernel: Add support for profiling kmalloc()/kfree()
Diffstat (limited to 'Kernel/Syscalls/execve.cpp')
-rw-r--r--Kernel/Syscalls/execve.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/Kernel/Syscalls/execve.cpp b/Kernel/Syscalls/execve.cpp
index 7abfba809e..25ca3f8dfc 100644
--- a/Kernel/Syscalls/execve.cpp
+++ b/Kernel/Syscalls/execve.cpp
@@ -530,7 +530,13 @@ KResult Process::do_exec(NonnullRefPtr<FileDescription> main_program_description
set_dumpable(!executable_is_setid);
- m_space = load_result.space.release_nonnull();
+ {
+ // We must disable global profiling (especially kfree tracing) here because
+ // we might otherwise end up walking the stack into the process' space that
+ // is about to be destroyed.
+ TemporaryChange global_profiling_disabler(g_profiling_all_threads, false);
+ m_space = load_result.space.release_nonnull();
+ }
MemoryManager::enter_space(*m_space);
auto signal_trampoline_region = m_space->allocate_region_with_vmobject(signal_trampoline_range.value(), g_signal_trampoline_region->vmobject(), 0, "Signal trampoline", PROT_READ | PROT_EXEC, true);