Merge branch 'writable_limits' of git://decibel.fi.muni.cz/~xslaby/linux
* 'writable_limits' of git://decibel.fi.muni.cz/~xslaby/linux: unistd: add __NR_prlimit64 syscall numbers rlimits: implement prlimit64 syscall rlimits: switch more rlimit syscalls to do_prlimit rlimits: redo do_setrlimit to more generic do_prlimit rlimits: add rlimit64 structure rlimits: do security check under task_lock rlimits: allow setrlimit to non-current tasks rlimits: split sys_setrlimit rlimits: selinux, do rlimits changes under task_lock rlimits: make sure ->rlim_max never grows in sys_setrlimit rlimits: add task_struct to update_rlimit_cpu rlimits: security, add task_struct to setrlimit Fix up various system call number conflicts. We not only added fanotify system calls in the meantime, but asm-generic/unistd.h added a wait4 along with a range of reserved per-architecture system calls.
This commit is contained in:
@@ -2284,12 +2284,15 @@ static void selinux_bprm_committing_creds(struct linux_binprm *bprm)
|
||||
rc = avc_has_perm(new_tsec->osid, new_tsec->sid, SECCLASS_PROCESS,
|
||||
PROCESS__RLIMITINH, NULL);
|
||||
if (rc) {
|
||||
/* protect against do_prlimit() */
|
||||
task_lock(current);
|
||||
for (i = 0; i < RLIM_NLIMITS; i++) {
|
||||
rlim = current->signal->rlim + i;
|
||||
initrlim = init_task.signal->rlim + i;
|
||||
rlim->rlim_cur = min(rlim->rlim_max, initrlim->rlim_cur);
|
||||
}
|
||||
update_rlimit_cpu(current->signal->rlim[RLIMIT_CPU].rlim_cur);
|
||||
task_unlock(current);
|
||||
update_rlimit_cpu(current, rlimit(RLIMIT_CPU));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3333,16 +3336,17 @@ static int selinux_task_getioprio(struct task_struct *p)
|
||||
return current_has_perm(p, PROCESS__GETSCHED);
|
||||
}
|
||||
|
||||
static int selinux_task_setrlimit(unsigned int resource, struct rlimit *new_rlim)
|
||||
static int selinux_task_setrlimit(struct task_struct *p, unsigned int resource,
|
||||
struct rlimit *new_rlim)
|
||||
{
|
||||
struct rlimit *old_rlim = current->signal->rlim + resource;
|
||||
struct rlimit *old_rlim = p->signal->rlim + resource;
|
||||
|
||||
/* Control the ability to change the hard limit (whether
|
||||
lowering or raising it), so that the hard limit can
|
||||
later be used as a safe reset point for the soft limit
|
||||
upon context transitions. See selinux_bprm_committing_creds. */
|
||||
if (old_rlim->rlim_max != new_rlim->rlim_max)
|
||||
return current_has_perm(current, PROCESS__SETRLIMIT);
|
||||
return current_has_perm(p, PROCESS__SETRLIMIT);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user