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

goon83





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

5come5帮你背单词 [ historic /his'torik/ 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 | [楼 主]
est





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

5come5帮你背单词 [ naked /'neikid/ a. 裸体的,裸露的,无掩饰的,未遮盖的 ]


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

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

.......

bash下貌似有个limit命令

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

Total 0.010703(s) query 6, Time now is:05-31 13:57, Gzip enabled
Powered by PHPWind v5.3, Localized by 5come5 Tech Team, 黔ICP备16009856号