我来我网
https://5come5.cn
 
您尚未 登录  注册 | 菠菜 | 软件站 | 音乐站 | 邮箱1 | 邮箱2 | 风格选择 | 更多 » 
 

goon83





性别: 帅哥 状态: 该用户目前不在线
等级: 品行端正
发贴: 349
威望: 0
浮云: 1146
在线等级:
注册时间: 2005-11-05
最后登陆: 2009-03-10

5come5帮你背单词 [ lawful /'lo:ful/ a. 合法的,法定的 ]


Bash fork() bomb

看到一个有趣的东西, 大家来看看
我没有测试, 谁有机会 测试一下:
大家 也可以想想 解决办法哈, 其实解决的办法还是很简单的。。
------------
fork bomd:

the code is:
:(){ :|:& };:
This is a bash function. It gets called recursively (recursive function). This is most horrible code for any Unix / Linux box. It is often used by sys admin to test user processes limitations (Linux process limits can be configured via /etc/security/limits.conf and PAM).

Once a successful fork bomb has been activated in a system it may not be possible to resume normal operation without rebooting, as the only solution to a fork bomb is to destroy all instances of it.


Understanding :(){ :|:& };: fork() bomb code

:() - It is a function name. It accepts no arguments at all. Generally, bash function is defined as follows:

foo(){
arg1=$1
echo ''
#do_something on $arg argument
}

fork() bomb is defined as follows:

:(){
:|:&
};:

:|: - Next it call itself using programming technique called recursion and pipes the output to another call of the function ‘:’. The worst part is function get called two times to bomb your system.

& - Puts the function call in the background so child cannot die at all and start eating system resources.

; - Terminate the function definition

: - Call (run) the function aka set the fork() bomb.

Here is more human readable code:

bomb() {
bomb | bomb &
}; bomb

Properly configured Linux / UNIX box should not go down when fork() bomb sets off.


-----
有些没有看懂:如这句
& - Puts the function call in the background so child cannot die at all and start eating system resources.
顶端 Posted: 2007-12-19 18:49 | [楼 主]
sitademail



性别: 帅哥 状态: 该用户目前不在线
等级: 希望之光
发贴: 1791
威望: 0
浮云: 1282
在线等级:
注册时间: 2006-11-02
最后登陆: 2012-03-26

5come5帮你背单词 [ agree /ə'gri:/ vi. 赞同,答应,适合,一致,商定,约定 ]


顶端 Posted: 2007-12-20 12:12 | [1 楼]
goon83





性别: 帅哥 状态: 该用户目前不在线
等级: 品行端正
发贴: 349
威望: 0
浮云: 1146
在线等级:
注册时间: 2005-11-05
最后登陆: 2009-03-10

5come5帮你背单词 [ studio /'stju:diəu/ n. (影视等的)播音室,摄影场,(艺术家等的)工作室 ]


Quote:
引用第1楼sitademail于2007-12-20 12:12发表的  :
http://192.168.2.8/bbs/read.php?tid=462511#5

原来没有看过哈,,
蝈蝈 都试过了 强大
看来效果 很明显,,,

你有办法  解决解决吗?
顶端 Posted: 2007-12-20 14:39 | [2 楼]
est





性别: 帅哥 状态: 该用户目前不在线
等级: 荣誉会员
发贴: 6578
威望: 3
浮云: 431
在线等级:
注册时间: 2006-10-14
最后登陆: 2018-07-05

5come5帮你背单词 [ philosopher /fi'losəfə/ n. 哲学家,哲人 ]


Quote:
引用第2楼goon83于2007-12-20 14:39发表的  :

原来没有看过哈,,
蝈蝈 都试过了 强大
看来效果 很明显,,,

.......

bash下貌似有个limit命令

可以限制进程占用系统资源的百分比
好久不用都忘记了
顶端 Posted: 2007-12-25 00:46 | [3 楼]
我来我网·5come5 Forum » Linux专区

Total 0.019665(s) query 7, Time now is:12-23 02:46, Gzip enabled
Powered by PHPWind v5.3, Localized by 5come5 Tech Team, 黔ICP备16009856号