--- systrace-linux-2.4.20-v1.1.diff	Sun Jan 19 21:33:41 2003
+++ systrace-linux-2.4.20-gentoo-r1-v1.1.diff	Thu Jan 23 11:41:24 2003
@@ -1,7 +1,15 @@
-diff -urN linux-2.4.20/Makefile linux-2.4.20-04-hdrfix/Makefile
---- linux-2.4.20/Makefile	2002-11-28 18:53:16.000000000 -0500
-+++ linux-2.4.20-04-hdrfix/Makefile	2002-12-02 00:54:46.000000000 -0500
-@@ -154,6 +154,7 @@
+--- linux-2.4.20-gentoo-r1/Makefile	Sun Jan 19 19:26:03 2003
++++ linux-2.4.20-gentoo-r1-systrace-v2/Makefile	Sun Jan 19 20:19:22 2003
+@@ -1,7 +1,7 @@
+ VERSION = 2
+ PATCHLEVEL = 4
+ SUBLEVEL = 20
+-EXTRAVERSION = -gentoo-r1
++EXTRAVERSION = -x
+ 
+ KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
+ 
+@@ -156,6 +156,7 @@
  DRIVERS-$(CONFIG_SCSI) += drivers/scsi/scsidrv.o
  DRIVERS-$(CONFIG_FUSION_BOOT) += drivers/message/fusion/fusion.o
  DRIVERS-$(CONFIG_IEEE1394) += drivers/ieee1394/ieee1394drv.o
@@ -9,10 +17,9 @@
  
  ifneq ($(CONFIG_CD_NO_IDESCSI)$(CONFIG_BLK_DEV_IDECD)$(CONFIG_BLK_DEV_SR)$(CONFIG_PARIDE_PCD),)
  DRIVERS-y += drivers/cdrom/driver.o
-diff -urN linux-2.4.20/arch/i386/config.in linux-2.4.20-04-hdrfix/arch/i386/config.in
---- linux-2.4.20/arch/i386/config.in	2002-11-28 18:53:09.000000000 -0500
-+++ linux-2.4.20-04-hdrfix/arch/i386/config.in	2002-12-02 00:41:08.000000000 -0500
-@@ -295,6 +295,8 @@
+--- linux-2.4.20-gentoo-r1/arch/i386/config.in	Sun Jan 19 19:26:03 2003
++++ linux-2.4.20-gentoo-r1-systrace-v2/arch/i386/config.in	Sun Jan 19 20:03:13 2003
+@@ -313,6 +313,8 @@
  tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
  tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
  
@@ -20,11 +27,10 @@
 +
  bool 'Power Management support' CONFIG_PM
  
- if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
-diff -urN linux-2.4.20/arch/i386/kernel/entry.S linux-2.4.20-04-hdrfix/arch/i386/kernel/entry.S
---- linux-2.4.20/arch/i386/kernel/entry.S	2002-11-28 18:53:09.000000000 -0500
-+++ linux-2.4.20-04-hdrfix/arch/i386/kernel/entry.S	2002-12-08 02:20:39.000000000 -0500
-@@ -207,8 +207,21 @@
+ dep_tristate '  Advanced Power Management BIOS support' CONFIG_APM $CONFIG_PM
+--- linux-2.4.20-gentoo-r1/arch/i386/kernel/entry.S	Sun Jan 19 19:26:03 2003
++++ linux-2.4.20-gentoo-r1-systrace-v2/arch/i386/kernel/entry.S	Sun Jan 19 20:03:14 2003
+@@ -230,8 +230,21 @@
  	jne tracesys
  	cmpl $(NR_syscalls),%eax
  	jae badsys
@@ -36,19 +42,18 @@
 +	movl ORIG_EAX(%esp),%eax
 +#endif /* CONFIG_SYSTRACE */
  	call *SYMBOL_NAME(sys_call_table)(,%eax,4)
-+ret:	
++ret:
  	movl %eax,EAX(%esp)		# save the return value
 +#ifdef CONFIG_SYSTRACE
 +	movl %esp,%eax                  # pass in stack
 +	call SYMBOL_NAME(systrace_result)
 +	movl EAX(%esp),%eax             # XXX: ?to be on the safe side
 +#endif /* CONFIG_SYSTRACE */
- ENTRY(ret_from_sys_call)
- 	cli				# need_resched and signals atomic test
- 	cmpl $0,need_resched(%ebx)
-diff -urN linux-2.4.20/drivers/Makefile linux-2.4.20-04-hdrfix/drivers/Makefile
---- linux-2.4.20/drivers/Makefile	2002-11-28 18:53:12.000000000 -0500
-+++ linux-2.4.20-04-hdrfix/drivers/Makefile	2002-12-02 00:45:12.000000000 -0500
+ 
+ #ifdef CONFIG_GRKERNSEC_PAX_RANDKSTACK
+ 	cli                             # need_resched and signals atomic test
+--- linux-2.4.20-gentoo-r1/drivers/Makefile	Sun Jan 19 19:26:03 2003
++++ linux-2.4.20-gentoo-r1-systrace-v2/drivers/Makefile	Sun Jan 19 20:02:46 2003
 @@ -41,6 +41,7 @@
  subdir-$(CONFIG_ISDN_BOOL)	+= isdn
  subdir-$(CONFIG_ATM)		+= atm
@@ -2193,19 +2198,19 @@
 +} while (0)
 +
 +#endif	/* !_SYS_QUEUE_H_ */
-diff -urN linux-2.4.20/include/linux/sched.h linux-2.4.20-04-hdrfix/include/linux/sched.h
---- linux-2.4.20/include/linux/sched.h	2002-11-28 18:53:15.000000000 -0500
-+++ linux-2.4.20-04-hdrfix/include/linux/sched.h	2003-01-18 13:59:23.000000000 -0500
-@@ -311,6 +311,9 @@
- 	unsigned long policy;
- 	struct mm_struct *mm;
- 	int processor;
+--- linux-2.4.20-gentoo-r1/include/linux/sched.h	Sun Jan 19 19:26:03 2003
++++ linux-2.4.20-gentoo-r1-systrace-v2/include/linux/sched.h	Sun Jan 19 20:20:35 2003
+@@ -375,6 +375,10 @@
+ 
+ 	unsigned long flags;
+ 
 +#ifdef CONFIG_SYSTRACE
 +	void *systrace;
 +#endif /* CONFIG_SYSTRACE */
- 	/*
- 	 * cpus_runnable is ~0 if the process is not running on any
- 	 * CPU. It's (1 << cpu) if it's running on a CPU. This mask
++
+ /* task state */
+ 	struct linux_binfmt *binfmt;
+ 	int exit_code, exit_signal;
 diff -urN linux-2.4.20/include/linux/systrace.h linux-2.4.20-04-hdrfix/include/linux/systrace.h
 --- linux-2.4.20/include/linux/systrace.h	1969-12-31 19:00:00.000000000 -0500
 +++ linux-2.4.20-04-hdrfix/include/linux/systrace.h	2003-01-18 13:35:09.000000000 -0500
@@ -2426,10 +2431,9 @@
 +#endif /* !__KERNEL__ */
 +
 +#endif /* _SYSTRACE_H */
-diff -urN linux-2.4.20/init/main.c linux-2.4.20-04-hdrfix/init/main.c
---- linux-2.4.20/init/main.c	2002-08-02 19:39:46.000000000 -0500
-+++ linux-2.4.20-04-hdrfix/init/main.c	2003-01-18 13:46:29.000000000 -0500
-@@ -65,6 +65,12 @@
+--- linux-2.4.20-gentoo-r1/init/main.c	Sun Jan 19 19:26:03 2003
++++ linux-2.4.20-gentoo-r1-systrace-v2/init/main.c	Sun Jan 19 20:02:34 2003
+@@ -70,6 +70,12 @@
  extern int irda_device_init(void);
  #endif
  
@@ -2442,7 +2446,7 @@
  #ifdef CONFIG_X86_LOCAL_APIC
  #include <asm/smp.h>
  #endif
-@@ -533,6 +539,9 @@
+@@ -549,6 +555,9 @@
  	irda_proto_init();
  	irda_device_init(); /* Must be done after protocol initialization */
  #endif
@@ -2452,9 +2456,8 @@
  #ifdef CONFIG_PCMCIA
  	init_pcmcia_ds();		/* Do this last */
  #endif
-diff -urN linux-2.4.20/kernel/exit.c linux-2.4.20-04-hdrfix/kernel/exit.c
---- linux-2.4.20/kernel/exit.c	2002-11-28 18:53:15.000000000 -0500
-+++ linux-2.4.20-04-hdrfix/kernel/exit.c	2003-01-18 14:01:14.000000000 -0500
+--- linux-2.4.20-gentoo-r1/kernel/exit.c	Sun Jan 19 19:26:03 2003
++++ linux-2.4.20-gentoo-r1-systrace-v2/kernel/exit.c	Sun Jan 19 20:02:34 2003
 @@ -16,6 +16,11 @@
  #ifdef CONFIG_BSD_PROCESS_ACCT
  #include <linux/acct.h>
@@ -2464,23 +2467,22 @@
 +#include <asm/semaphore.h>
 +#include <linux/systrace.h>
 +#endif
+ #include <linux/grsecurity.h>
+ #include <linux/imon.h>  /* hopefully this can go away when imon is done */
  
- #include <asm/uaccess.h>
- #include <asm/pgtable.h>
-@@ -439,6 +444,9 @@
+@@ -497,6 +502,9 @@
  #ifdef CONFIG_BSD_PROCESS_ACCT
  	acct_process(code);
  #endif
 +#ifdef CONFIG_SYSTRACE
 +	systrace_exit(tsk);
 +#endif
- 	__exit_mm(tsk);
- 
- 	lock_kernel();
-diff -urN linux-2.4.20/kernel/fork.c linux-2.4.20-04-hdrfix/kernel/fork.c
---- linux-2.4.20/kernel/fork.c	2002-11-28 18:53:15.000000000 -0500
-+++ linux-2.4.20-04-hdrfix/kernel/fork.c	2003-01-18 14:00:51.000000000 -0500
-@@ -28,6 +28,12 @@
+ 	if (unlikely(current->acl_admin && gr_acl_is_enabled())) {
+ 		gr_set_acls(1);
+ 		security_alert_good(GR_ADMINL_ACL_MSG, GR_ADMINL_ACL_FLD,
+--- linux-2.4.20-gentoo-r1/kernel/fork.c	Sun Jan 19 19:26:03 2003
++++ linux-2.4.20-gentoo-r1-systrace-v2/kernel/fork.c	Sun Jan 19 20:02:34 2003
+@@ -29,6 +29,12 @@
  #include <asm/uaccess.h>
  #include <asm/mmu_context.h>
  
@@ -2492,16 +2494,17 @@
 +
  /* The idle threads do not count.. */
  int nr_threads;
- int nr_running;
-@@ -751,6 +757,11 @@
+ 
+@@ -794,6 +800,12 @@
+ 
  	if (p->ptrace & PT_PTRACED)
  		send_sig(SIGSTOP, p, 1);
- 
++
 +#ifdef CONFIG_SYSTRACE
 +	if (current->systrace != NULL)
 +		systrace_fork(current, p);
 +#endif /* CONFIG_SYSTRACE */
 +
- 	wake_up_process(p);		/* do this last */
+ 	wake_up_forked_process(p);	/* do this last */
  	++total_forks;
  	if (clone_flags & CLONE_VFORK)
