emin_int11

get SMM(system management mode) based task_struct

Aug 22nd, 2015
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. #include <linux/module.h>
  2. #include <linux/kernel.h>
  3. #include <linux/init.h>
  4. #include <asm/kdebug.h>
  5. #include <linux/smp.h>
  6. #include <linux/sched.h>
  7. #include <linux/kallsyms.h>
  8. #include <asm/ptrace.h>
  9. #include <asm/asm-offsets.h>
  10. #include <asm/current.h>
  11.  
  12. unsigned int ds;
  13. //struct pt_regs;
  14. module_param(ds,int,0);
  15.  
  16. static int __init root_init(void)
  17. {
  18. //struct pt_regs own;
  19. struct pt_regs *ptr,p;
  20. ptr=&p;
  21. __asm__ ("mov $1,%%eax"
  22. :"=r"(ds)
  23. :
  24. );
  25. //__asm__("mov %fs,%rax");
  26. //asm ("mov %r13,%eax");
  27. printk("DS:%5x",ds);
  28. printk(KERN_INFO "addr %lx",(long unsigned int)&(ptr->r13)); //point to current task_struct (in root privilige)
  29. //printk(KERN_INFO "addr %d",FRAME_SIZE);
  30. return 0;
  31. }
  32.  
  33. static void __exit root_cleanup(void)
  34. {
  35.  
  36. }
  37.  
  38. module_init(root_init);
  39. module_exit(root_cleanup);
  40. ===============================================================
  41. DS: 0
  42. addr ffff88003756be78
Advertisement
Add Comment
Please, Sign In to add comment