* setrlimit() and 2.4.0-test11
@ 2000-11-22 16:17 Arkadiusz Miskiewicz
2000-11-26 19:33 ` Jan Rekorajski
0 siblings, 1 reply; 2+ messages in thread
From: Arkadiusz Miskiewicz @ 2000-11-22 16:17 UTC (permalink / raw)
To: linux-kernel
Is probably broken (I didnt't saw any disscusion about this here,
I missed it?).
when I try to start first user process I get:
4366 fork() = -1 EAGAIN (Resource temporarily unavailable)
but strace show proper value passed to setrlimit() -- 40 max number of processes:
4366 setrlimit(0x6 /* RLIMIT_??? */, {rlim_cur=40, rlim_max=40}) = 0
On test10 everything is ok.
This change broke test11 ?
diff -u --recursive --new-file v2.4.0-test10/linux/fs/proc/array.c linux/fs/proc/array.c
--- v2.4.0-test10/linux/fs/proc/array.c Tue Oct 31 12:42:27 2000
+++ linux/fs/proc/array.c Tue Nov 14 11:22:36 2000
@@ -372,7 +372,7 @@
task->start_time,
vsize,
mm ? mm->rss : 0, /* you might want to shift this left 3 */
- task->rlim ? task->rlim[RLIMIT_RSS].rlim_cur : 0,
+ task->rlim[RLIMIT_RSS].rlim_cur,
mm ? mm->start_code : 0,
mm ? mm->end_code : 0,
mm ? mm->start_stack : 0,
I need patch.
--
Arkadiusz Miśkiewicz, AM2-6BONE [ PLD GNU/Linux IPv6 ]
http://www.t17.ds.pwr.wroc.pl/~misiek/ipv6/ [ enabled ]
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: setrlimit() and 2.4.0-test11
2000-11-22 16:17 setrlimit() and 2.4.0-test11 Arkadiusz Miskiewicz
@ 2000-11-26 19:33 ` Jan Rekorajski
0 siblings, 0 replies; 2+ messages in thread
From: Jan Rekorajski @ 2000-11-26 19:33 UTC (permalink / raw)
To: linux-kernel; +Cc: torvalds
On Wed, 22 Nov 2000, Arkadiusz Miskiewicz wrote:
>
> Is probably broken (I didnt't saw any disscusion about this here,
> I missed it?).
>
> when I try to start first user process I get:
> 4366 fork() = -1 EAGAIN (Resource temporarily unavailable)
> but strace show proper value passed to setrlimit() -- 40 max number of processes:
> 4366 setrlimit(0x6 /* RLIMIT_??? */, {rlim_cur=40, rlim_max=40}) = 0
>
> On test10 everything is ok.
No, you are just lucky.
The problem is that root (uid=0) is not a special case anymore, and you can't
do something like this:
setrlimit(NPROC)
fork()
setuid(user)
setrlimit() and fork() are executed in root context, so sterlimit
apllies to root, not the user you're setuid to :(
Why is this so? root should be able to do fork() regardless of any limits,
and IMHO the following patch is the right thing.
--- linux/kernel/fork.c~ Tue Sep 5 23:48:59 2000
+++ linux/kernel/fork.c Sun Nov 26 20:22:20 2000
@@ -560,7 +560,8 @@
*p = *current;
retval = -EAGAIN;
- if (atomic_read(&p->user->processes) >= p->rlim[RLIMIT_NPROC].rlim_cur)
+ if (p->user->uid &&
+ (atomic_read(&p->user->processes) >= p->rlim[RLIMIT_NPROC].rlim_cur))
goto bad_fork_free;
atomic_inc(&p->user->__count);
atomic_inc(&p->user->processes);
Jan
--
Jan Rękorajski | ALL SUSPECTS ARE GUILTY. PERIOD!
baggins<at>mimuw.edu.pl | OTHERWISE THEY WOULDN'T BE SUSPECTS, WOULD THEY?
BOFH, type MANIAC | -- TROOPS by Kevin Rubio
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2000-11-26 20:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-11-22 16:17 setrlimit() and 2.4.0-test11 Arkadiusz Miskiewicz
2000-11-26 19:33 ` Jan Rekorajski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox