diff -ru linux-2.4.23-rc1/include/linux/sysctl.h linux-2.4.23-rc1_schedmlock/include/linux/sysctl.h --- linux-2.4.23-rc1/include/linux/sysctl.h 2003-11-16 14:18:07.000000000 +0100 +++ linux-2.4.23-rc1_schedmlock/include/linux/sysctl.h 2003-11-16 14:37:34.000000000 +0100 @@ -128,6 +128,7 @@ KERN_PPC_L3CR=57, /* l3cr register on PPC */ KERN_EXCEPTION_TRACE=58, /* boolean: exception trace */ KERN_CORE_SETUID=59, /* int: set to allow core dumps of setuid apps */ + KERN_GAKK=60, }; diff -ru linux-2.4.23-rc1/kernel/sched.c linux-2.4.23-rc1_schedmlock/kernel/sched.c --- linux-2.4.23-rc1/kernel/sched.c 2003-11-16 14:18:08.000000000 +0100 +++ linux-2.4.23-rc1_schedmlock/kernel/sched.c 2003-11-16 14:33:00.000000000 +0100 @@ -37,6 +37,8 @@ extern void tqueue_bh(void); extern void immediate_bh(void); +extern int enable_setschedandmlock; + /* * scheduler variables */ @@ -981,12 +983,18 @@ goto out_unlock; retval = -EPERM; - if ((policy == SCHED_FIFO || policy == SCHED_RR) && - !capable(CAP_SYS_NICE)) - goto out_unlock; - if ((current->euid != p->euid) && (current->euid != p->uid) && - !capable(CAP_SYS_NICE)) - goto out_unlock; + + if(enable_setschedandmlock==0){ + if ((policy == SCHED_FIFO || policy == SCHED_RR) && + !capable(CAP_SYS_NICE)) + goto out_unlock; + if ((current->euid != p->euid) && (current->euid != p->uid) && + !capable(CAP_SYS_NICE)) + goto out_unlock; + }else{ + if (policy == SCHED_RR && !capable(CAP_SYS_NICE)) + goto out_unlock; + } retval = 0; p->policy = policy; diff -ru linux-2.4.23-rc1/kernel/sysctl.c linux-2.4.23-rc1_schedmlock/kernel/sysctl.c --- linux-2.4.23-rc1/kernel/sysctl.c 2003-11-16 14:18:08.000000000 +0100 +++ linux-2.4.23-rc1_schedmlock/kernel/sysctl.c 2003-11-16 14:35:19.000000000 +0100 @@ -56,6 +56,8 @@ extern int laptop_mode; extern int block_dump; +extern int enable_setschedandmlock; + /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */ static int maxolduid = 65535; static int minolduid; @@ -275,6 +277,9 @@ {KERN_EXCEPTION_TRACE,"exception-trace", &exception_trace,sizeof(int),0644,NULL,&proc_dointvec}, #endif + {KERN_GAKK, "setschedandmlock", &enable_setschedandmlock, sizeof (int), + 0644, NULL, &proc_dointvec}, + {0} }; diff -ru linux-2.4.23-rc1/mm/mlock.c linux-2.4.23-rc1_schedmlock/mm/mlock.c --- linux-2.4.23-rc1/mm/mlock.c 2001-09-18 00:30:23.000000000 +0200 +++ linux-2.4.23-rc1_schedmlock/mm/mlock.c 2003-11-16 14:30:49.000000000 +0100 @@ -12,6 +12,8 @@ #include #include +int enable_setschedandmlock; + static inline int mlock_fixup_all(struct vm_area_struct * vma, int newflags) { spin_lock(&vma->vm_mm->page_table_lock); @@ -151,8 +153,11 @@ struct vm_area_struct * vma, * next; int error; - if (on && !capable(CAP_IPC_LOCK)) - return -EPERM; + if(enable_setschedandmlock==0){ + if (on && !capable(CAP_IPC_LOCK)) + return -EPERM; + } + len = PAGE_ALIGN(len); end = start + len; if (end < start) @@ -241,8 +246,9 @@ unsigned int def_flags; struct vm_area_struct * vma; - if (!capable(CAP_IPC_LOCK)) - return -EPERM; + if(enable_setschedandmlock==0) + if (!capable(CAP_IPC_LOCK)) + return -EPERM; def_flags = 0; if (flags & MCL_FUTURE)