Re: [PATCH 0/3] extend get/setrlimit to support setting rlimits externalto a process (v7)

From: Jiri Slaby
Date: Wed Nov 18 2009 - 09:51:59 EST


On 11/09/2009 06:36 PM, Oleg Nesterov wrote:
> We can call find_task_by_vpid() under rcu and do get_task_struct().
> Or, given that we need tasklist anyway we can do find_task_by_vpid()
> under tasklist and do not get() at all.

Thanks. I'll post patches as a reply to this email. They are on the top
of the previous series which were already in -next. They're here (on the
same thread level):
http://lkml.org/lkml/2009/9/3/296

All patches available as:
git://decibel.fi.muni.cz/~xslaby/linux writable_limits-testing
or on web:
http://decibel.fi.muni.cz/cgi-bin/gitweb.cgi?p=linux.git;a=shortlog;h=refs/heads/writable_limits-testing

If somebody would like to pick them up, I have also a -next based
version (fanotify+recvmsg syscalls collision).

What I did with the Neil's patches:
- changed syscall bodies according to comments and
- added entries to syscall_table_32.S
- implemented compat syscalls
- cleaned up rlim usage in posix cpu timers. Note that cpu and
rttime are not guaranteed (concurrent setrlimit set might
be overwritten by the stores there).
- reviewed rlim usages all over the tree

On the last point: I added explicit ACCESS_ONCE all over there. If you
don't like I will trash it. The only remaining weird user is in
kernel/acct.c:
/*
* Accounting records are not subject to resource limits.
*/
flim = current->signal->rlim[RLIMIT_FSIZE].rlim_cur;
current->signal->rlim[RLIMIT_FSIZE].rlim_cur = RLIM_INFINITY;
file->f_op->write(file, (char *)&ac,
sizeof(acct_t), &file->f_pos);
current->signal->rlim[RLIMIT_FSIZE].rlim_cur = flim;

It means that threads of the process with PACCT caps have unlimited file
size for a short while. If there is setrlimit in between, it gets wiped
out as well. I don't know what to do with that.

Please review.

thanks,
--
js
Faculty of Informatics, Masaryk University
Suse Labs, Novell
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/