oops.c 362 B

12345678910111213141516171819202122
  1. /* https://cirosantilli.com/linux-kernel-module-cheat#kernel-panic-and-oops */
  2. #include <linux/module.h>
  3. #include <linux/kernel.h>
  4. static int myinit(void)
  5. {
  6. pr_info("oops myinit\n");
  7. *(int *)0 = 0;
  8. pr_info("oops after\n");
  9. return 0;
  10. }
  11. static void myexit(void)
  12. {
  13. pr_info("oops myexit\n");
  14. }
  15. module_init(myinit)
  16. module_exit(myexit)
  17. MODULE_LICENSE("GPL");