免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
楼主: zwfha
打印 上一主题 下一主题

网中人来解释下 :() { :|:& }; : # <--- 這個別亂跑!好奇會死人的! [复制链接]

论坛徽章:
0
11 [报告]
发表于 2007-04-25 23:31 |只看该作者
原帖由 doctorjxd 于 2007-4-25 15:09 发表
还是FreeBSD稳定。
运行这个语句之后,内存全部用完,还用了100多Mswap空间。
接着提示Pipe call failed: Bad file descriptor
Cannot fork: Resource temporarily unavailable

然后又提示kern.ipc.maxpipe ...



还是WINDOWS稳定,跑了一下啥问题也没有

论坛徽章:
7
荣誉会员
日期:2011-11-23 16:44:17水瓶座
日期:2013-08-28 21:20:16丑牛
日期:2013-10-02 21:01:462015年迎新春徽章
日期:2015-03-04 09:54:45操作系统版块每日发帖之星
日期:2016-06-05 06:20:0015-16赛季CBA联赛之吉林
日期:2016-06-20 08:24:0515-16赛季CBA联赛之四川
日期:2016-08-18 15:02:02
12 [报告]
发表于 2007-04-26 00:34 |只看该作者
原帖由 tksin 于 2007-4-25 16:13 发表
在Mac OS X 上的Darwin也很稳定的说, 用户内存不受影响,用system monitor看几乎没有变化。
只有一句 : fork: Resource temporarily unavailable。

bash中有限制资源占用和最大内存及maximun number of pro ...



恩,类bsd风格的系统都可以做到。

论坛徽章:
0
13 [报告]
发表于 2007-04-26 09:05 |只看该作者
好奇会死人的......
在论坛上已经看到好几个这样的贴子了.

论坛徽章:
0
14 [报告]
发表于 2007-04-26 16:19 |只看该作者
这个代码这么强啊,我都不敢跑了~~~~~~~~~~~~~

论坛徽章:
0
15 [报告]
发表于 2007-04-26 17:02 |只看该作者
用WINDOWS下的cygwin试了一下,也死机了。
不知道HP-UX如何,回公司试一下

论坛徽章:
0
16 [报告]
发表于 2007-04-26 17:15 |只看该作者

回复 1楼 zwfha 的帖子

这条语句大家能解释一下吗

论坛徽章:
1
荣誉版主
日期:2011-11-23 16:44:17
17 [报告]
发表于 2007-04-27 01:28 |只看该作者

论坛徽章:
0
18 [报告]
发表于 2007-04-27 09:09 |只看该作者
本来想找下netman帖的帖子, 结果我灌水太多了...>_<

论坛徽章:
8
摩羯座
日期:2014-11-26 18:59:452015亚冠之浦和红钻
日期:2015-06-23 19:10:532015亚冠之西悉尼流浪者
日期:2015-08-21 08:40:5815-16赛季CBA联赛之山东
日期:2016-01-31 18:25:0515-16赛季CBA联赛之四川
日期:2016-02-16 16:08:30程序设计版块每日发帖之星
日期:2016-06-29 06:20:002017金鸡报晓
日期:2017-01-10 15:19:5615-16赛季CBA联赛之佛山
日期:2017-02-27 20:41:19
19 [报告]
发表于 2007-04-27 12:11 |只看该作者
为啥不google下fork bomb?这玩意儿打有狗那年就有了

  1. fork bomb

  2. The fork bomb is a form of denial of service attack against a computer system that uses the fork function. It relies on the assumption that the number of programs and processes which may be simultaneously executed on a computer has a limit.

  3. A fork bomb works by creating a large number of processes very quickly in order to saturate the available space in the list of processes kept by the computer's operating system. If the process table becomes saturated, no new programs may be started until another terminates. Even if that happens, it is not likely that a useful program may be started since the instances of the bomb program are each waiting to take that slot themselves.

  4. Not only do fork bombs use space in the process table, they each use processor time and memory. As a result of this, the system and existing programs slow down and become much more difficult (slow), or even impossible, to use.


  5. Canonical forkbombs include this one on Unix (using the Bash shell) (Explanation):

  6. :(){ :|:& };:

  7. Or in Microsoft Windows using a batch file:

  8. :s
  9. start %0
  10. goto s

  11. Or using Perl:

  12. (forking using the Perl interpreter):
  13. perl -e "fork while fork" &

  14. Or in C:

  15. #include <unistd.h>

  16. int main(void)
  17. {
  18.   while(1) {
  19.     fork();
  20.   }
  21.   return 0;
  22. }

  23. Difficulty of cure

  24. 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. Trying to use a program to kill the rogue processes normally requires another process be created, which may not be possible if there are no empty slots in the process table, or space in memory structures.

  25. Prevention

  26. One way to prevent a fork bomb is to limit the number of processes that a single user may own. When a process tries to create another process and the owner of that process already owns more than the maximum, the creation fails. The maximum should be low enough that if all the users who might simultaneously bomb a system do, there are still enough resources left to avoid disaster. Note that an accidental fork bomb is highly unlikely to involve more than one user.

  27. Unix-type systems typically have such a limit, controlled by a ulimit shell command. With a Linux kernel, it is the RLIMIT_NPROC rlimit of a process. If a process tries to perform a fork and the user that owns that process already owns more than RLIMIT_NPROC processes, it fails.

  28. Note that simply limiting the number of processes a process may create does not prevent a fork bomb, because each process that the fork bomb creates also creates processes. A distributive resource allocation system in which a process' resources are a share of its parents resources would work, but distributive resource systems are not in common use.

  29. Another solution involves the detection of fork bombs by the operating system, which is not widely practiced although has been implemented in the form of a kernel module for the Linux kernel [1].

  30. Further challenges

  31. Even with the above precautions, fork bombs can still have disastrous effects on a system. For example, if a server has 24 CPUs and allows ordinary users to have up to 100 processes, a fork bomb can still saturate all 24 CPUs even after it can no longer multiply. This can make the system completely unresponsive, to the point where an admin cannot log in to fix the problem.

  32. This entry is from Wikipedia, the leading user-contributed encyclopedia. It may not have been reviewed by professional editors
复制代码

论坛徽章:
0
20 [报告]
发表于 2007-04-27 12:16 |只看该作者
葱白下waker....
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP