Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.83 KB | None | 0 0
  1. edit file
  2. usr/src/linux/kernel/fork.c
  3.  
  4. add the following.
  5.  
  6. int disfork=0;
  7.  
  8. SYSCALL_DEFINE0(nofork){
  9.  
  10. printk("ForkaDISABLEDaCAlled");
  11. return disfork = (disfork==0)? 1 : 0;
  12.  
  13. }
  14.  
  15. long do_fork(unsigned long clone_flags,
  16.               unsigned long stack_start,
  17.               struct pt_regs *regs,
  18.               unsigned long stack_size,
  19.               int __user *parent_tidptr,
  20.               int __user *child_tidptr)
  21. {
  22.         struct task_struct *p;
  23.         int trace = 0;
  24.         long nr;
  25.         if ( disfork) return -EPERM;
  26.  
  27. --------
  28.  
  29. then goto that syscall file and at 283 just like in the other lab make it ref nofork instead.
  30.  
  31.  
  32. --c program does library call
  33.  
  34. #include <unistd.h>
  35. #include <stdio.h>
  36. #include <sys/syscall.h>  
  37. #define NOFORK 283
  38. int main(int argc, char **argv){
  39. syscall(NOFORK);
  40. return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement