Guest User

Untitled

a guest
Jul 19th, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. Try to force a kernel panic for testing, need kernel source::
  2.  
  3. sudo apt-get install linux-headers-server linux-source ncurses-dev
  4.  
  5. cd ~/src
  6. tar xvjf /usr/src/linux-source-2.6.28.tar.bz2
  7. cd linux-source-2.6.28
  8.  
  9. make menuconfig
  10. # Disabled a bunch of crap so kernel would compile faster
  11. make vmlinux
  12. make modules_prepare
  13.  
  14. mkdir ~/module
  15. cd ~/module
  16.  
  17. # Kbuild:
  18. #
  19. # obj-m := panic.o
  20.  
  21. # Makefile:
  22. #
  23. # KERNELDIR := /home/garry/src/linux-source-2.6.28/
  24. #
  25. # all::
  26. # $(MAKE) -C $(KERNELDIR) M=`pwd` $@
  27.  
  28. # panic.c:
  29. #
  30. # #include <linux/module.h>
  31. #
  32. # int init_module (void) /* Loads a module in the kernel */
  33. # {
  34. # panic("I'm sick :(\n");
  35. # return 0;
  36. # }
  37.  
  38. make -C ~/src/linux-source-2.6.28/ M=`pwd`
  39.  
  40. To crash the box::
  41.  
  42. cd ~/module
  43. sudo insmod ./panic.ko
Add Comment
Please, Sign In to add comment