login
Login
/
Register
Search
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2007
»
April
»
20
Re: CPU time limit patch / setrlimit(RLIMIT_CPU, 0) cheat fix
view
thread
!MAILaRCHIVE_VOTE_RePLACE
Previous message: [
thread
] [
date
] [
author
]
Next message: [thread] [
date
] [
author
]
[view in full thread]
From:
Andrew Morton <akpm@...>
To: Tom Alsberg <alsbergt@...>
Cc: Linux-Kernel Mailing List <linux-kernel@...>
Subject:
Re: CPU time limit patch / setrlimit(RLIMIT_CPU, 0) cheat fix
Date: Friday, April 20, 2007 - 3:45 am
On Tue, 17 Apr 2007 16:57:55 +0300 Tom Alsberg <alsbergt@cs.huji.ac.il> wrote:
quoted text
> Hi there. > > As discovered here today, the change in Kernel 2.6.17 intended to > inhibit users from setting RLIMIT_CPU to 0 (as that is equivalent to > unlimited) by "cheating" and setting it to 1 in such a case, does not > make a difference, as the check is done in the wrong place (too late), > and only applies to the profiling code.
hm, I tested that. I guess I must have only tested the profiling limit.
quoted text
> On all systems I checked running kernels above 2.6.17, no matter what > the hard and soft CPU time limits were before, a user could escape > them by issuing in the shell (sh/bash/zsh) "ulimit -t 0", and then the > user's process was not ever killed. > > Attached is a trivial patch to fix that. Simply moving the check to a > slightly earlier location (specifically, before the line that actually > assigns the limit - *old_rlim = new_rlim), does the trick. > > Do note that at least the zsh (but not ash, dash, or bash) shell has > the problem of "caching" the limits set by the ulimit command, so when > running zsh the fix will not immediately be evident - after entering > "ulimit -t 0", "ulimit -a" will show "-t: cpu time (seconds) 0", even > though the actual limit as returned by getrlimit(...) will be 1. It > can be verified by opening a subshell (which will not have the values > of the parent shell in cache) and checking in it, or just by running a > CPU intensive command like "echo '65536^1048576' | bc" and verifying > that it dumps core after one second. > > Regardless of whether that is a misfeature in the shell, perhaps it > would be better to return -EINVAL from setrlimit in such a case > instead of cheating and setting to 1, as that does not really reflect > the actual state of the process anymore. I do not however know what > the ground for that decision was in the original 2.6.17 change, and > whether there would be any "backward" compatibility issues, so I > preferred not to touch that right now.
The 2.6.17 changes was done that way allegedly for 2.4 compatibility. -
unsubscribe notice
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to
majordomo@vger.kernel.org
More majordomo info at
http://vger.kernel.org/majordomo-info.html
Please read the FAQ at
http://www.tux.org/lkml/
Previous message: [
thread
] [
date
] [
author
]
Next message: [thread] [
date
] [
author
]
Messages in current thread:
CPU time limit patch / setrlimit(RLIMIT_CPU, 0) cheat fix
, Tom Alsberg
, (Tue Apr 17, 9:57 am)
Re: CPU time limit patch / setrlimit(RLIMIT_CPU, 0) cheat fix
, Andrew Morton
, (Fri Apr 20, 3:45 am)
Navigation
Create content
Mailing list archives
Recent posts
Popular discussions
linux-kernel
:
Davide Libenzi
Re: [patch 7/8] fdmap v2 - implement sys_socket2
Bart Van Assche
Integration of SCST in the mainstream Linux kernel
Greg Kroah-Hartman
[PATCH 005/196] Chinese: add translation of SubmittingDrivers
Mariusz Kozlowski
[KJ PATCHES] mostly kmalloc + memset conversion to k[cz]alloc
git
:
linux-netdev
:
KOSAKI Motohiro
[bug?] tg3: Failed to load firmware "tigon/tg3_tso.bin"
Stefan Richter
Re: [GIT]: Networking
David Miller
Re: [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock().
Gerrit Renker
[PATCH 0/37] dccp: Feature negotiation - last call for comments
git-commits-head
:
Colocation donated by:
Who's online
There are currently
3 users
and
790 guests
online.
Online users
strcmp
Hunterie
zerhai30
Syndicate