summaryrefslogtreecommitdiffstats
path: root/sys/syscall_untyped.c
diff options
context:
space:
mode:
authorJon Santmyer <jon@jonsantmyer.com>2026-10-10 08:24:49 -0400
committerJon Santmyer <jon@jonsantmyer.com>2026-10-10 08:24:49 -0400
commitc5e3bb7917689bc9ed54fee23a143144fade802d (patch)
tree6e62dd4214e50387d94bd0c5f36a1392e842c8d7 /sys/syscall_untyped.c
parentbf4e93397dbf0647e767a72e98fb15d3b53f0373 (diff)
downloadjove-kernel-c5e3bb7917689bc9ed54fee23a143144fade802d.tar.gz
jove-kernel-c5e3bb7917689bc9ed54fee23a143144fade802d.tar.bz2
jove-kernel-c5e3bb7917689bc9ed54fee23a143144fade802d.zip
add check for pcb retype for correct rootdir layout
Diffstat (limited to 'sys/syscall_untyped.c')
-rw-r--r--sys/syscall_untyped.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sys/syscall_untyped.c b/sys/syscall_untyped.c
index 1ec21c7..c4378ea 100644
--- a/sys/syscall_untyped.c
+++ b/sys/syscall_untyped.c
@@ -1,8 +1,11 @@
+#include "api/process.h"
#include "arch/x86_64/hal/obj.h"
#include "hal/memory.h"
+#include "hal/obj.h"
#include "jove.h"
#include "lib/printf.h"
#include "proc/process.h"
+#include "sys/objdir.h"
#include "syscall.h"
static int
@@ -91,6 +94,10 @@ s_syscall_untyped_retype_pcb(jove_owned_obj_t *untyped_obj,
return -errno;
}
CHECK_OBJPERM(objdir_obj, JOVE_PERM_ALL, "New PCB needs full access to it's root objdir!");
+ if(!objdir_compare(objdir_obj.obj, PCB_ROOTDIR_SELF_I, obj_asunowned(untyped_obj))) {
+ klogf("Untyped is not in objdir entry %i\n", PCB_ROOTDIR_SELF_I);
+ return -EBADPATH;
+ }
obj_settype(untyped_obj, JOVE_OBJ_PCB);
return pcb_new(untyped_obj, untyped->limit, objdir_obj.obj);