1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:38:11 +00:00

Kernel: Abort core dump generation if any substep fails

And make an effort to propagate errors out from the inner parts.
This fixes an issue where the kernel would infinitely loop in coredump
generation if the TmpFS filled up.
This commit is contained in:
Andreas Kling 2020-12-22 09:59:14 +01:00
parent 531c3fe72e
commit 2dfe5751f3
4 changed files with 52 additions and 24 deletions

View file

@ -60,10 +60,14 @@ int Process::sys$profiling_disable(pid_t pid)
// We explicitly unlock here because we can't hold the lock when writing the coredump VFS
lock.unlock();
if (auto coredump = CoreDump::create(*process, String::formatted("/tmp/profiler_coredumps/{}", pid)))
coredump->write();
else
if (auto coredump = CoreDump::create(*process, String::formatted("/tmp/profiler_coredumps/{}", pid))) {
auto result = coredump->write();
if (result.is_error())
return result.error();
} else {
// FIXME: Return an error maybe?
dbgln("Unable to create profiler coredump for PID {}", pid);
}
return 0;
}