WSL icon indicating copy to clipboard operation
WSL copied to clipboard

Fork bomb in bash results in BSOD

Open Magnificus36 opened this issue 10 years ago • 15 comments

After running the fork bomb :(){ :|:& };: my entire Windows crashed with a BSOD "CRITICAL_PROCESS_DIED", see below for complete line from nirsoft bluescreenview. Of course I expected that my system to become possible unresponsive due to CPU usage and possible memory. However, a BSOD "CRITICAL_PROCESS_DIED" was not what I expected and I think that you should not be able to crash Windows in such a way from bash.

042016-17156-01.dmp 2016-04-20 17:04:12 CRITICAL_PROCESS_DIED 0x000000ef ffff9387df45f800 0000000000000000 0000000000000000 0000000000000000 ntoskrnl.exe ntoskrnl.exe+1484b0 x64 ntoskrnl.exe+1484b0 C:\WINDOWS\Minidump\042016-17156-01.dmp 10 15 14316 236,812 2016-04-20 17:05:21

Magnificus36 avatar Apr 20 '16 15:04 Magnificus36

Can you share the minidump? I can take a look and route it to the right team.

benhillis avatar Apr 20 '16 15:04 benhillis

@Magnificus36 Thanks for providing the dump. Unfortunately there isn't enough state in the minidump to determine which svchost is crashing. Would it be possible to look in your event viewer (custom views -> Administrative Events) around 17:04 and see which service is dying?

benhillis avatar Apr 20 '16 16:04 benhillis

I see that dwm crashed (and cortana). Attached the events.

events_around1704.zip

Magnificus36 avatar Apr 20 '16 16:04 Magnificus36

Thanks for providing the event logs. You're right, this is dwm crashing because it failed to allocate memory:

Error code: (NTSTATUS) 0xc00001ad (3221225901) - The process has terminated because it could not allocate additional memory.

We have somebody on our team investigating a mitigation for the fork bomb issue. I definitely agree with the statement in your original post that WSL shouldn't be able to bugcheck the machine by putting the machine under extreme memory pressure.

Thanks again for reporting the issue.

benhillis avatar Apr 20 '16 16:04 benhillis

You can already do this from a Win32 process, so this doesn't appear to be a WSL issue.

ionescu007 avatar Apr 21 '16 16:04 ionescu007

You can bluescreen by merely allocating too much memory under Win32? I guess nobody should consider Linux (the real one) overcommit and OOM killing to be an issue anymore then :p

xilun avatar Apr 22 '16 20:04 xilun

I just tried fork-bombing on 14328; just caused my system to grind to a halt. As the OP mentioned, the BSOD was due to a basic Windows NT system process being killed due to running out of resources during the overload.

dxgldotorg avatar Apr 23 '16 02:04 dxgldotorg

Most linux distros use ulimit to prevent fork bombing from crashing the system. the limits can be be configured in /etc/security/limits.conf In Linux these limits are enforced in the kernel. I'm not familiar off hand with the method used to get this configuration into the kernel, or if WSL even supports them.

If WSL does not support them yet, then this is a WSL issue.

bogen avatar May 05 '16 21:05 bogen

@bogen - That's correct, and something we are aware of. Thanks for bringing it up and providing the feedback.

sunilmut avatar May 09 '16 18:05 sunilmut

We have mitigated the impact of fork bombs so they should no longer cause bugchecks in our driver or other Windows components. Please reopen if you are still able to hit this.

benhillis avatar Jul 15 '16 00:07 benhillis

@benhillis I just tried this today and it crashed Windows. I am using Version 10.0.16299 Build 16299.

dtrailin avatar Nov 09 '17 19:11 dtrailin

@dtrailin do you have a crashdump?

benhillis avatar Nov 09 '17 20:11 benhillis

@benhillis Sure, uploaded here

dtrailin avatar Nov 09 '17 21:11 dtrailin

@benhillis I tried Fork Bombing today on Microsoft Windows [Version 10.0.16299.125]

It showed Not Responding on the wsl process and then the process crashed.

Nothing else happened.

nzec avatar Jan 23 '18 13:01 nzec