Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invoke Mac Kernel Panic?

Tags:

macos

kernel

So i am lookin for some source code to crash the mac kernel. I found crashme for debain linux but that does not work for the mac kernel. So i was wondering if anyone knows where i can find a command-line utility or some source code to invoke the mac kernel panic? This would be a huge help, thanks.

like image 868
Trevor Rudolph Avatar asked Jan 11 '12 23:01

Trevor Rudolph


People also ask

What triggers a kernel panic?

If your Mac restarts unexpectedly, an error known as a kernel panic occurred, and a message indicates that your computer restarted because of a problem. The most likely cause is faulty software. A kernel panic can also be caused by damaged or incompatible hardware, including external devices attached to your Mac.

How do I find kernel panics on Mac?

Hold down the Option key and then select Library. Select Logs > DiagnosticsReports. Check the Crash Reports folder in Console for any recent log entries. Look through the report for a time corresponding to when the kernel panic occurred.

How do I boot a Mac in Safe Mode?

Press and hold the power button on your Mac until “Loading startup options” appears. Select a volume. Press and hold the Shift key, then click Continue in Safe Mode.


2 Answers

Apple has a tech note about how to do this. The short way to do it is with this command, sudo dtrace -w -n "BEGIN{ panic();}", run from the terminal.

Update 2020: As noted by Wei Shen in the comments, you'll need to disable SIP to make this work in modern versons of macOS.

like image 117
Chuck Avatar answered Nov 03 '22 12:11

Chuck


I recently updated crashme to work on Mac OS X Lion. You will need to download the source code from http://crashme.codeplex.com/ and compile it using Xcode command line tools. More details are in a answer to question 5085136. But note that crashme hasn't found any immediate kernel panics on the Mac yet. However, after running crashme on the native MacBook Pro, and running it in VirtualBox VM's on the same machine, one in an x86 PC-BSD and another in an x64 Centos, my Lion Kernel became unhappy enough that it threw a kernel panic a few minutes later as I was editing a file using the native Emacs. So crashme may have stumbled upon a kernel bug.

like image 21
George Carrette Avatar answered Nov 03 '22 11:11

George Carrette