summaryrefslogtreecommitdiff
path: root/Kernel/API
diff options
context:
space:
mode:
authorLiav A <liavalb@gmail.com>2022-11-02 22:26:02 +0200
committerAndrew Kaster <andrewdkaster@gmail.com>2022-11-05 18:00:58 -0600
commit5e062414c11df31ed595c363990005eef00fa263 (patch)
tree62281b52f5408e4b3b814553e9cf18a234cc001e /Kernel/API
parentd69a0380e1558e82a6a0bda71e66eab121cdcda4 (diff)
downloadserenity-5e062414c11df31ed595c363990005eef00fa263.zip
Kernel: Add support for jails
Our implementation for Jails resembles much of how FreeBSD jails are working - it's essentially only a matter of using a RefPtr in the Process class to a Jail object. Then, when we iterate over all processes in various cases, we could ensure if either the current process is in jail and therefore should be restricted what is visible in terms of PID isolation, and also to be able to expose metadata about Jails in /sys/kernel/jails node (which does not reveal anything to a process which is in jail). A lifetime model for the Jail object is currently plain simple - there's simpy no way to manually delete a Jail object once it was created. Such feature should be carefully designed to allow safe destruction of a Jail without the possibility of releasing a process which is in Jail from the actual jail. Each process which is attached into a Jail cannot leave it until the end of a Process (i.e. when finalizing a Process). All jails are kept being referenced in the JailManagement. When a last attached process is finalized, the Jail is automatically destroyed.
Diffstat (limited to 'Kernel/API')
-rw-r--r--Kernel/API/Syscall.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/Kernel/API/Syscall.h b/Kernel/API/Syscall.h
index bb04e3da3c..4e40fdce16 100644
--- a/Kernel/API/Syscall.h
+++ b/Kernel/API/Syscall.h
@@ -107,6 +107,8 @@ enum class NeedsBigProcessLock {
S(inode_watcher_remove_watch, NeedsBigProcessLock::Yes) \
S(ioctl, NeedsBigProcessLock::Yes) \
S(join_thread, NeedsBigProcessLock::Yes) \
+ S(jail_create, NeedsBigProcessLock::No) \
+ S(jail_attach, NeedsBigProcessLock::No) \
S(kill, NeedsBigProcessLock::Yes) \
S(kill_thread, NeedsBigProcessLock::Yes) \
S(killpg, NeedsBigProcessLock::Yes) \
@@ -329,6 +331,15 @@ struct SC_setkeymap_params {
StringArgument map_name;
};
+struct SC_jail_create_params {
+ u64 index;
+ StringArgument name;
+};
+
+struct SC_jail_attach_params {
+ u64 index;
+};
+
struct SC_getkeymap_params {
u32* map;
u32* shift_map;