memcpy_overflow.c 443 B

12345678910111213141516171819202122
  1. /* https://github.com/cirosantilli/linux-kernel-module-cheat#config_fortify_source */
  2. #include <linux/kernel.h>
  3. #include <linux/module.h>
  4. #include <linux/string.h>
  5. #include <linux/slab.h>
  6. static int myinit(void)
  7. {
  8. void *dst, *src;
  9. dst = kmalloc(0x10, GFP_KERNEL);
  10. src = kmalloc(0x1000000, GFP_KERNEL);
  11. memcpy(dst, src, 0x1000000);
  12. return 0;
  13. }
  14. static void myexit(void) {}
  15. module_init(myinit)
  16. module_exit(myexit)
  17. MODULE_LICENSE("GPL");