mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:17:35 +00:00
Kernel+SystemServer+CrashDaemon: Better control where we put core dumps
SystemServer now creates the /tmp/coredump and /tmp/profiler_coredumps directories at startup, ensuring that they are owned by root, and with basic 0755 permissions. The kernel will also now refuse to put core dumps in a directory that doesn't fulfill the following criteria: - Owned by 0:0 - Directory with sticky bit not set - 0755 permissions Fixes #4435 Fixes #4850
This commit is contained in:
parent
f152b6f7ed
commit
190e0e1551
3 changed files with 40 additions and 12 deletions
|
@ -192,6 +192,30 @@ static void create_tmp_rpc_directory()
|
|||
umask(old_umask);
|
||||
}
|
||||
|
||||
static void create_tmp_coredump_directory()
|
||||
{
|
||||
dbgln("Creating /tmp/coredump directory");
|
||||
auto old_umask = umask(0);
|
||||
auto rc = mkdir("/tmp/coredump", 0755);
|
||||
if (rc < 0) {
|
||||
perror("mkdir(/tmp/coredump)");
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
umask(old_umask);
|
||||
}
|
||||
|
||||
static void create_tmp_profiler_coredumps_directory()
|
||||
{
|
||||
dbgln("Creating /tmp/profiler_coredumps directory");
|
||||
auto old_umask = umask(0);
|
||||
auto rc = mkdir("/tmp/profiler_coredumps", 0755);
|
||||
if (rc < 0) {
|
||||
perror("mkdir(/tmp/profiler_coredumps)");
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
umask(old_umask);
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
prepare_devfs();
|
||||
|
@ -203,6 +227,8 @@ int main(int, char**)
|
|||
|
||||
mount_all_filesystems();
|
||||
create_tmp_rpc_directory();
|
||||
create_tmp_coredump_directory();
|
||||
create_tmp_profiler_coredumps_directory();
|
||||
parse_boot_mode();
|
||||
|
||||
Core::EventLoop event_loop;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue