lkml.org 
[lkml]   [2009]   [Dec]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 15/16] COMPAT: add get/put_compat_rlimit
Date
On Wednesday 18 November 2009, Jiri Slaby wrote:
> @@ -284,17 +317,12 @@ asmlinkage long compat_sys_setrlimit(unsigned int resource,
> if (resource >= RLIM_NLIMITS)
> return -EINVAL;
>
> - if (!access_ok(VERIFY_READ, rlim, sizeof(*rlim)) ||
> - __get_user(r.rlim_cur, &rlim->rlim_cur) ||
> - __get_user(r.rlim_max, &rlim->rlim_max))
> - return -EFAULT;
> + ret = get_compat_rlimit(&r, rlim);
> + if (ret)
> + return ret;
>
> - if (r.rlim_cur == COMPAT_RLIM_INFINITY)
> - r.rlim_cur = RLIM_INFINITY;
> - if (r.rlim_max == COMPAT_RLIM_INFINITY)
> - r.rlim_max = RLIM_INFINITY;
> set_fs(KERNEL_DS);
> - ret = sys_setrlimit(resource, (struct rlimit __user *) &r);
> + ret = sys_setrlimit(resource, (struct rlimit __force __user *)&r);
> set_fs(old_fs);
> return ret;

Since you are already rewriting the whole function here, it would be
nice if you could just call do_setrlimit() with the kernel pointer
instead of the set_fs() and __force tricks. For getrlimit, it may
be easier to just open-code the whole function, and for your new
functions, you could pass the pid into do_setrlimit instead of the
task in order to reduce code duplication between compat_sys_setprlimit
and sys_setprlimit.
If you interpret a pid argument of zero as 'current', we can deprecate
the kernel implementation of setrlimit and getrlimit for future
architecture ports.

Yes, I realize my reply is late in this thread, but I assume your patch
is still current since it hasn't made it into 2.6.33.

Arnd


\
 
 \ /
  Last update: 2009-12-31 01:01    [W:1.275 / U:0.640 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site