Whamcloud - gitweb
b=3119
[fs/lustre-release.git] / lustre / kernel_patches / patches / bproc-patch-2.4.20
1 Index: linux/fs/exec.c
2 ===================================================================
3 --- linux.orig/fs/exec.c        2003-09-03 17:52:00.000000000 -0400
4 +++ linux/fs/exec.c     2003-09-03 17:52:04.000000000 -0400
5 @@ -38,6 +38,7 @@
6  #include <linux/utsname.h>
7  #define __NO_VERSION__
8  #include <linux/module.h>
9 +#include <linux/bproc.h>
10  
11  #include <asm/uaccess.h>
12  #include <asm/pgalloc.h>
13 @@ -953,9 +954,11 @@
14         xa_call_actions (XA_EXEC, XA_KOE, NULL);
15  
16         retval = search_binary_handler(&bprm,regs);
17 -       if (retval >= 0)
18 +       if (retval >= 0) {
19                 /* execve success */
20 +               bproc_hook_im(do_execve,());
21                 return retval;
22 +       }
23  
24  out:
25         /* Something went wrong, return the inode and free the argument pages*/
26 Index: linux/fs/binfmt_script.c
27 ===================================================================
28 --- linux.orig/fs/binfmt_script.c       2002-08-02 20:39:45.000000000 -0400
29 +++ linux/fs/binfmt_script.c    2003-09-03 17:52:04.000000000 -0400
30 @@ -13,6 +13,7 @@
31  #include <linux/init.h>
32  #include <linux/file.h>
33  #include <linux/smp_lock.h>
34 +#include <linux/bproc.h>
35  
36  static int load_script(struct linux_binprm *bprm,struct pt_regs *regs)
37  {
38 @@ -67,7 +68,7 @@
39          * user environment and arguments are stored.
40          */
41         remove_arg_zero(bprm);
42 -       retval = copy_strings_kernel(1, &bprm->filename, bprm);
43 +       retval = copy_strings_kernel(1,bproc_hook_v(&bprm->filename,load_script,(&bprm->filename)), bprm);
44         if (retval < 0) return retval; 
45         bprm->argc++;
46         if (i_arg) {
47 Index: linux/fs/binfmt_elf.c
48 ===================================================================
49 --- linux.orig/fs/binfmt_elf.c  2002-08-02 20:39:45.000000000 -0400
50 +++ linux/fs/binfmt_elf.c       2003-09-03 17:52:04.000000000 -0400
51 @@ -73,7 +73,7 @@
52  #define ELF_PAGEOFFSET(_v) ((_v) & (ELF_MIN_ALIGN-1))
53  #define ELF_PAGEALIGN(_v) (((_v) + ELF_MIN_ALIGN - 1) & ~(ELF_MIN_ALIGN - 1))
54  
55 -static struct linux_binfmt elf_format = {
56 +struct linux_binfmt elf_format = {
57         NULL, THIS_MODULE, load_elf_binary, load_elf_library, elf_core_dump, ELF_EXEC_PAGESIZE
58  };
59  
60 Index: linux/fs/proc/base.c
61 ===================================================================
62 --- linux.orig/fs/proc/base.c   2003-09-03 17:52:00.000000000 -0400
63 +++ linux/fs/proc/base.c        2003-09-03 17:52:04.000000000 -0400
64 @@ -25,6 +25,7 @@
65  #include <linux/string.h>
66  #include <linux/seq_file.h>
67  #include <linux/namespace.h>
68 +#include <linux/bproc.h>
69  
70  /*
71   * For hysterical raisins we keep the same inumbers as in the old procfs.
72 @@ -304,6 +305,7 @@
73         if (!(page = __get_free_page(GFP_KERNEL)))
74                 return -ENOMEM;
75  
76 +       if (bproc_isghost(task)) bproc_hook(refresh_status,(task));
77         length = inode->u.proc_i.op.proc_read(task, (char*)page);
78  
79         if (length < 0) {
80 @@ -976,14 +978,14 @@
81  static int proc_self_readlink(struct dentry *dentry, char *buffer, int buflen)
82  {
83         char tmp[30];
84 -       sprintf(tmp, "%d", current->pid);
85 +       sprintf(tmp, "%d", bproc_hook_imv(current->pid,proc3,()));
86         return vfs_readlink(dentry,buffer,buflen,tmp);
87  }
88  
89  static int proc_self_follow_link(struct dentry *dentry, struct nameidata *nd)
90  {
91         char tmp[30];
92 -       sprintf(tmp, "%d", current->pid);
93 +       sprintf(tmp, "%d", bproc_hook_imv(current->pid,proc3,()));
94         return vfs_follow_link(nd,tmp);
95  }      
96  
97 @@ -1031,6 +1033,7 @@
98                         goto out;
99         }
100  
101 +       pid = bproc_hook_imv(pid,proc2,(pid));
102         read_lock(&tasklist_lock);
103         task = find_task_by_pid(pid);
104         if (task)
105 @@ -1082,7 +1085,7 @@
106         index--;
107         read_lock(&tasklist_lock);
108         for_each_task(p) {
109 -               int pid = p->pid;
110 +               int pid = bproc_hook_imv(p->pid,proc1,(p));
111                 if (!pid)
112                         continue;
113                 if (--index >= 0)
114 Index: linux/fs/proc/array.c
115 ===================================================================
116 --- linux.orig/fs/proc/array.c  2002-08-02 20:39:45.000000000 -0400
117 +++ linux/fs/proc/array.c       2003-09-03 17:52:04.000000000 -0400
118 @@ -70,6 +70,7 @@
119  #include <linux/smp.h>
120  #include <linux/signal.h>
121  #include <linux/highmem.h>
122 +#include <linux/bproc.h>
123  
124  #include <asm/uaccess.h>
125  #include <asm/pgtable.h>
126 @@ -130,7 +131,8 @@
127  
128  static inline const char * get_task_state(struct task_struct *tsk)
129  {
130 -       unsigned int state = tsk->state & (TASK_RUNNING |
131 +       unsigned int state = (bproc_hook_v(tsk->state,get_task_state,(tsk)))
132 +                                       & (TASK_RUNNING |
133                                            TASK_INTERRUPTIBLE |
134                                            TASK_UNINTERRUPTIBLE |
135                                            TASK_ZOMBIE |
136 @@ -158,7 +160,8 @@
137                 "Uid:\t%d\t%d\t%d\t%d\n"
138                 "Gid:\t%d\t%d\t%d\t%d\n",
139                 get_task_state(p), p->tgid,
140 -               p->pid, p->pid ? p->p_opptr->pid : 0, 0,
141 +               bproc_hook_imv(p->pid, proc_pid, (p)),
142 +               bproc_hook_imv(p->p_opptr->pid, proc_ppid, (p)), 0,
143                 p->uid, p->euid, p->suid, p->fsuid,
144                 p->gid, p->egid, p->sgid, p->fsgid);
145         read_unlock(&tasklist_lock);    
146 @@ -305,7 +308,7 @@
147         sigset_t sigign, sigcatch;
148         char state;
149         int res;
150 -       pid_t ppid;
151 +       pid_t pid, ppid;
152         struct mm_struct *mm;
153  
154         state = *get_task_state(task);
155 @@ -343,12 +346,14 @@
156         nice = task->nice;
157  
158         read_lock(&tasklist_lock);
159 -       ppid = task->pid ? task->p_opptr->pid : 0;
160 +       pid  = bproc_hook_imv(task->pid, proc_pid, (task)),
161 +       ppid = bproc_hook_imv(task->pid ? task->p_opptr->pid : 0,
162 +                             proc_ppid, (task));
163         read_unlock(&tasklist_lock);
164         res = sprintf(buffer,"%d (%s) %c %d %d %d %d %d %lu %lu \
165  %lu %lu %lu %lu %lu %ld %ld %ld %ld %ld %ld %lu %lu %ld %lu %lu %lu %lu %lu \
166  %lu %lu %lu %lu %lu %lu %lu %lu %d %d\n",
167 -               task->pid,
168 +               pid,
169                 task->comm,
170                 state,
171                 ppid,
172 Index: linux/kernel/timer.c
173 ===================================================================
174 --- linux.orig/kernel/timer.c   2003-09-03 17:51:01.000000000 -0400
175 +++ linux/kernel/timer.c        2003-09-03 17:52:04.000000000 -0400
176 @@ -22,6 +22,7 @@
177  #include <linux/smp_lock.h>
178  #include <linux/interrupt.h>
179  #include <linux/kernel_stat.h>
180 +#include <linux/bproc.h>
181  
182  #include <asm/uaccess.h>
183  
184 @@ -754,7 +755,7 @@
185   */
186  asmlinkage long sys_getpid(void)
187  {
188 -       return current->tgid;
189 +       return bproc_hook_imv(current->tgid, sys_getpid, ());
190  }
191  
192  /*
193 @@ -788,7 +789,7 @@
194  
195         parent = me->p_opptr;
196         for (;;) {
197 -               pid = parent->pid;
198 +               pid = bproc_hook_imv(parent->pid,sys_getppid,(parent));
199  #if CONFIG_SMP
200  {
201                 struct task_struct *old = parent;
202 Index: linux/kernel/signal.c
203 ===================================================================
204 --- linux.orig/kernel/signal.c  2003-09-03 17:51:01.000000000 -0400
205 +++ linux/kernel/signal.c       2003-09-03 17:52:04.000000000 -0400
206 @@ -16,6 +16,8 @@
207  
208  #include <asm/uaccess.h>
209  
210 +#include <linux/bproc.h>
211 +
212  /*
213   * SLAB caches for signal bits.
214   */
215 @@ -548,6 +550,9 @@
216         if (sig < SIGRTMIN && sigismember(&t->pending.signal, sig))
217                 goto out;
218  
219 +       if (bproc_hook_v(0, send_sig_info, (sig, info, t)))
220 +               goto out;
221 +
222         ret = deliver_signal(sig, info, t);
223  out:
224         spin_unlock_irqrestore(&t->sigmask_lock, flags);
225 @@ -590,6 +595,9 @@
226  kill_pg_info(int sig, struct siginfo *info, pid_t pgrp)
227  {
228         int retval = -EINVAL;
229 +
230 +       if (bproc_hook_imv(0,kill_pg_info, (sig, info, &pgrp, &retval)) == 1)
231 +               return retval;
232         if (pgrp > 0) {
233                 struct task_struct *p;
234  
235 @@ -617,6 +625,7 @@
236  kill_sl_info(int sig, struct siginfo *info, pid_t sess)
237  {
238         int retval = -EINVAL;
239 +       /* XXX bproc: Need ways to deal with session leaders...*/
240         if (sess > 0) {
241                 struct task_struct *p;
242  
243 @@ -640,6 +649,9 @@
244         int error;
245         struct task_struct *p;
246  
247 +       if (bproc_hook_imv(0, kill_proc_info,(sig, info, &pid, &error)) == 1)
248 +               return error;
249 +
250         read_lock(&tasklist_lock);
251         p = find_task_by_pid(pid);
252         error = -ESRCH;
253 @@ -684,6 +696,7 @@
254                 read_unlock(&tasklist_lock);
255                 return count ? retval : -ESRCH;
256         } else if (pid < 0) {
257 +               /* XXX pid masq - do PG stuff. */
258                 return kill_pg_info(sig, info, -pid);
259         } else {
260                 return kill_proc_info(sig, info, pid);
261 @@ -815,6 +828,7 @@
262  EXPORT_SYMBOL(recalc_sigpending);
263  EXPORT_SYMBOL(send_sig);
264  EXPORT_SYMBOL(send_sig_info);
265 +EXPORT_SYMBOL(kill_something_info);
266  EXPORT_SYMBOL(block_all_signals);
267  EXPORT_SYMBOL(unblock_all_signals);
268  
269 Index: linux/kernel/sched.c
270 ===================================================================
271 --- linux.orig/kernel/sched.c   2003-09-03 17:51:05.000000000 -0400
272 +++ linux/kernel/sched.c        2003-09-03 17:52:04.000000000 -0400
273 @@ -30,6 +30,7 @@
274  #include <linux/dump.h>
275  #include <linux/prefetch.h>
276  #include <linux/compiler.h>
277 +#include <linux/bproc.h>
278  
279  #include <asm/uaccess.h>
280  #include <asm/mmu_context.h>
281 @@ -370,6 +371,8 @@
282  
283  inline int wake_up_process(struct task_struct * p)
284  {
285 +       if (p->state == TASK_STOPPED && bproc_ismasq(p))
286 +               bproc_hook(wake_up_process, (p));
287         return try_to_wake_up(p, 0);
288  }
289  
290 Index: linux/kernel/ksyms.c
291 ===================================================================
292 --- linux.orig/kernel/ksyms.c   2003-09-03 17:52:02.000000000 -0400
293 +++ linux/kernel/ksyms.c        2003-09-03 17:52:04.000000000 -0400
294 @@ -68,6 +68,10 @@
295  extern void set_device_ro(kdev_t dev,int flag);
296  
297  extern void *sys_call_table;
298 +extern struct task_struct *child_reaper;
299 +#if defined(CONFIG_BINFMT_ELF)
300 +extern struct linux_binfmt elf_format;
301 +#endif
302  
303  extern struct timezone sys_tz;
304  extern int request_dma(unsigned int dmanr, char * deviceID);
305 @@ -104,9 +108,17 @@
306  EXPORT_SYMBOL(do_munmap);
307  EXPORT_SYMBOL(do_brk);
308  EXPORT_SYMBOL(exit_mm);
309 +EXPORT_SYMBOL(do_exit);
310  EXPORT_SYMBOL(exit_files);
311  EXPORT_SYMBOL(exit_fs);
312  EXPORT_SYMBOL(exit_sighand);
313 +EXPORT_SYMBOL(is_orphaned_pgrp);
314 +EXPORT_SYMBOL(child_reaper);
315 +#if defined(CONFIG_BINFMT_ELF)
316 +EXPORT_SYMBOL(elf_format);
317 +#endif
318 +EXPORT_SYMBOL(alloc_uid);
319 +EXPORT_SYMBOL(free_uid);
320  EXPORT_SYMBOL(copy_fs_struct);
321  EXPORT_SYMBOL_GPL(make_pages_present);
322  
323 @@ -584,6 +596,7 @@
324  EXPORT_SYMBOL(read_ahead);
325  EXPORT_SYMBOL(get_hash_table);
326  EXPORT_SYMBOL(new_inode);
327 +EXPORT_SYMBOL(get_empty_inode);
328  EXPORT_SYMBOL(insert_inode_hash);
329  EXPORT_SYMBOL(remove_inode_hash);
330  EXPORT_SYMBOL(buffer_insert_inode_queue);
331 Index: linux/kernel/fork.c
332 ===================================================================
333 --- linux.orig/kernel/fork.c    2003-09-03 17:52:00.000000000 -0400
334 +++ linux/kernel/fork.c 2003-09-03 17:52:04.000000000 -0400
335 @@ -23,6 +23,8 @@
336  #include <linux/personality.h>
337  #include <linux/compiler.h>
338  
339 +#include <linux/bproc.h>
340 +
341  #include <asm/pgtable.h>
342  #include <asm/pgalloc.h>
343  #include <asm/uaccess.h>
344 @@ -413,6 +415,7 @@
345  
346  static inline int copy_fs(unsigned long clone_flags, struct task_struct * tsk)
347  {
348 +       if (!current->fs) return 0;
349         if (clone_flags & CLONE_FS) {
350                 atomic_inc(&current->fs->count);
351                 return 0;
352 @@ -781,7 +784,8 @@
353          *
354          * Let it rip!
355          */
356 -       retval = p->pid;
357 +       if ((retval = bproc_hook_v(p->pid, do_fork, (p, clone_flags))) < 0)
358 +               goto bad_fork_cleanup_mm;
359         p->tgid = retval;
360         INIT_LIST_HEAD(&p->thread_group);
361  
362 @@ -805,6 +809,7 @@
363         SET_LINKS(p);
364         hash_pid(p);
365         nr_threads++;
366 +       bproc_hook(do_fork_2, (p));
367         write_unlock_irq(&tasklist_lock);
368  
369         if (p->ptrace & PT_PTRACED)
370 @@ -816,6 +821,7 @@
371                 wait_for_completion(&vfork);
372  
373  fork_out:
374 +       bproc_clear_kcall();
375         return retval;
376  
377  bad_fork_cleanup_namespace:
378 Index: linux/kernel/exit.c
379 ===================================================================
380 --- linux.orig/kernel/exit.c    2003-09-03 17:52:00.000000000 -0400
381 +++ linux/kernel/exit.c 2003-09-03 17:52:04.000000000 -0400
382 @@ -22,6 +22,8 @@
383  #include <asm/pgtable.h>
384  #include <asm/mmu_context.h>
385  
386 +#include <linux/bproc.h>
387 +
388  extern void sem_exit (void);
389  extern struct task_struct *child_reaper;
390  
391 @@ -47,6 +49,7 @@
392                 }
393                 task_unlock(p);
394  #endif
395 +               bproc_hook(release,(p));
396                 atomic_dec(&p->user->processes);
397                 free_uid(p->user);
398                 unhash_process(p);
399 @@ -130,7 +133,8 @@
400  
401  int is_orphaned_pgrp(int pgrp)
402  {
403 -       return will_become_orphaned_pgrp(pgrp, 0);
404 +       return bproc_hook_imv(will_become_orphaned_pgrp(pgrp, 0),
405 +                             is_orphaned_pgrp,(pgrp));
406  }
407  
408  static inline int has_stopped_jobs(int pgrp)
409 @@ -170,7 +174,7 @@
410                         p->self_exec_id++;
411  
412                         /* Make sure we're not reparenting to ourselves */
413 -                       p->p_opptr = child_reaper;
414 +                       p->p_opptr = bproc_hook_v(child_reaper, child_reaper, (p));
415  
416                         if (p->pdeath_signal) send_sig(p->pdeath_signal, p, 0);
417                 }
418 @@ -450,6 +454,7 @@
419  #endif
420         __exit_mm(tsk);
421  
422 +       bproc_hook(do_exit, (tsk,code));
423         lock_kernel();
424         sem_exit();
425         __exit_files(tsk);
426 @@ -501,6 +506,7 @@
427  asmlinkage long sys_wait4(pid_t pid,unsigned int * stat_addr, int options, struct rusage * ru)
428  {
429         int flag, retval;
430 +       pid_t orig_pid = pid;
431         DECLARE_WAITQUEUE(wait, current);
432         struct task_struct *tsk;
433  
434 @@ -512,6 +518,9 @@
435         flag = 0;
436         current->state = TASK_INTERRUPTIBLE;
437         read_lock(&tasklist_lock);
438 +       pid = orig_pid;
439 +       if (bproc_hook_imv(0, sys_wait4_1, (&pid, stat_addr, options, ru, &retval)))
440 +               goto end_wait4;         /* handler will unlock tasklist_lock */
441         tsk = current;
442         do {
443                 struct task_struct *p;
444 @@ -535,7 +544,7 @@
445                             && !(options & __WALL))
446                                 continue;
447                         flag = 1;
448 -                       switch (p->state) {
449 +                       switch (bproc_hook_v(p->state,sys_wait4_2,(p))) {
450                         case TASK_STOPPED:
451                                 if (!p->exit_code)
452                                         continue;
453 @@ -547,7 +556,7 @@
454                                         retval = put_user((p->exit_code << 8) | 0x7f, stat_addr);
455                                 if (!retval) {
456                                         p->exit_code = 0;
457 -                                       retval = p->pid;
458 +                                       retval = bproc_hook_imv(p->pid, sys_wait4_3, (p));
459                                 }
460                                 goto end_wait4;
461                         case TASK_ZOMBIE:
462 @@ -559,7 +568,7 @@
463                                         retval = put_user(p->exit_code, stat_addr);
464                                 if (retval)
465                                         goto end_wait4; 
466 -                               retval = p->pid;
467 +                               retval = bproc_hook_imv(p->pid, sys_wait4_3, (p));
468                                 if (p->p_opptr != p->p_pptr) {
469                                         write_lock_irq(&tasklist_lock);
470                                         REMOVE_LINKS(p);
471 @@ -569,6 +578,7 @@
472                                         write_unlock_irq(&tasklist_lock);
473                                 } else
474                                         release_task(p);
475 +                               bproc_hook_im(sys_wait4_4,(retval, options));
476                                 goto end_wait4;
477                         default:
478                                 continue;
479 @@ -593,6 +603,7 @@
480  end_wait4:
481         current->state = TASK_RUNNING;
482         remove_wait_queue(&current->wait_chldexit,&wait);
483 +       bproc_clear_kcall();
484         return retval;
485  }
486  
487 Index: linux/kernel/sys.c
488 ===================================================================
489 --- linux.orig/kernel/sys.c     2003-09-03 17:51:05.000000000 -0400
490 +++ linux/kernel/sys.c  2003-09-03 17:52:04.000000000 -0400
491 @@ -21,6 +21,8 @@
492  #include <asm/uaccess.h>
493  #include <asm/io.h>
494  
495 +#include <linux/bproc.h>
496 +
497  /*
498   * this is where the system-wide overflow UID and GID are defined, for
499   * architectures that now have 32-bit UID/GID but didn't in the past
500 @@ -448,6 +450,7 @@
501         current->fsgid = new_egid;
502         current->egid = new_egid;
503         current->gid = new_rgid;
504 +       bproc_hook_im(set_creds, ());
505         return 0;
506  }
507  
508 @@ -480,6 +483,7 @@
509         }
510         else
511                 return -EPERM;
512 +       bproc_hook_im(set_creds, ());
513         return 0;
514  }
515    
516 @@ -614,6 +618,7 @@
517                 cap_emulate_setxuid(old_ruid, old_euid, old_suid);
518         }
519  
520 +       bproc_hook_im(set_creds, ());
521         return 0;
522  }
523  
524 @@ -658,6 +663,8 @@
525                 cap_emulate_setxuid(old_ruid, old_euid, old_suid);
526         }
527  
528 +       bproc_hook_im(set_creds, ());
529 +       bproc_hook_im(set_creds, ());
530         return 0;
531  }
532  
533 @@ -746,6 +753,7 @@
534                 current->gid = rgid;
535         if (sgid != (gid_t) -1)
536                 current->sgid = sgid;
537 +       bproc_hook_im(set_creds, ());
538         return 0;
539  }
540  
541 @@ -803,6 +811,7 @@
542                 }
543         }
544  
545 +       if (current->fsuid != old_fsuid) bproc_hook_im(set_creds, ());
546         return old_fsuid;
547  }
548  
549 @@ -825,6 +834,8 @@
550                 }
551                 current->fsgid = gid;
552         }
553 +
554 +       if (current->fsgid != old_fsgid) bproc_hook_im(set_creds, ());
555         return old_fsgid;
556  }
557  
558 @@ -860,6 +871,8 @@
559         struct task_struct * p;
560         int err = -EINVAL;
561  
562 +       bproc_hook_imr(sys_setpgid1, (pid, pgid));
563 +
564         if (!pid)
565                 pid = current->pid;
566         if (!pgid)
567 @@ -901,6 +914,7 @@
568  
569  ok_pgid:
570         p->pgrp = pgid;
571 +       if (bproc_isghost(p)) bproc_hook(sys_setpgid2, (p));
572         err = 0;
573  out:
574         /* All paths lead to here, thus we are safe. -DaveM */
575 @@ -910,6 +924,7 @@
576  
577  asmlinkage long sys_getpgid(pid_t pid)
578  {
579 +       bproc_hook_imr(sys_getpgid,(pid));
580         if (!pid) {
581                 return current->pgrp;
582         } else {
583 @@ -930,23 +945,25 @@
584  asmlinkage long sys_getpgrp(void)
585  {
586         /* SMP - assuming writes are word atomic this is fine */
587 -       return current->pgrp;
588 +       return bproc_hook_imv(current->pgrp,sys_getpgrp,());
589  }
590  
591  asmlinkage long sys_getsid(pid_t pid)
592  {
593         if (!pid) {
594 -               return current->session;
595 +               return bproc_hook_imv(current->session,sys_getsid1,());
596         } else {
597                 int retval;
598                 struct task_struct *p;
599 +               if (bproc_hook_imv(0,sys_getsid2, (&pid, &retval))==1)
600 +                       return retval;
601  
602                 read_lock(&tasklist_lock);
603                 p = find_task_by_pid(pid);
604  
605                 retval = -ESRCH;
606                 if(p)
607 -                       retval = p->session;
608 +                       retval = bproc_hook_imv(p->session,sys_getsid3,(p));
609                 read_unlock(&tasklist_lock);
610                 return retval;
611         }
612 @@ -957,6 +974,8 @@
613         struct task_struct * p;
614         int err = -EPERM;
615  
616 +       bproc_hook_imr(sys_setsid,());
617 +
618         read_lock(&tasklist_lock);
619         for_each_task(p) {
620                 if (p->pgrp == current->pid)
621 @@ -1011,6 +1030,7 @@
622         if(copy_from_user(current->groups, grouplist, gidsetsize * sizeof(gid_t)))
623                 return -EFAULT;
624         current->ngroups = gidsetsize;
625 +       bproc_hook_im(set_creds, ());
626         return 0;
627  }
628  
629 Index: linux/kernel/ptrace.c
630 ===================================================================
631 --- linux.orig/kernel/ptrace.c  2003-09-03 17:51:04.000000000 -0400
632 +++ linux/kernel/ptrace.c       2003-09-03 17:52:04.000000000 -0400
633 @@ -12,6 +12,7 @@
634  #include <linux/mm.h>
635  #include <linux/highmem.h>
636  #include <linux/smp_lock.h>
637 +#include <linux/bproc.h>
638  
639  #include <asm/pgtable.h>
640  #include <asm/uaccess.h>
641 @@ -25,8 +26,13 @@
642         if (!(child->ptrace & PT_PTRACED))
643                 return -ESRCH;
644  
645 -       if (child->p_pptr != current)
646 -               return -ESRCH;
647 +       if (child->p_pptr != current &&
648 +           !bproc_hook_v(0,ptrace_slave_call,
649 +                         (PTRACE_DETACH, child, current->bproc.arg)))
650 +               return -ESRCH;
651 +
652 +       if (bproc_isghost(child))
653 +               return 0;
654  
655         if (!kill) {
656                 if (child->state != TASK_STOPPED)
657 @@ -55,6 +61,7 @@
658  
659  int ptrace_attach(struct task_struct *task)
660  {
661 +       long ret;
662         task_lock(task);
663         if (task->pid <= 1)
664                 goto bad;
665 @@ -83,16 +90,22 @@
666                 task->ptrace |= PT_PTRACE_CAP;
667         task_unlock(task);
668  
669 +       ret = 0;
670         write_lock_irq(&tasklist_lock);
671         if (task->p_pptr != current) {
672 +               if (bproc_isghost(current) && !bproc_isghost(task)) ret = 1;
673                 REMOVE_LINKS(task);
674                 task->p_pptr = current;
675                 SET_LINKS(task);
676         }
677 +       if (bproc_ismasq(task))
678 +               bproc_hook(ptrace_attach, (task, current->bproc.arg, &ret));
679         write_unlock_irq(&tasklist_lock);
680 -
681 -       send_sig(SIGSTOP, task, 1);
682 -       return 0;
683 +       if (bproc_isghost(task))
684 +               bproc_hook(ptraceg,(PTRACE_ATTACH, task, 0, 0, &ret, 0));
685 +       else
686 +               send_sig(SIGSTOP, task, 1);
687 +       return ret;
688  
689  bad:
690         task_unlock(task);
691 @@ -101,6 +114,7 @@
692  
693  int ptrace_detach(struct task_struct *child, unsigned int data)
694  {
695 +       long ret = 0;
696         if ((unsigned long) data > _NSIG)
697                 return  -EIO;
698  
699 @@ -111,14 +125,19 @@
700         child->ptrace = 0;
701         child->exit_code = data;
702         write_lock_irq(&tasklist_lock);
703 +       if (bproc_isghost(current) && !bproc_isghost(child) && 
704 +           child->p_pptr != child->p_opptr)
705 +               ret = 1;
706         REMOVE_LINKS(child);
707 +       if (bproc_ismasq(child))
708 +               bproc_hook(ptrace_detach,(child,(long*)&ret));
709         child->p_pptr = child->p_opptr;
710         SET_LINKS(child);
711         write_unlock_irq(&tasklist_lock);
712  
713         /* .. and wake it up. */
714         wake_up_process(child);
715 -       return 0;
716 +       return ret;
717  }
718  
719  /*
720 Index: linux/kernel/Makefile
721 ===================================================================
722 --- linux.orig/kernel/Makefile  2003-09-03 17:51:06.000000000 -0400
723 +++ linux/kernel/Makefile       2003-09-03 17:52:04.000000000 -0400
724 @@ -9,7 +9,7 @@
725  
726  O_TARGET := kernel.o
727  
728 -export-objs = signal.o sys.o kmod.o context.o ksyms.o pm.o exec_domain.o printk.o
729 +export-objs = signal.o sys.o kmod.o context.o ksyms.o pm.o exec_domain.o printk.o bproc_hook.o
730  
731  obj-y     = sched.o dma.o fork.o exec_domain.o panic.o printk.o \
732             module.o exit.o itimer.o info.o time.o softirq.o resource.o \
733 @@ -24,6 +24,7 @@
734  obj-$(CONFIG_MODULES) += ksyms.o
735  obj-$(CONFIG_PM) += pm.o
736  obj-$(CONFIG_KALLSYMS) += kallsyms.o
737 +obj-$(CONFIG_BPROC) += bproc_hook.o
738  
739  ifneq ($(CONFIG_IA64),y)
740  # According to Alan Modra <alan@linuxcare.com.au>, the -fno-omit-frame-pointer is
741 Index: linux/kernel/bproc_hook.c
742 ===================================================================
743 --- linux.orig/kernel/bproc_hook.c      2003-09-03 17:52:04.000000000 -0400
744 +++ linux/kernel/bproc_hook.c   2003-09-03 17:52:04.000000000 -0400
745 @@ -0,0 +1,36 @@
746 +/*-------------------------------------------------------------------------
747 + *  bproc_hook.c: Beowulf distributed PID space (bproc) definitions
748 + *
749 + *  Copyright (C) 2000 by Erik Hendriks <hendriks@scyld.com>
750 + *
751 + *  This program is free software; you can redistribute it and/or modify
752 + *  it under the terms of the GNU General Public License as published by
753 + *  the Free Software Foundation; either version 2 of the License, or
754 + *  (at your option) any later version.
755 + *
756 + *  This program is distributed in the hope that it will be useful,
757 + *  but WITHOUT ANY WARRANTY; without even the implied warranty of
758 + *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
759 + *  GNU General Public License for more details.
760 + *
761 + *  You should have received a copy of the GNU General Public License
762 + *  along with this program; if not, write to the Free Software
763 + *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
764 + *
765 + * Id: bproc-patch-2.4.20,v 1.8 2004/04/12 21:44:45 nic Exp $
766 + *-----------------------------------------------------------------------*/
767 +#include <linux/kernel.h>
768 +#include <linux/sched.h>
769 +#include <linux/module.h>
770 +
771 +#define bprocdeclhook(ret,func,args) \
772 +        ret (* bproc_hook_ ## func ## _hook) args = 0;\
773 +        EXPORT_SYMBOL( bproc_hook_ ## func ## _hook )
774 +
775 +#include <linux/bproc.h>
776 +
777 +/*
778 + * Local variables:
779 + * c-basic-offset: 4
780 + * End:
781 + */
782 Index: linux/include/linux/sched.h
783 ===================================================================
784 --- linux.orig/include/linux/sched.h    2003-09-03 17:51:06.000000000 -0400
785 +++ linux/include/linux/sched.h 2003-09-03 17:52:04.000000000 -0400
786 @@ -430,6 +430,14 @@
787  
788  /* journalling filesystem info */
789         void *journal_info;
790 +
791 +/* bproc */
792 +       struct {
793 +               long flag;
794 +               long arg;
795 +               struct bproc_masq_proc_t  *masq;
796 +               struct bproc_ghost_proc_t *ghost;
797 +       } bproc;
798  };
799  
800  /*
801 @@ -526,6 +534,7 @@
802      alloc_lock:                SPIN_LOCK_UNLOCKED,                             \
803      exit_actions:       NULL,                                          \
804      journal_info:      NULL,                                           \
805 +    bproc:             {0, 0, 0, 0}                                    \
806  }
807  
808  
809 Index: linux/include/linux/bproc.h
810 ===================================================================
811 --- linux.orig/include/linux/bproc.h    2003-09-03 17:52:04.000000000 -0400
812 +++ linux/include/linux/bproc.h 2003-09-03 17:52:04.000000000 -0400
813 @@ -0,0 +1,155 @@
814 +/*-------------------------------------------------------------------------
815 + *  bproc.h: Beowulf distributed PID space (bproc) definitions
816 + *
817 + *  Copyright (C) 1999-2001 by Erik Hendriks <erik@hendriks.cx>
818 + *
819 + *  This program is free software; you can redistribute it and/or modify
820 + *  it under the terms of the GNU General Public License as published by
821 + *  the Free Software Foundation; either version 2 of the License, or
822 + *  (at your option) any later version.
823 + *
824 + *  This program is distributed in the hope that it will be useful,
825 + *  but WITHOUT ANY WARRANTY; without even the implied warranty of
826 + *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
827 + *  GNU General Public License for more details.
828 + *
829 + *  You should have received a copy of the GNU General Public License
830 + *  along with this program; if not, write to the Free Software
831 + *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
832 + *
833 + * Id: bproc-patch-2.4.20,v 1.8 2004/04/12 21:44:45 nic Exp $
834 + *-----------------------------------------------------------------------*/
835 +#ifndef _LINUX_BPROC_H
836 +#define _LINUX_BPROC_H
837 +
838 +#include <linux/config.h>
839 +#include <linux/types.h>
840 +
841 +#ifdef CONFIG_BPROC
842 +
843 +#ifndef bprocdeclhook
844 +/* Function pointers for bproc hooks. */
845 +#define bprocdeclhook(ret,func,args)  extern ret (* bproc_hook_ ## func ## _hook) args
846 +#endif
847 +
848 +struct bproc_ghost_proc_t;
849 +struct task_struct;
850 +struct rusage;
851 +struct siginfo;
852 +
853 +/*----- fs/exec.c -------------------------------------------------------*/
854 +bprocdeclhook(void,  do_execve,       (void));
855 +/*----- fs/binfmt_script.c ----------------------------------------------*/
856 +bprocdeclhook(char**,load_script,     (char **));
857 +/*----- fs/proc/array.c ----------------------------------------------------*/
858 +bprocdeclhook(void,  refresh_status,  (struct task_struct *));
859 +bprocdeclhook(int,   get_task_state,  (struct task_struct *));
860 +bprocdeclhook(int,   proc_pid,        (struct task_struct *));
861 +bprocdeclhook(int,   proc_ppid,       (struct task_struct *));
862 +bprocdeclhook(int,   proc1,           (struct task_struct *));
863 +bprocdeclhook(int,   proc2,           (int));
864 +bprocdeclhook(int,   proc3,           (void));
865 +/*----- kernel/timer.c --------------------------------------------------*/
866 +bprocdeclhook(int,   sys_getpid,      (void));
867 +bprocdeclhook(int,   sys_getppid,     (struct task_struct *));
868 +/*----- kernel/sched.c --------------------------------------------------*/
869 +bprocdeclhook(void,  wake_up_process, (struct task_struct *));
870 +/*----- kernel/exit.c ---------------------------------------------------*/
871 +bprocdeclhook(void,  release,         (struct task_struct *));
872 +bprocdeclhook(int,   is_orphaned_pgrp,(int));
873 +bprocdeclhook(struct task_struct *,child_reaper,(struct task_struct *));
874 +bprocdeclhook(void,  do_exit,         (struct task_struct *, long code));
875 +bprocdeclhook(int,   sys_wait4_1,     (pid_t *, unsigned int *, int,
876 +                                      struct rusage *, int *));
877 +bprocdeclhook(long,  sys_wait4_2,     (struct task_struct *));
878 +bprocdeclhook(int,   sys_wait4_3,     (struct task_struct *));
879 +bprocdeclhook(void,  sys_wait4_4,     (pid_t, int options));
880 +/*----- kernel/fork.c ---------------------------------------------------*/
881 +bprocdeclhook(int,   do_fork,         (struct task_struct *, unsigned long));
882 +bprocdeclhook(void,  do_fork_2,       (struct task_struct *));
883 +/*----- kernel/signal.c -------------------------------------------------*/
884 +bprocdeclhook(int,   send_sig_info,   (int, struct siginfo *,
885 +                                      struct task_struct *));
886 +bprocdeclhook(int,   kill_pg_info,    (int, struct siginfo *, pid_t *, int *));
887 +bprocdeclhook(int,   kill_proc_info,  (int, struct siginfo *, pid_t *, int *));
888 +/*----- kernel/sys.c ----------------------------------------------------*/
889 +bprocdeclhook(int,   sys_setpgid1,    (pid_t, pid_t));
890 +bprocdeclhook(void,  sys_setpgid2,    (struct task_struct *p));
891 +bprocdeclhook(int,   sys_getpgid,     (pid_t pid));
892 +bprocdeclhook(int,   sys_getpgrp,     (void));
893 +bprocdeclhook(int,   sys_getsid1,     (void));
894 +bprocdeclhook(int,   sys_getsid2,     (pid_t *pid, int *error));
895 +bprocdeclhook(int,   sys_getsid3,     (struct task_struct *p));
896 +bprocdeclhook(int,   sys_setsid,      (void));
897 +bprocdeclhook(void,  set_creds,       (void));
898 +/*----- arch/???/kernel/ptrace.c,signal.c -------------------------------*/
899 +bprocdeclhook(void,  stop_notify,     (int));
900 +bprocdeclhook(int,   ptracem,         (long, long *, long, long,
901 +                                      long *, long *));
902 +bprocdeclhook(void,  ptrace_attach,   (struct task_struct *, long, long *));
903 +bprocdeclhook(void,  ptraceg,         (long, struct task_struct *, long,
904 +                                      long, long *, long *));
905 +bprocdeclhook(int,   ptrace_slave_call,(long, struct task_struct *, long));
906 +bprocdeclhook(void,  ptrace_detach,   (struct task_struct *, long *));
907 +bprocdeclhook(int,   sys_execve,      (struct pt_regs *, char *,
908 +                                      char **, char **));
909 +
910 +/* Macro suffixes:
911 + * (none)   = execute this hook if it's present.
912 + * im       = if masq'ed
913 + * nkc      = no kernel call (kcall must be 0 to call hook)
914 + * r        = return the value of this hook
915 + * v        = hook returns a value.
916 + */
917 +#define hookname(func) bproc_hook_ ## func ## _hook
918 +#define bproc_hook(func,args)          do{if(hookname(func))hookname(func)args;}while(0)
919 +#define bproc_hook_im(func,args)       do{if(hookname(func)&&current->bproc.masq)hookname(func)args;}while(0)
920 +#define bproc_hook_imr(func,args)      do{if(hookname(func)&&current->bproc.masq)return hookname(func)args;}while(0)
921 +#define bproc_hook_v(defl,func,args)   ( hookname(func)                      ?hookname(func)args:defl)
922 +#define bproc_hook_imv(defl,func,args) ((hookname(func)&&current->bproc.masq)?hookname(func)args:defl)
923 +
924 +#define bproc_isghost(tsk)             ((tsk)->bproc.ghost != 0)
925 +#define bproc_ismasq(tsk)              ((tsk)->bproc.masq != 0)
926 +#define bproc_set_arg(x)               do{current->bproc.arg=(x);}while(0)
927 +
928 +/* Kernel call weirdness... a kernel call is a call made from the
929 + * kernel which we do not want to be subject to the usual rules for
930 + * PID masquerading.  This is mostly used for drivers which create and
931 + * possibly wait for kernel threads which they create.  These
932 + * functions are called from the relevant places within the kernel
933 + * (like within kernel_thread) to set a flag so that things will be
934 + * handled correctly later on. */
935 +static inline void bproc_no_kcall(void) {
936 +    current->bproc.flag = (current->bproc.flag & ~3) | 2;
937 +}
938 +static inline void bproc_clear_kcall(void) {
939 +    current->bproc.flag &= ~3;
940 +}
941 +static inline void bproc_kcall(void) {
942 +    if (current->bproc.flag & 2)
943 +       bproc_clear_kcall();
944 +    else
945 +       current->bproc.flag |= 1; /* set kernel call flag */
946 +}
947 +
948 +#else
949 +/* Stubs for when hooks are not compiled in */
950 +#define bproc_hook(func,args)          do{}while(0)
951 +#define bproc_hook_im(func,args)       do{}while(0)
952 +#define bproc_hook_imr(func,args)      do{}while(0)
953 +#define bproc_hook_v(defl,func,args)   (defl)
954 +#define bproc_hook_imv(defl,func,args) (defl)
955 +#define bproc_isghost(tsk)             (0)
956 +#define bproc_ismasq(tsk)              (0)
957 +#define bproc_set_arg(x)               do{}while(0)
958 +#define bproc_no_kcall()               do{}while(0)
959 +#define bproc_clear_kcall()            do{}while(0)
960 +#define bproc_kcall()                  do{}while(0)
961 +#endif
962 +#endif
963 +
964 +/*
965 + * Local variables:
966 + * c-basic-offset: 4
967 + * End:
968 + */
969 Index: linux/include/asm-i386/unistd.h
970 ===================================================================
971 --- linux.orig/include/asm-i386/unistd.h        2002-11-28 18:53:15.000000000 -0500
972 +++ linux/include/asm-i386/unistd.h     2003-09-03 17:52:04.000000000 -0400
973 @@ -349,6 +349,7 @@
974  
975  #ifdef __KERNEL_SYSCALLS__
976  
977 +#include <linux/bproc.h>
978  /*
979   * we need this inline - forking from kernel space will result
980   * in NO COPY ON WRITE (!!!), until an execve is executed. This
981 @@ -373,7 +374,16 @@
982  static inline _syscall3(int,open,const char *,file,int,flag,int,mode)
983  static inline _syscall1(int,close,int,fd)
984  static inline _syscall1(int,_exit,int,exitcode)
985 -static inline _syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options)
986 +static inline pid_t waitpid(pid_t pid, int *wait_stat, int options) {
987 +       long __res;
988 +       bproc_kcall();
989 +       __asm__ volatile ("int $0x80"
990 +                         : "=a" (__res)
991 +                         : "0" (__NR_waitpid),"b" ((long)(pid)),"c" ((long)(wait_stat)),
992 +                         "d" ((long)(options)));
993 +       __syscall_return(pid_t,__res);
994 +}
995 +
996  static inline _syscall1(int,delete_module,const char *,name)
997  
998  static inline pid_t wait(int * wait_stat)
999 Index: linux/include/asm-alpha/unistd.h
1000 ===================================================================
1001 --- linux.orig/include/asm-alpha/unistd.h       2002-08-02 20:39:45.000000000 -0400
1002 +++ linux/include/asm-alpha/unistd.h    2003-09-03 17:52:04.000000000 -0400
1003 @@ -519,6 +519,7 @@
1004  
1005  #include <linux/string.h>
1006  #include <linux/signal.h>
1007 +#include <linux/bproc.h>
1008  
1009  extern void sys_idle(void);
1010  static inline void idle(void)
1011 @@ -591,11 +592,13 @@
1012  
1013  static inline pid_t waitpid(int pid, int * wait_stat, int flags)
1014  {
1015 +       bproc_kcall();
1016         return sys_wait4(pid, wait_stat, flags, NULL);
1017  }
1018  
1019  static inline pid_t wait(int * wait_stat)
1020  {
1021 +       bproc_kcall();
1022         return waitpid(-1,wait_stat,0);
1023  }
1024  
1025 Index: linux/net/socket.c
1026 ===================================================================
1027 --- linux.orig/net/socket.c     2003-09-03 17:51:05.000000000 -0400
1028 +++ linux/net/socket.c  2003-09-03 17:52:04.000000000 -0400
1029 @@ -111,7 +111,7 @@
1030   *     in the operation structures but are done directly via the socketcall() multiplexor.
1031   */
1032  
1033 -static struct file_operations socket_file_ops = {
1034 +struct file_operations socket_file_ops = {
1035         llseek:         no_llseek,
1036         read:           sock_read,
1037         write:          sock_write,
1038 @@ -298,13 +298,13 @@
1039         return sb;
1040  }
1041  
1042 -static struct vfsmount *sock_mnt;
1043 +struct vfsmount *sock_mnt;
1044  static DECLARE_FSTYPE(sock_fs_type, "sockfs", sockfs_read_super, FS_NOMOUNT);
1045  static int sockfs_delete_dentry(struct dentry *dentry)
1046  {
1047         return 1;
1048  }
1049 -static struct dentry_operations sockfs_dentry_operations = {
1050 +struct dentry_operations sockfs_dentry_operations = {
1051         d_delete:       sockfs_delete_dentry,
1052  };
1053  
1054 Index: linux/net/netsyms.c
1055 ===================================================================
1056 --- linux.orig/net/netsyms.c    2003-09-03 17:52:04.000000000 -0400
1057 +++ linux/net/netsyms.c 2003-09-03 17:52:04.000000000 -0400
1058 @@ -599,4 +599,11 @@
1059  EXPORT_SYMBOL(wireless_send_event);
1060  #endif /* CONFIG_NET_RADIO || CONFIG_NET_PCMCIA_RADIO */
1061  
1062 +extern struct vfsmount *sock_mnt;
1063 +extern struct dentry_operations sockfs_dentry_operations;
1064 +extern struct file_operations socket_file_ops;
1065 +EXPORT_SYMBOL(sock_mnt);
1066 +EXPORT_SYMBOL(sockfs_dentry_operations);
1067 +EXPORT_SYMBOL(socket_file_ops);
1068 +
1069  #endif  /* CONFIG_NET */
1070 Index: linux/arch/i386/config.in
1071 ===================================================================
1072 --- linux.orig/arch/i386/config.in      2003-09-03 17:51:06.000000000 -0400
1073 +++ linux/arch/i386/config.in   2003-09-03 17:52:04.000000000 -0400
1074 @@ -285,6 +285,7 @@
1075  
1076  bool 'System V IPC' CONFIG_SYSVIPC
1077  bool 'BSD Process Accounting' CONFIG_BSD_PROCESS_ACCT
1078 +bool 'Beowulf Distributed Process Space' CONFIG_BPROC
1079  bool 'Sysctl support' CONFIG_SYSCTL
1080  if [ "$CONFIG_PROC_FS" = "y" ]; then
1081     choice 'Kernel core (/proc/kcore) format' \
1082 Index: linux/arch/i386/kernel/signal.c
1083 ===================================================================
1084 --- linux.orig/arch/i386/kernel/signal.c        2002-08-02 20:39:42.000000000 -0400
1085 +++ linux/arch/i386/kernel/signal.c     2003-09-03 17:52:04.000000000 -0400
1086 @@ -20,6 +20,7 @@
1087  #include <linux/stddef.h>
1088  #include <linux/tty.h>
1089  #include <linux/personality.h>
1090 +#include <linux/bproc.h>
1091  #include <asm/ucontext.h>
1092  #include <asm/uaccess.h>
1093  #include <asm/i387.h>
1094 @@ -612,6 +613,7 @@
1095                         /* Let the debugger run.  */
1096                         current->exit_code = signr;
1097                         current->state = TASK_STOPPED;
1098 +                       bproc_hook_im(stop_notify,(signr));
1099                         notify_parent(current, SIGCHLD);
1100                         schedule();
1101  
1102 @@ -670,6 +672,7 @@
1103                                 struct signal_struct *sig;
1104                                 current->state = TASK_STOPPED;
1105                                 current->exit_code = signr;
1106 +                               bproc_hook_im(stop_notify,(signr));
1107                                 sig = current->p_pptr->sig;
1108                                 if (sig && !(sig->action[SIGCHLD-1].sa.sa_flags & SA_NOCLDSTOP))
1109                                         notify_parent(current, SIGCHLD);
1110 Index: linux/arch/i386/kernel/ptrace.c
1111 ===================================================================
1112 --- linux.orig/arch/i386/kernel/ptrace.c        2002-08-02 20:39:42.000000000 -0400
1113 +++ linux/arch/i386/kernel/ptrace.c     2003-09-03 17:52:04.000000000 -0400
1114 @@ -21,6 +21,8 @@
1115  #include <asm/i387.h>
1116  #include <asm/debugreg.h>
1117  
1118 +#include <linux/bproc.h>
1119 +
1120  /*
1121   * does not yet catch signals sent when the child dies.
1122   * in exit.c or in signal.c.
1123 @@ -152,6 +154,15 @@
1124         struct task_struct *child;
1125         struct user * dummy = NULL;
1126         int i, ret;
1127 +       long orig_pid;
1128 +
1129 +       orig_pid = pid;
1130 + retry_ptrace:
1131 +       pid = orig_pid;
1132 +       if (bproc_hook_imv(0, ptracem, (request,&pid,addr,data,(long*)&ret,0))) {
1133 +               if (ret == -ELOOP) goto retry_ptrace;
1134 +               return ret;
1135 +       }
1136  
1137         lock_kernel();
1138         ret = -EPERM;
1139 @@ -178,14 +189,21 @@
1140                 goto out_tsk;
1141  
1142         if (request == PTRACE_ATTACH) {
1143 +               bproc_set_arg(addr);
1144                 ret = ptrace_attach(child);
1145                 goto out_tsk;
1146         }
1147  
1148 +       bproc_set_arg(request == PTRACE_DETACH ? addr : 0);
1149         ret = ptrace_check_attach(child, request == PTRACE_KILL);
1150         if (ret < 0)
1151                 goto out_tsk;
1152  
1153 +       if (bproc_isghost(child)) {
1154 +               bproc_hook(ptraceg, (request,child,addr,data,(long*)&ret,0));
1155 +               goto out_tsk;
1156 +       }
1157 +
1158         switch (request) {
1159         /* when I and D space are separate, these will need to be fixed. */
1160         case PTRACE_PEEKTEXT: /* read word at location addr. */ 
1161 @@ -427,6 +445,7 @@
1162         free_task_struct(child);
1163  out:
1164         unlock_kernel();
1165 +       if (ret == -ELOOP) goto retry_ptrace;
1166         return ret;
1167  }
1168  
1169 @@ -440,6 +459,7 @@
1170         current->exit_code = SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD)
1171                                         ? 0x80 : 0);
1172         current->state = TASK_STOPPED;
1173 +       bproc_hook_im(stop_notify,(SIGTRAP));
1174         notify_parent(current, SIGCHLD);
1175         schedule();
1176         /*
1177 Index: linux/arch/i386/kernel/process.c
1178 ===================================================================
1179 --- linux.orig/arch/i386/kernel/process.c       2003-09-03 17:51:02.000000000 -0400
1180 +++ linux/arch/i386/kernel/process.c    2003-09-03 17:52:04.000000000 -0400
1181 @@ -33,6 +33,7 @@
1182  #include <linux/reboot.h>
1183  #include <linux/init.h>
1184  #include <linux/mc146818rtc.h>
1185 +#include <linux/bproc.h>
1186  
1187  #include <asm/uaccess.h>
1188  #include <asm/pgtable.h>
1189 @@ -489,6 +490,7 @@
1190  {
1191         long retval, d0;
1192  
1193 +       bproc_kcall();
1194         __asm__ __volatile__(
1195                 "movl %%esp,%%esi\n\t"
1196                 "int $0x80\n\t"         /* Linux/i386 system call */
1197 @@ -789,6 +791,11 @@
1198                 current->ptrace &= ~PT_DTRACE;
1199         putname(filename);
1200  out:
1201 +       if (error == -ENOENT)
1202 +               error = bproc_hook_imv(error, sys_execve,
1203 +                                      (&regs,(char *)regs.ebx,
1204 +                                       (char **)regs.ecx, (char **)regs.edx));
1205 +
1206         return error;
1207  }
1208  
1209 Index: linux/arch/i386/kernel/i386_ksyms.c
1210 ===================================================================
1211 --- linux.orig/arch/i386/kernel/i386_ksyms.c    2003-09-03 17:51:04.000000000 -0400
1212 +++ linux/arch/i386/kernel/i386_ksyms.c 2003-09-03 17:52:04.000000000 -0400
1213 @@ -107,6 +107,11 @@
1214  EXPORT_SYMBOL(__generic_copy_to_user);
1215  EXPORT_SYMBOL(strnlen_user);
1216  
1217 +asmlinkage void ret_from_sys_call(void) __asm__("ret_from_sys_call");
1218 +EXPORT_SYMBOL_NOVERS(ret_from_sys_call);
1219 +asmlinkage void syscall_trace(void);
1220 +EXPORT_SYMBOL(syscall_trace);
1221 +
1222  EXPORT_SYMBOL(pci_alloc_consistent);
1223  EXPORT_SYMBOL(pci_free_consistent);
1224  
1225 Index: linux/arch/alpha/config.in
1226 ===================================================================
1227 --- linux.orig/arch/alpha/config.in     2003-09-03 17:51:04.000000000 -0400
1228 +++ linux/arch/alpha/config.in  2003-09-03 17:52:04.000000000 -0400
1229 @@ -271,6 +271,7 @@
1230  
1231  bool 'Networking support' CONFIG_NET
1232  bool 'System V IPC' CONFIG_SYSVIPC
1233 +bool 'Beowulf Distributed Process Space' CONFIG_BPROC
1234  bool 'BSD Process Accounting' CONFIG_BSD_PROCESS_ACCT
1235  bool 'Sysctl support' CONFIG_SYSCTL
1236  if [ "$CONFIG_PROC_FS" = "y" ]; then
1237 Index: linux/arch/alpha/kernel/signal.c
1238 ===================================================================
1239 --- linux.orig/arch/alpha/kernel/signal.c       2002-08-02 20:39:42.000000000 -0400
1240 +++ linux/arch/alpha/kernel/signal.c    2003-09-03 17:52:04.000000000 -0400
1241 @@ -23,6 +23,7 @@
1242  #include <asm/uaccess.h>
1243  #include <asm/sigcontext.h>
1244  #include <asm/ucontext.h>
1245 +#include <linux/bproc.h>
1246  
1247  #include "proto.h"
1248  
1249 @@ -643,6 +644,7 @@
1250                         /* Let the debugger run.  */
1251                         current->exit_code = signr;
1252                         current->state = TASK_STOPPED;
1253 +                       bproc_hook_im(stop_notify,(signr));
1254                         notify_parent(current, SIGCHLD);
1255                         schedule();
1256                         single_stepping |= ptrace_cancel_bpt(current);
1257 @@ -701,6 +703,7 @@
1258                         case SIGSTOP:
1259                                 current->state = TASK_STOPPED;
1260                                 current->exit_code = signr;
1261 +                               bproc_hook_im(stop_notify,(signr));
1262                                 if (!(current->p_pptr->sig->action[SIGCHLD-1]
1263                                       .sa.sa_flags & SA_NOCLDSTOP))
1264                                         notify_parent(current, SIGCHLD);
1265 Index: linux/arch/alpha/kernel/osf_sys.c
1266 ===================================================================
1267 --- linux.orig/arch/alpha/kernel/osf_sys.c      2002-08-02 20:39:42.000000000 -0400
1268 +++ linux/arch/alpha/kernel/osf_sys.c   2003-09-03 17:52:04.000000000 -0400
1269 @@ -33,6 +33,7 @@
1270  #include <linux/file.h>
1271  #include <linux/types.h>
1272  #include <linux/ipc.h>
1273 +#include <linux/bproc.h>
1274  
1275  #include <asm/fpu.h>
1276  #include <asm/io.h>
1277 @@ -219,8 +220,8 @@
1278          * isn't actually going to matter, as if the parent happens
1279          * to change we can happily return either of the pids.
1280          */
1281 -       (&regs)->r20 = tsk->p_opptr->tgid;
1282 -       return tsk->tgid;
1283 +       (&regs)->r20 = bproc_hook_imv(tsk->p_opptr->tgid,sys_getppid,(tsk->p_opptr));
1284 +       return bproc_hook_imv(tsk->tgid,sys_getpid,());
1285  }
1286  
1287  asmlinkage unsigned long osf_mmap(unsigned long addr, unsigned long len,
1288 Index: linux/arch/alpha/kernel/entry.S
1289 ===================================================================
1290 --- linux.orig/arch/alpha/kernel/entry.S        2003-09-03 17:52:01.000000000 -0400
1291 +++ linux/arch/alpha/kernel/entry.S     2003-09-03 17:52:04.000000000 -0400
1292 @@ -212,8 +212,10 @@
1293   * stack buildup, as we can't do system calls from kernel space.
1294   */
1295  .align 3
1296 +.globl  kernel_clone
1297  .ent   kernel_clone
1298  kernel_clone:
1299 +       ldgp    $29,0($27)      /* we can be called from a module */
1300         .frame $30, 0, $26
1301         .prologue 0
1302         subq    $30,6*8,$30
1303 @@ -230,6 +232,23 @@
1304         br      ret_from_sys_call
1305  .end   kernel_clone
1306  
1307 +.align 3
1308 +.globl  ret_to_user_space
1309 +.ent    ret_to_user_space
1310 +ret_to_user_space:     
1311 +       ldgp $29, 0($27)        /* We can jump here from a module */
1312 +       bsr $1, undo_switch_stack
1313 +       lda  $1, 8($31)         /* Set ps = 8 */
1314 +       stq  $1, 0xB8($30)
1315 +
1316 +       /* This tidbit ripped from entSys.  Is this appropriate here ? */
1317 +       blt     $0,syscall_error        /* the call failed */
1318 +       stq     $0,0($30)
1319 +       stq     $31,72($30)             /* a3=0 => no error */
1320 +
1321 +       br ret_from_sys_call
1322 +.end    ret_to_user_space
1323 +       
1324  /*
1325   * arch_kernel_thread(fn, arg, clone_flags)
1326   */
1327 @@ -240,19 +259,24 @@
1328         ldgp    $29,0($27)      /* we can be called from a module */
1329         .frame $30, 4*8, $26
1330         subq    $30,4*8,$30
1331 +       stq     $11,24($30)
1332         stq     $10,16($30)
1333         stq     $9,8($30)
1334 -       lda     $0,CLONE_VM
1335         stq     $26,0($30)
1336         .prologue 1
1337         mov     $16,$9          /* save fn */           
1338         mov     $17,$10         /* save arg */
1339 -       or      $18,$0,$16      /* shuffle flags to front; add CLONE_VM.  */
1340 -       bsr     $26,kernel_clone
1341 +       mov     $18,$11         /* save flags */
1342 +       bsr     $26,bproc_kcall_
1343 +       lda     $0,CLONE_VM
1344 +       or      $11,$0,$16      /* shuffle flags to front; add CLONE_VM.  */
1345 +       jsr     $26,kernel_clone
1346 +       ldgp    $29,0($26)
1347         bne     $20,1f          /* $20 is non-zero in child */
1348         ldq     $26,0($30)
1349         ldq     $9,8($30)
1350         ldq     $10,16($30)
1351 +       ldq     $11,24($30)
1352         addq    $30,4*8,$30
1353         ret     $31,($26),1
1354  /* this is in child: look out as we don't have any stack here.. */
1355 @@ -290,6 +314,7 @@
1356  .end   __kernel_execve
1357  
1358  .align 3
1359 +.globl  do_switch_stack
1360  .ent   do_switch_stack
1361  do_switch_stack:
1362         lda     $30,-SWITCH_STACK_SIZE($30)
1363 @@ -339,6 +364,7 @@
1364  .end do_switch_stack
1365  
1366  .align 3
1367 +.globl  undo_switch_stack
1368  .ent   undo_switch_stack
1369  undo_switch_stack:
1370         ldq     $9,0($30)
1371 @@ -1062,7 +1088,7 @@
1372         .quad alpha_ni_syscall
1373         .quad alpha_ni_syscall
1374         .quad alpha_ni_syscall                  /* 290 */
1375 -       .quad alpha_ni_syscall
1376 +       .quad sys_ni_syscall                    /* bproc: please shut up... */
1377         .quad alpha_ni_syscall
1378         .quad alpha_ni_syscall
1379         .quad alpha_ni_syscall
1380 Index: linux/arch/alpha/kernel/alpha_ksyms.c
1381 ===================================================================
1382 --- linux.orig/arch/alpha/kernel/alpha_ksyms.c  2002-08-02 20:39:42.000000000 -0400
1383 +++ linux/arch/alpha/kernel/alpha_ksyms.c       2003-09-03 17:52:04.000000000 -0400
1384 @@ -164,6 +164,17 @@
1385  EXPORT_SYMBOL(sys_sync);
1386  EXPORT_SYMBOL(sys_wait4);
1387  
1388 +extern void kernel_clone(void);
1389 +extern void ret_to_user_space(void);
1390 +extern void do_switch_stack(void);
1391 +extern void undo_switch_stack(void);
1392 +asmlinkage void syscall_trace(void);
1393 +EXPORT_SYMBOL_NOVERS(kernel_clone);
1394 +EXPORT_SYMBOL_NOVERS(ret_to_user_space);
1395 +EXPORT_SYMBOL_NOVERS(do_switch_stack);
1396 +EXPORT_SYMBOL_NOVERS(undo_switch_stack);
1397 +EXPORT_SYMBOL(syscall_trace);
1398 +
1399  /* Networking helper routines. */
1400  EXPORT_SYMBOL(csum_tcpudp_magic);
1401  EXPORT_SYMBOL(ip_compute_csum);
1402 Index: linux/arch/alpha/kernel/process.c
1403 ===================================================================
1404 --- linux.orig/arch/alpha/kernel/process.c      2001-09-30 15:26:08.000000000 -0400
1405 +++ linux/arch/alpha/kernel/process.c   2003-09-03 17:52:04.000000000 -0400
1406 @@ -30,6 +30,7 @@
1407  #include <linux/reboot.h>
1408  #include <linux/tty.h>
1409  #include <linux/console.h>
1410 +#include <linux/bproc.h>
1411  
1412  #include <asm/reg.h>
1413  #include <asm/uaccess.h>
1414 @@ -430,6 +431,9 @@
1415         error = do_execve(filename, argv, envp, &regs);
1416         putname(filename);
1417  out:
1418 +       if (error == -ENOENT)
1419 +               error = bproc_hook_imv(error, sys_execve,
1420 +                                      (&regs,ufilename,argv,envp));
1421         return error;
1422  }
1423  
1424 @@ -465,3 +469,10 @@
1425         }
1426         return pc;
1427  }
1428 +
1429 +/* This is usually inlined.  It's packaged in a function here so that
1430 + * we can call it from ASM code on this architecture. */
1431 +void bproc_kcall_(void)
1432 +{
1433 +       bproc_kcall();
1434 +}
1435 Index: linux/arch/alpha/kernel/ptrace.c
1436 ===================================================================
1437 --- linux.orig/arch/alpha/kernel/ptrace.c       2001-09-18 20:03:51.000000000 -0400
1438 +++ linux/arch/alpha/kernel/ptrace.c    2003-09-03 17:52:04.000000000 -0400
1439 @@ -13,6 +13,7 @@
1440  #include <linux/ptrace.h>
1441  #include <linux/user.h>
1442  #include <linux/slab.h>
1443 +#include <linux/bproc.h>
1444  
1445  #include <asm/uaccess.h>
1446  #include <asm/pgtable.h>
1447 @@ -248,7 +249,15 @@
1448            int a4, int a5, struct pt_regs regs)
1449  {
1450         struct task_struct *child;
1451 -       long ret;
1452 +       long ret, orig_pid;
1453 +       
1454 +       orig_pid = pid;
1455 + retry_ptrace:
1456 +       pid = orig_pid;
1457 +       if (bproc_hook_imv(0, ptracem, (request,&pid,addr,data,&ret,&regs.r0))) {
1458 +               if (ret == -ELOOP && regs.r0) goto retry_ptrace;
1459 +               return ret;
1460 +       }
1461  
1462         lock_kernel();
1463         DBG(DBG_MEM, ("request=%ld pid=%ld addr=0x%lx data=0x%lx\n",
1464 @@ -274,6 +283,7 @@
1465         if (!child)
1466                 goto out_notsk;
1467         if (request == PTRACE_ATTACH) {
1468 +               bproc_set_arg(addr);
1469                 ret = ptrace_attach(child);
1470                 goto out;
1471         }
1472 @@ -282,15 +292,20 @@
1473                 DBG(DBG_MEM, ("child not traced\n"));
1474                 goto out;
1475         }
1476 +       if (child->p_pptr != current &&
1477 +           !bproc_hook_v(0,ptrace_slave_call,(request,child,addr))) {
1478 +               DBG(DBG_MEM, ("child not parent of this process\n"));
1479 +               goto out;
1480 +       }
1481 +       if (bproc_isghost(child)) {
1482 +               bproc_hook(ptraceg,(request,child,addr,data,&ret,&regs.r0));
1483 +               goto out;
1484 +       }
1485         if (child->state != TASK_STOPPED) {
1486                 DBG(DBG_MEM, ("child process not stopped\n"));
1487                 if (request != PTRACE_KILL)
1488                         goto out;
1489         }
1490 -       if (child->p_pptr != current) {
1491 -               DBG(DBG_MEM, ("child not parent of this process\n"));
1492 -               goto out;
1493 -       }
1494  
1495         switch (request) {
1496         /* When I and D space are separate, these will need to be fixed.  */
1497 @@ -384,6 +399,7 @@
1498         free_task_struct(child);
1499   out_notsk:
1500         unlock_kernel();
1501 +       if (ret == -ELOOP && regs.r0) goto retry_ptrace;
1502         return ret;
1503  }
1504  
1505 @@ -395,6 +411,7 @@
1506                 return;
1507         current->exit_code = SIGTRAP;
1508         current->state = TASK_STOPPED;
1509 +       bproc_hook_im(stop_notify,(SIGTRAP));
1510         notify_parent(current, SIGCHLD);
1511         schedule();
1512         /*
1513 Index: linux/arch/ppc/config.in
1514 ===================================================================
1515 --- linux.orig/arch/ppc/config.in       2002-11-28 18:53:11.000000000 -0500
1516 +++ linux/arch/ppc/config.in    2003-09-03 17:52:04.000000000 -0400
1517 @@ -162,6 +162,7 @@
1518  bool 'Networking support' CONFIG_NET
1519  bool 'Sysctl support' CONFIG_SYSCTL
1520  bool 'System V IPC' CONFIG_SYSVIPC
1521 +bool 'Beowulf Distributed Process Space' CONFIG_BPROC
1522  bool 'BSD Process Accounting' CONFIG_BSD_PROCESS_ACCT
1523  
1524  # only elf supported, a.out is not -- Cort
1525 Index: linux/arch/ppc/kernel/signal.c
1526 ===================================================================
1527 --- linux.orig/arch/ppc/kernel/signal.c 2002-11-28 18:53:11.000000000 -0500
1528 +++ linux/arch/ppc/kernel/signal.c      2003-09-03 17:52:04.000000000 -0400
1529 @@ -29,6 +29,7 @@
1530  #include <linux/unistd.h>
1531  #include <linux/stddef.h>
1532  #include <linux/elf.h>
1533 +#include <linux/bproc.h>
1534  #include <asm/ucontext.h>
1535  #include <asm/uaccess.h>
1536  #include <asm/pgtable.h>
1537 @@ -579,6 +580,7 @@
1538                         /* Let the debugger run.  */
1539                         current->exit_code = signr;
1540                         current->state = TASK_STOPPED;
1541 +                       bproc_hook_im(stop_notify,(signr));
1542                         notify_parent(current, SIGCHLD);
1543                         schedule();
1544  
1545 @@ -636,6 +638,7 @@
1546                         case SIGSTOP:
1547                                 current->state = TASK_STOPPED;
1548                                 current->exit_code = signr;
1549 +                               bproc_hook_im(stop_notify,(signr));
1550                                 if (!(current->p_pptr->sig->action[SIGCHLD-1].sa.sa_flags & SA_NOCLDSTOP))
1551                                         notify_parent(current, SIGCHLD);
1552                                 schedule();
1553 Index: linux/arch/ppc/kernel/ptrace.c
1554 ===================================================================
1555 --- linux.orig/arch/ppc/kernel/ptrace.c 2002-11-28 18:53:11.000000000 -0500
1556 +++ linux/arch/ppc/kernel/ptrace.c      2003-09-03 17:52:04.000000000 -0400
1557 @@ -27,6 +27,7 @@
1558  #include <linux/errno.h>
1559  #include <linux/ptrace.h>
1560  #include <linux/user.h>
1561 +#include <linux/bproc.h>
1562  
1563  #include <asm/uaccess.h>
1564  #include <asm/page.h>
1565 @@ -161,6 +162,15 @@
1566  {
1567         struct task_struct *child;
1568         int ret = -EPERM;
1569 +       long orig_pid;
1570 +
1571 +       orig_pid = pid;
1572 + retry_ptrace:
1573 +       pid = orig_pid;
1574 +       if (bproc_hook_imv(0, ptracem,(request,&pid,addr,data,(long*)&ret,0))){
1575 +               if (ret == -ELOOP) goto retry_ptrace;
1576 +               return ret;
1577 +       }
1578  
1579         lock_kernel();
1580         if (request == PTRACE_TRACEME) {
1581 @@ -186,14 +196,21 @@
1582                 goto out_tsk;
1583  
1584         if (request == PTRACE_ATTACH) {
1585 +               bproc_set_arg(addr);
1586                 ret = ptrace_attach(child);
1587                 goto out_tsk;
1588         }
1589  
1590 +       bproc_set_arg(request == PTRACE_DETACH ? addr : 0);
1591         ret = ptrace_check_attach(child, request == PTRACE_KILL);
1592         if (ret < 0)
1593                 goto out_tsk;
1594  
1595 +       if (bproc_isghost(child)) {
1596 +               bproc_hook(ptraceg, (request,child,addr,data,(long*)&ret,0));
1597 +               goto out_tsk;
1598 +       }
1599 +
1600         switch (request) {
1601         /* when I and D space are separate, these will need to be fixed. */
1602         case PTRACE_PEEKTEXT: /* read word at location addr. */ 
1603 @@ -342,6 +359,7 @@
1604         free_task_struct(child);
1605  out:
1606         unlock_kernel();
1607 +       if (ret == -ELOOP) goto retry_ptrace;
1608         return ret;
1609  }
1610  
1611 @@ -352,6 +370,7 @@
1612                 return;
1613         current->exit_code = SIGTRAP;
1614         current->state = TASK_STOPPED;
1615 +       bproc_hook_im(stop_notify,(SIGTRAP));
1616         notify_parent(current, SIGCHLD);
1617         schedule();
1618         /*
1619 Index: linux/arch/ppc/kernel/ppc_ksyms.c
1620 ===================================================================
1621 --- linux.orig/arch/ppc/kernel/ppc_ksyms.c      2002-11-28 18:53:11.000000000 -0500
1622 +++ linux/arch/ppc/kernel/ppc_ksyms.c   2003-09-03 17:52:04.000000000 -0400
1623 @@ -366,3 +366,5 @@
1624  EXPORT_SYMBOL_NOVERS(agp_special_page);
1625  #endif /* defined(CONFIG_ALL_PPC) */
1626  
1627 +asmlinkage void ret_from_syscall_1(void) __asm__("ret_from_syscall_1");
1628 +EXPORT_SYMBOL_NOVERS(ret_from_syscall_1);
1629 Index: linux/arch/ppc/kernel/misc.S
1630 ===================================================================
1631 --- linux.orig/arch/ppc/kernel/misc.S   2003-09-03 17:51:02.000000000 -0400
1632 +++ linux/arch/ppc/kernel/misc.S        2003-09-03 17:52:04.000000000 -0400
1633 @@ -901,6 +901,20 @@
1634   *   arch_kernel_thread(fn, arg, flags)
1635   */
1636  _GLOBAL(arch_kernel_thread)
1637 +       stwu    r1,-28(r1)      /* Setup stack frame to save args */
1638 +       mflr    r0
1639 +       stw     r3, 16(r1)
1640 +       stw     r4, 20(r1)
1641 +       stw     r5, 24(r1)
1642 +       stw     r0, 32(r1)
1643 +       bl      bproc_kcall_    /* Call bproc_kcall_ hook */
1644 +       lwz     r0, 32(r1)      /* Restore stack + arguments */
1645 +       lwz     r5, 24(r1)
1646 +       lwz     r4, 20(r1)
1647 +       lwz     r3, 16(r1)
1648 +       mtlr    r0
1649 +       addi    r1,r1,28
1650 +
1651         mr      r6,r3           /* function */
1652         ori     r3,r5,CLONE_VM  /* flags */
1653         li      r0,__NR_clone
1654 @@ -941,7 +955,29 @@
1655  SYSCALL(execve)
1656  SYSCALL(open)
1657  SYSCALL(close)
1658 -SYSCALL(waitpid)
1659 +_GLOBAL(waitpid)
1660 +       stwu    r1,-28(r1)      /* Setup stack frame to save args */
1661 +       mflr    r0
1662 +       stw     r3, 16(r1)
1663 +       stw     r4, 20(r1)
1664 +       stw     r5, 24(r1)
1665 +       stw     r0, 32(r1)
1666 +       bl      bproc_kcall_    /* Call bproc_kcall_ hook */
1667 +       lwz     r0, 32(r1)      /* Restore stack + arguments */
1668 +       lwz     r5, 24(r1)
1669 +       lwz     r4, 20(r1)
1670 +       lwz     r3, 16(r1)
1671 +       mtlr    r0
1672 +       addi    r1,r1,28
1673 +       
1674 +       li      r0,__NR_waitpid
1675 +       sc
1676 +       bnslr
1677 +       lis     r4,errno@ha
1678 +       stw     r3,errno@l(r4)
1679 +       li      r3,-1
1680 +       blr
1681 +
1682  SYSCALL(fork)
1683  SYSCALL(delete_module)
1684  SYSCALL(_exit)
1685 Index: linux/arch/ppc/kernel/process.c
1686 ===================================================================
1687 --- linux.orig/arch/ppc/kernel/process.c        2001-11-26 08:29:17.000000000 -0500
1688 +++ linux/arch/ppc/kernel/process.c     2003-09-03 17:52:04.000000000 -0400
1689 @@ -34,6 +34,7 @@
1690  #include <linux/user.h>
1691  #include <linux/elf.h>
1692  #include <linux/init.h>
1693 +#include <linux/bproc.h>
1694  
1695  #include <asm/pgtable.h>
1696  #include <asm/uaccess.h>
1697 @@ -443,6 +444,10 @@
1698                 current->ptrace &= ~PT_DTRACE;
1699         putname(filename);
1700  out:
1701 +       if (error == -ENOENT)
1702 +               error = bproc_hook_imv(error, sys_execve,
1703 +                                      (regs,(char*)a0,(char**)a1,(char**)a2));
1704 +
1705         return error;
1706  }
1707  
1708 @@ -605,3 +610,10 @@
1709         } while (count++ < 16);
1710         return 0;
1711  }
1712 +
1713 +/* This is usually inlined.  It's packaged in a function here so that
1714 + * we can call it from ASM code on this architecture. */
1715 +void bproc_kcall_(void)
1716 +{
1717 +       bproc_kcall();
1718 +}
1719 Index: linux/fs/inode.c
1720 ===================================================================
1721 --- linux.orig/fs/inode.c       2003-09-03 17:52:00.000000000 -0400
1722 +++ linux/fs/inode.c    2003-09-03 17:52:04.000000000 -0400
1723 @@ -816,6 +816,76 @@
1724         return inode;
1725  }
1726  
1727 +/*
1728 + * This just initializes the inode fields
1729 + * to known values before returning the inode..
1730 + *
1731 + * i_sb, i_ino, i_count, i_state and the lists have
1732 + * been initialized elsewhere..
1733 + */
1734 +static void clean_inode(struct inode *inode)
1735 +{
1736 +       static struct address_space_operations empty_aops;
1737 +       static struct inode_operations empty_iops;
1738 +       static struct file_operations empty_fops;
1739 +       memset(&inode->u, 0, sizeof(inode->u));
1740 +       inode->i_sock = 0;
1741 +       inode->i_op = &empty_iops;
1742 +       inode->i_fop = &empty_fops;
1743 +       inode->i_nlink = 1;
1744 +       atomic_set(&inode->i_writecount, 0);
1745 +       inode->i_size = 0;
1746 +       inode->i_blocks = 0;
1747 +       inode->i_generation = 0;
1748 +       memset(&inode->i_dquot, 0, sizeof(inode->i_dquot));
1749 +       inode->i_pipe = NULL;
1750 +       inode->i_bdev = NULL;
1751 +       inode->i_cdev = NULL;
1752 +       inode->i_data.a_ops = &empty_aops;
1753 +       inode->i_data.host = inode;
1754 +       inode->i_data.gfp_mask = GFP_HIGHUSER;
1755 +       inode->i_mapping = &inode->i_data;
1756 +}
1757 +
1758 +/**
1759 + * get_empty_inode     - obtain an inode
1760 + *
1761 + * This is called by things like the networking layer
1762 + * etc that want to get an inode without any inode
1763 + * number, or filesystems that allocate new inodes with
1764 + * no pre-existing information.
1765 + *
1766 + * On a successful return the inode pointer is returned. On a failure
1767 + * a %NULL pointer is returned. The returned inode is not on any superblock
1768 + * lists.
1769 + */
1770
1771 +struct inode * get_empty_inode(void)
1772 +{
1773 +       static unsigned long last_ino;
1774 +       struct inode * inode;
1775 +
1776 +       spin_lock_prefetch(&inode_lock);
1777 +       
1778 +       inode = (struct inode *) kmem_cache_alloc(inode_cachep, SLAB_KERNEL);
1779 +       if (inode)
1780 +       {
1781 +               spin_lock(&inode_lock);
1782 +               inodes_stat.nr_inodes++;
1783 +               list_add(&inode->i_list, &inode_in_use);
1784 +               inode->i_sb = NULL;
1785 +               inode->i_dev = 0;
1786 +               inode->i_blkbits = 0;
1787 +               inode->i_ino = ++last_ino;
1788 +               inode->i_flags = 0;
1789 +               atomic_set(&inode->i_count, 1);
1790 +               inode->i_state = 0;
1791 +               spin_unlock(&inode_lock);
1792 +               clean_inode(inode);
1793 +       }
1794 +       return inode;
1795 +}
1796 +
1797  /**
1798   *     new_inode       - obtain an inode
1799   *     @sb: superblock
1800 Index: linux/include/linux/fs.h
1801 ===================================================================
1802 --- linux.orig/include/linux/fs.h       2003-09-03 17:52:02.000000000 -0400
1803 +++ linux/include/linux/fs.h    2003-09-03 17:52:04.000000000 -0400
1804 @@ -1440,6 +1440,7 @@
1805  
1806  extern void clear_inode(struct inode *);
1807  extern struct inode *new_inode(struct super_block *sb);
1808 +extern struct inode * get_empty_inode(void);
1809  extern void remove_suid(struct inode *inode);
1810  
1811  extern void insert_inode_hash(struct inode *);
1812 Index: linux/arch/i386/kernel/setup.c
1813 ===================================================================
1814 --- linux.orig/arch/i386/kernel/setup.c 2003-09-03 17:51:01.000000000 -0400
1815 +++ linux/arch/i386/kernel/setup.c      2003-09-03 17:53:05.000000000 -0400
1816 @@ -172,6 +172,8 @@
1817  static u32 disabled_x86_caps[NCAPINTS] __initdata = { 0 };
1818  extern int blk_nohighio;
1819  
1820 +int enable_acpi_smp_table;
1821 +
1822  /*
1823   * This is set up by the setup-routine at boot-time
1824   */