rlimits: switch more rlimit syscalls to do_prlimit
After we added more generic do_prlimit, switch sys_getrlimit to that. Also switch compat handling, so we can get rid of ugly __user casts and avoid setting process' address limit to kernel data and back. Signed-off-by: Jiri Slaby <jslaby@suse.cz>
This commit is contained in:
17
kernel/sys.c
17
kernel/sys.c
@@ -1236,15 +1236,14 @@ SYSCALL_DEFINE2(setdomainname, char __user *, name, int, len)
|
||||
|
||||
SYSCALL_DEFINE2(getrlimit, unsigned int, resource, struct rlimit __user *, rlim)
|
||||
{
|
||||
if (resource >= RLIM_NLIMITS)
|
||||
return -EINVAL;
|
||||
else {
|
||||
struct rlimit value;
|
||||
task_lock(current->group_leader);
|
||||
value = current->signal->rlim[resource];
|
||||
task_unlock(current->group_leader);
|
||||
return copy_to_user(rlim, &value, sizeof(*rlim)) ? -EFAULT : 0;
|
||||
}
|
||||
struct rlimit value;
|
||||
int ret;
|
||||
|
||||
ret = do_prlimit(current, resource, NULL, &value);
|
||||
if (!ret)
|
||||
ret = copy_to_user(rlim, &value, sizeof(*rlim)) ? -EFAULT : 0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef __ARCH_WANT_SYS_OLD_GETRLIMIT
|
||||
|
Reference in New Issue
Block a user