CKRM core
Subsystems (4)
PATCH 1/6 CKRM core
fs/exec.c +3 -0
@@ -46,6 +46,7 @@#include <linux/security.h> #include <linux/syscalls.h> #include <linux/rmap-locking.h> +#include <linux/ckrm.h> #include <asm/uaccess.h> #include <asm/pgalloc.h>
@@ -1151,6 +1152,8 @@ retval =search_binary_handler (&bprm,regs);if (retval >=0 ) {free_arg_pages (&bprm); + +ckrm_cb_exec (filename);/* execve success */ security_bprm_free (&bprm);
include/linux/ckrm.h new file +156 -0
156 lines not on this page · raw message
include/linux/ckrm_ce.h new file +91 -0
91 lines not on this page · raw message
include/linux/ckrm_rc.h new file +366 -0
366 lines not on this page · raw message
include/linux/sched.h +10 -0
@@ -493,6 +493,16 @@unsigned long ptrace_message;siginfo_t *last_siginfo;/* For ptrace use. */ + +#ifdef CONFIG_CKRM +spinlock_t ckrm_tsklock; +void *ce_data; +#ifdef CONFIG_CKRM_TYPE_TASKCLASS +// .. Hubertus should change to CONFIG_CKRM_TYPE_TASKCLASS +struct ckrm_task_class *taskclass; +struct list_head taskclass_link; +#endif // CONFIG_CKRM_TYPE_TASKCLASS +#endif // CONFIG_CKRM };static inline pid_t process_group (struct task_struct *tsk)
init/Kconfig +69 -0
75 lines not on this page · raw message
init/main.c +4 -0
@@ -46,6 +46,8 @@#include <asm/io.h> #include <asm/bugs.h> +#include <linux/ckrm.h> +/* * This is one of the first .c files built. Error out early * if we have compiler trouble..
@@ -431,6 +433,7 @@rcu_init ();init_IRQ ();pidhash_init (); +ckrm_init ();sched_init ();softirq_init ();time_init ();
@@ -479,6 +482,7 @@#ifdef CONFIG_PROC_FS proc_root_init ();#endif +check_bugs ();printk ("POSIX conformance testing by UNIFIX\n" );
kernel/Makefile +1 -1
@@ -7,7 +7,7 @@ sysctl.o capability.o ptrace.o timer.o user.o \ signal.o sys.o kmod.o workqueue.o pid.o \ rcupdate.o intermodule.o extable.o params.o posix-timers.o \ - kthread.o + kthread.o ckrm/ obj-$(CONFIG_FUTEX) += futex.o obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o
kernel/ckrm/Makefile new file +14 -0
@@ -0,0 +1,14 @@ +# +# Makefile for CKRM +# + +ifeq ($(CONFIG_CKRM),y) + obj-y = ckrm.o ckrmutils.o +endif + +obj-$(CONFIG_CKRM_TYPE_TASKCLASS) += ckrm_tc.o +obj-$(CONFIG_CKRM_RES_NUMTASKS) += ckrm_tasks.o + +obj-$(CONFIG_CKRM_TYPE_SOCKETCLASS) += ckrm_sockc.o +obj-$(CONFIG_CKRM_RES_LISTENAQ) += ckrm_listenaq.o +
kernel/ckrm/ckrm.c new file +1003 -0
1,003 lines not on this page · raw message
kernel/ckrm/ckrmutils.c new file +207 -0
207 lines not on this page · raw message
kernel/exit.c +5 -0
@@ -22,6 +22,8 @@#include <linux/profile.h> #include <linux/mount.h> #include <linux/proc_fs.h> +#include <linux/ckrm.h> +#include <linux/ckrm_tsk.h> #include <asm/uaccess.h> #include <asm/pgtable.h>
@@ -625,6 +627,8 @@int state;struct task_struct *t; +ckrm_cb_exit (tsk); +if (signal_pending (tsk) && !tsk->signal->group_exit && !thread_group_empty (tsk)) {/*
@@ -788,6 +792,7 @@module_put (tsk->binfmt->module); tsk->exit_code = code; +numtasks_put_ref (tsk->taskclass);exit_notify (tsk);schedule ();BUG ();
kernel/fork.c +11 -0
@@ -31,6 +31,8 @@#include <linux/futex.h> #include <linux/ptrace.h> #include <linux/mount.h> +#include <linux/ckrm.h> +#include <linux/ckrm_tsk.h> #include <asm/pgtable.h> #include <asm/pgalloc.h>
@@ -256,6 +258,7 @@ tsk->thread_info = ti; ti->task = tsk; +ckrm_cb_newtask (tsk);/* One for us, one for whoever does the "release_task()" (usually parent) */ atomic_set (&tsk->usage,2 );return tsk;
@@ -1143,6 +1146,10 @@ clone_flags |=CLONE_PTRACE ; } +if (numtasks_get_ref (current->taskclass,0 ) ==0 ) { +return -ENOMEM ; + } + p =copy_process (clone_flags, stack_start, regs, stack_size, parent_tidptr, child_tidptr);/* * Do this prior waking up the new thread - the thread pointer
@@ -1153,6 +1160,8 @@if (!IS_ERR (p)) {struct completion vfork; +ckrm_cb_fork (p); +if (clone_flags &CLONE_VFORK ) { p->vfork_done = &vfork;init_completion (&vfork);
@@ -1187,6 +1196,8 @@* COW overhead when the child exec()s afterwards. */ set_need_resched (); + }else { +numtasks_put_ref (current->taskclass); }return pid; }
kernel/sys.c +16 -0
@@ -23,6 +23,7 @@#include <linux/security.h> #include <linux/dcookies.h> #include <linux/suspend.h> +#include <linux/ckrm.h> #include <asm/uaccess.h> #include <asm/io.h>
@@ -582,6 +583,9 @@ current->fsgid = new_egid; current->egid = new_egid; current->gid = new_rgid; + +ckrm_cb_gid (); +return 0 ; }
@@ -619,6 +623,9 @@ }else return -EPERM ; + +ckrm_cb_gid (); +return 0 ; }
@@ -707,6 +714,8 @@ current->suid = current->euid; current->fsuid = current->euid; +ckrm_cb_uid (); +return security_task_post_setuid (old_ruid, old_euid, old_suid,LSM_SETID_RE ); }
@@ -752,6 +761,8 @@ current->fsuid = current->euid = uid; current->suid = new_suid; +ckrm_cb_uid (); +return security_task_post_setuid (old_ruid, old_euid, old_suid,LSM_SETID_ID ); }
@@ -798,6 +809,8 @@if (suid != (uid_t) -1 ) current->suid = suid; +ckrm_cb_uid (); +return security_task_post_setuid (old_ruid, old_euid, old_suid,LSM_SETID_RES ); }
@@ -847,5 +860,8 @@ current->gid = rgid;if (sgid != (gid_t) -1 ) current->sgid = sgid; + +ckrm_cb_gid (); +return 0 ; }