Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: [tlug] cat /dev/zero > /dev/null
- Date: Sat, 15 Mar 2003 14:09:25 +0000
- From: Tim Hurman <kano-tlug@example.com>
- Subject: Re: [tlug] cat /dev/zero > /dev/null
- References: <200303151140.h2FBex217655@example.com>
- User-agent: Mutt/1.4i
On Sat, Mar 15, 2003 at 03:40:59AM -0800, Pietro Zuco wrote: > Hello. > > I proved this and find with top that the proccess takes the 98% of my cpu. > I googling a bit and find that a lot of people talk about this but I > coundn't find a way to solve the problem. there isnt really, /dev/zero will generate 0s as fast as it can, /dev/null will swallow as fast as it can, whats taking most of the CPU is cat doing it's read/write loop. > Any user can do it and the system got slow until I stop the proccess. > This is where a computer mis-use policy comes in. > If I change the permissions there are software that need to use /dev/zero > and /dev/null > You cant do these, here is why. malloc allocates memory by mmaping against /dev/zero, so any user process that needs dynamic memory will need permission here. Also a lot processes open /dev/null, for various things (output redirects...), you can see it by "strace <progname>". > Some idea to avoid this? Maybe some " cpu quota " for limit the cpu usage of > users? "ulimit -t" can place cpu limits, although a user can change them. There is a way to set a hard limit, but I have forgotten it. The corresponding C functions are: getrlimit and setrlimit, you could re-compile cat with these in. tbh though there are much worse things a local user can do, chewing up all the cpu with one process is not that bad, you can kill it. Fork bombs on the other had will often kill a Linux box completly as the scheduler cannot handle all the processes (the Linux scheduler is not very good in this respect, Solaris and others can withstand a fork bomb and return happily). There is even a 10 char string which will cause bash for fork bomb. Then of course there are the other things, malloc bombs and all manner of nasties that you can do with a shell account. ulimit will protect against accidents though. Tim. -- "ergo it is easier to drag sheep downhill" - Applied Ergonomics Magasine Tim Hurman - Email: kano at kano.org.uk - Phone: Yeah right.
- References:
- [tlug] cat /dev/zero > /dev/null
- From: Pietro Zuco
Home | Main Index | Thread Index
- Prev by Date: [tlug] cat /dev/zero > /dev/null
- Next by Date: Re: [tlug] VPN appliance and network connection suggestions?
- Previous by thread: [tlug] cat /dev/zero > /dev/null
- Next by thread: [tlug] Lessig, Free Culture
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links