summaryrefslogtreecommitdiff
path: root/Kernel/init.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2020-01-10 23:14:04 +0100
committerAndreas Kling <awesomekling@gmail.com>2020-01-10 23:14:04 +0100
commitddd0b192819b3d782682a47e463dc30ee29c739e (patch)
treefe41d3324c1cdf8dfd191d2c8b889c331e86bf2f /Kernel/init.cpp
parent944fbf507aaaa206e354d36e2a20a75ad5924a7c (diff)
downloadserenity-ddd0b192819b3d782682a47e463dc30ee29c739e.zip
Kernel: Add a basic chroot() syscall :^)
The chroot() syscall now allows the superuser to isolate a process into a specific subtree of the filesystem. This is not strictly permanent, as it is also possible for a superuser to break *out* of a chroot, but it is a useful mechanism for isolating unprivileged processes. The VFS now uses the current process's root_directory() as the root for path resolution purposes. The root directory is stored as an uncached Custody in the Process object.
Diffstat (limited to 'Kernel/init.cpp')
-rw-r--r--Kernel/init.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/Kernel/init.cpp b/Kernel/init.cpp
index b7df3d8691..8022facf29 100644
--- a/Kernel/init.cpp
+++ b/Kernel/init.cpp
@@ -145,6 +145,8 @@ VFS* vfs;
hang();
}
+ current->process().set_root_directory(vfs->root_custody());
+
dbgprintf("Load ksyms\n");
load_ksyms();
dbgprintf("Loaded ksyms\n");