diff -Nrup linux-2.4.20-ori/arch/alpha/kernel/entry.S linux-2.4.20/arch/alpha/kernel/entry.S --- linux-2.4.20-ori/arch/alpha/kernel/entry.S 2002-08-03 02:39:42.000000000 +0200 +++ linux-2.4.20/arch/alpha/kernel/entry.S 2003-03-19 18:08:18.000000000 +0100 @@ -231,12 +231,12 @@ kernel_clone: .end kernel_clone /* - * kernel_thread(fn, arg, clone_flags) + * arch_kernel_thread(fn, arg, clone_flags) */ .align 3 .globl kernel_thread .ent kernel_thread -kernel_thread: +arch_kernel_thread: ldgp $29,0($27) /* we can be called from a module */ .frame $30, 4*8, $26 subq $30,4*8,$30 diff -Nrup linux-2.4.20-ori/arch/arm/kernel/process.c linux-2.4.20/arch/arm/kernel/process.c --- linux-2.4.20-ori/arch/arm/kernel/process.c 2002-08-03 02:39:42.000000000 +0200 +++ linux-2.4.20/arch/arm/kernel/process.c 2003-03-19 18:08:18.000000000 +0100 @@ -366,7 +366,7 @@ void dump_thread(struct pt_regs * regs, * a system call from a "real" process, but the process memory space will * not be free'd until both the parent and the child have exited. */ -pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags) +pid_t arch_kernel_thread(int (*fn)(void *), void *arg, unsigned long flags) { pid_t __ret; diff -Nrup linux-2.4.20-ori/arch/cris/kernel/entry.S linux-2.4.20/arch/cris/kernel/entry.S --- linux-2.4.20-ori/arch/cris/kernel/entry.S 2002-08-03 02:39:42.000000000 +0200 +++ linux-2.4.20/arch/cris/kernel/entry.S 2003-03-19 18:08:18.000000000 +0100 @@ -736,12 +736,12 @@ hw_bp_trig_ptr: * the grosser the code, at least with the gcc version in cris-dist-1.13. */ -/* int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) */ +/* int arch_kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) */ /* r10 r11 r12 */ .text - .global kernel_thread -kernel_thread: + .global arch_kernel_thread +arch_kernel_thread: /* Save ARG for later. */ move.d $r11, $r13 diff -Nrup linux-2.4.20-ori/arch/i386/kernel/process.c linux-2.4.20/arch/i386/kernel/process.c --- linux-2.4.20-ori/arch/i386/kernel/process.c 2002-08-03 02:39:42.000000000 +0200 +++ linux-2.4.20/arch/i386/kernel/process.c 2003-03-19 18:08:18.000000000 +0100 @@ -485,7 +485,7 @@ void release_segments(struct mm_struct * /* * Create a kernel thread */ -int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) +int arch_kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) { long retval, d0; @@ -508,6 +508,7 @@ int kernel_thread(int (*fn)(void *), voi "r" (arg), "r" (fn), "b" (flags | CLONE_VM) : "memory"); + return retval; } diff -Nrup linux-2.4.20-ori/arch/ia64/kernel/process.c linux-2.4.20/arch/ia64/kernel/process.c --- linux-2.4.20-ori/arch/ia64/kernel/process.c 2002-11-29 00:53:09.000000000 +0100 +++ linux-2.4.20/arch/ia64/kernel/process.c 2003-03-19 18:08:18.000000000 +0100 @@ -224,7 +224,7 @@ ia64_load_extra (struct task_struct *tas * | | <-- sp (lowest addr) * +---------------------+ * - * Note: if we get called through kernel_thread() then the memory + * Note: if we get called through arch_kernel_thread() then the memory * above "(highest addr)" is valid kernel stack memory that needs to * be copied as well. * @@ -479,7 +479,7 @@ ia64_set_personality (struct elf64_hdr * } pid_t -kernel_thread (int (*fn)(void *), void *arg, unsigned long flags) +arch_kernel_thread (int (*fn)(void *), void *arg, unsigned long flags) { struct task_struct *parent = current; int result, tid; diff -Nrup linux-2.4.20-ori/arch/m68k/kernel/process.c linux-2.4.20/arch/m68k/kernel/process.c --- linux-2.4.20-ori/arch/m68k/kernel/process.c 2002-08-03 02:39:43.000000000 +0200 +++ linux-2.4.20/arch/m68k/kernel/process.c 2003-03-19 18:08:18.000000000 +0100 @@ -124,7 +124,7 @@ void show_regs(struct pt_regs * regs) /* * Create a kernel thread */ -int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) +int arch_kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) { int pid; mm_segment_t fs; diff -Nrup linux-2.4.20-ori/arch/mips/kernel/process.c linux-2.4.20/arch/mips/kernel/process.c --- linux-2.4.20-ori/arch/mips/kernel/process.c 2002-11-29 00:53:10.000000000 +0100 +++ linux-2.4.20/arch/mips/kernel/process.c 2003-03-19 18:08:18.000000000 +0100 @@ -152,7 +152,7 @@ void dump_thread(struct pt_regs *regs, s /* * Create a kernel thread */ -int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) +int arch_kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) { long retval; diff -Nrup linux-2.4.20-ori/arch/mips64/kernel/process.c linux-2.4.20/arch/mips64/kernel/process.c --- linux-2.4.20-ori/arch/mips64/kernel/process.c 2002-11-29 00:53:10.000000000 +0100 +++ linux-2.4.20/arch/mips64/kernel/process.c 2003-03-19 18:08:18.000000000 +0100 @@ -151,7 +151,7 @@ void dump_thread(struct pt_regs *regs, s /* * Create a kernel thread */ -int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags) +int arch_kernel_thread(int (*fn)(void *), void *arg, unsigned long flags) { int retval; diff -Nrup linux-2.4.20-ori/arch/parisc/kernel/process.c linux-2.4.20/arch/parisc/kernel/process.c --- linux-2.4.20-ori/arch/parisc/kernel/process.c 2002-11-29 00:53:10.000000000 +0100 +++ linux-2.4.20/arch/parisc/kernel/process.c 2003-03-19 18:08:18.000000000 +0100 @@ -163,7 +163,7 @@ void machine_power_off(void) */ extern pid_t __kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); -pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags) +pid_t arch_kernel_thread(int (*fn)(void *), void *arg, unsigned long flags) { /* diff -Nrup linux-2.4.20-ori/arch/ppc/kernel/misc.S linux-2.4.20/arch/ppc/kernel/misc.S --- linux-2.4.20-ori/arch/ppc/kernel/misc.S 2002-11-29 00:53:11.000000000 +0100 +++ linux-2.4.20/arch/ppc/kernel/misc.S 2003-03-19 18:08:18.000000000 +0100 @@ -898,9 +898,9 @@ _GLOBAL(cvt_df) /* * Create a kernel thread - * kernel_thread(fn, arg, flags) + * arch_kernel_thread(fn, arg, flags) */ -_GLOBAL(kernel_thread) +_GLOBAL(arch_kernel_thread) mr r6,r3 /* function */ ori r3,r5,CLONE_VM /* flags */ li r0,__NR_clone diff -Nrup linux-2.4.20-ori/arch/ppc64/kernel/misc.S linux-2.4.20/arch/ppc64/kernel/misc.S --- linux-2.4.20-ori/arch/ppc64/kernel/misc.S 2002-11-29 00:53:11.000000000 +0100 +++ linux-2.4.20/arch/ppc64/kernel/misc.S 2003-03-19 18:08:18.000000000 +0100 @@ -493,9 +493,9 @@ _GLOBAL(cvt_df) /* * Create a kernel thread - * kernel_thread(fn, arg, flags) + * arch_kernel_thread(fn, arg, flags) */ -_GLOBAL(kernel_thread) +_GLOBAL(arch_kernel_thread) mr r6,r3 /* function */ ori r3,r5,CLONE_VM /* flags */ li r0,__NR_clone diff -Nrup linux-2.4.20-ori/arch/s390/kernel/process.c linux-2.4.20/arch/s390/kernel/process.c --- linux-2.4.20-ori/arch/s390/kernel/process.c 2002-08-03 02:39:43.000000000 +0200 +++ linux-2.4.20/arch/s390/kernel/process.c 2003-03-19 18:08:18.000000000 +0100 @@ -105,7 +105,7 @@ void show_regs(struct pt_regs *regs) show_trace((unsigned long *) regs->gprs[15]); } -int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) +int arch_kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) { int clone_arg = flags | CLONE_VM; int retval; diff -Nrup linux-2.4.20-ori/arch/s390x/kernel/process.c linux-2.4.20/arch/s390x/kernel/process.c --- linux-2.4.20-ori/arch/s390x/kernel/process.c 2002-11-29 00:53:11.000000000 +0100 +++ linux-2.4.20/arch/s390x/kernel/process.c 2003-03-19 18:08:18.000000000 +0100 @@ -102,7 +102,7 @@ void show_regs(struct pt_regs *regs) show_trace((unsigned long *) regs->gprs[15]); } -int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) +int arch_kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) { int clone_arg = flags | CLONE_VM; int retval; diff -Nrup linux-2.4.20-ori/arch/sh/kernel/process.c linux-2.4.20/arch/sh/kernel/process.c --- linux-2.4.20-ori/arch/sh/kernel/process.c 2001-10-15 22:36:48.000000000 +0200 +++ linux-2.4.20/arch/sh/kernel/process.c 2003-03-19 18:08:18.000000000 +0100 @@ -118,7 +118,7 @@ void free_task_struct(struct task_struct * This is the mechanism for creating a new kernel thread. * */ -int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) +int arch_kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) { /* Don't use this in BL=1(cli). Or else, CPU resets! */ register unsigned long __sc0 __asm__ ("r0"); register unsigned long __sc3 __asm__ ("r3") = __NR_clone; diff -Nrup linux-2.4.20-ori/arch/sparc/kernel/process.c linux-2.4.20/arch/sparc/kernel/process.c --- linux-2.4.20-ori/arch/sparc/kernel/process.c 2002-08-03 02:39:43.000000000 +0200 +++ linux-2.4.20/arch/sparc/kernel/process.c 2003-03-19 18:08:18.000000000 +0100 @@ -676,7 +676,7 @@ out: * a system call from a "real" process, but the process memory space will * not be free'd until both the parent and the child have exited. */ -pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) +pid_t arch_kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) { long retval; diff -Nrup linux-2.4.20-ori/arch/sparc64/kernel/process.c linux-2.4.20/arch/sparc64/kernel/process.c --- linux-2.4.20-ori/arch/sparc64/kernel/process.c 2002-11-29 00:53:12.000000000 +0100 +++ linux-2.4.20/arch/sparc64/kernel/process.c 2003-03-19 18:08:18.000000000 +0100 @@ -673,7 +673,7 @@ int copy_thread(int nr, unsigned long cl * a system call from a "real" process, but the process memory space will * not be free'd until both the parent and the child have exited. */ -pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) +pid_t arch_kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) { long retval; diff -Nrup linux-2.4.20-ori/fs/exec.c linux-2.4.20/fs/exec.c --- linux-2.4.20-ori/fs/exec.c 2002-11-29 00:53:15.000000000 +0100 +++ linux-2.4.20/fs/exec.c 2003-03-19 18:08:25.000000000 +0100 @@ -572,8 +572,10 @@ int flush_old_exec(struct linux_binprm * current->sas_ss_sp = current->sas_ss_size = 0; - if (current->euid == current->uid && current->egid == current->gid) + if (current->euid == current->uid && current->egid == current->gid) { current->mm->dumpable = 1; + current->task_dumpable = 1; + } name = bprm->filename; for (i=0; (ch = *(name++)) != '\0';) { if (ch == '/') @@ -965,7 +967,7 @@ int do_coredump(long signr, struct pt_re binfmt = current->binfmt; if (!binfmt || !binfmt->core_dump) goto fail; - if (!current->mm->dumpable) + if (!is_dumpable(current)) goto fail; current->mm->dumpable = 0; if (current->rlim[RLIMIT_CORE].rlim_cur < binfmt->min_coredump) diff -Nrup linux-2.4.20-ori/include/asm-alpha/processor.h linux-2.4.20/include/asm-alpha/processor.h --- linux-2.4.20-ori/include/asm-alpha/processor.h 2001-10-05 21:11:05.000000000 +0200 +++ linux-2.4.20/include/asm-alpha/processor.h 2003-03-19 18:08:25.000000000 +0100 @@ -119,7 +119,7 @@ struct task_struct; extern void release_thread(struct task_struct *); /* Create a kernel thread without removing it from tasklists. */ -extern long kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); +extern long arch_kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); #define copy_segments(tsk, mm) do { } while (0) #define release_segments(mm) do { } while (0) diff -Nrup linux-2.4.20-ori/include/asm-arm/processor.h linux-2.4.20/include/asm-arm/processor.h --- linux-2.4.20-ori/include/asm-arm/processor.h 2002-08-03 02:39:45.000000000 +0200 +++ linux-2.4.20/include/asm-arm/processor.h 2003-03-19 18:08:25.000000000 +0100 @@ -117,7 +117,7 @@ extern void __free_task_struct(struct ta /* * Create a new kernel thread */ -extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); +extern int arch_kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); #endif diff -Nrup linux-2.4.20-ori/include/asm-cris/processor.h linux-2.4.20/include/asm-cris/processor.h --- linux-2.4.20-ori/include/asm-cris/processor.h 2002-08-03 02:39:45.000000000 +0200 +++ linux-2.4.20/include/asm-cris/processor.h 2003-03-19 18:08:25.000000000 +0100 @@ -81,7 +81,7 @@ struct thread_struct { #define INIT_THREAD { \ 0, 0, 0x20 } /* ccr = int enable, nothing else */ -extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); +extern int arch_kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); /* give the thread a program location * set user-mode (The 'U' flag (User mode flag) is CCR/DCCR bit 8) diff -Nrup linux-2.4.20-ori/include/asm-i386/processor.h linux-2.4.20/include/asm-i386/processor.h --- linux-2.4.20-ori/include/asm-i386/processor.h 2002-08-03 02:39:45.000000000 +0200 +++ linux-2.4.20/include/asm-i386/processor.h 2003-03-19 18:08:25.000000000 +0100 @@ -433,7 +433,7 @@ extern void release_thread(struct task_s /* * create a kernel thread without removing it from tasklists */ -extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); +extern int arch_kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); /* Copy and release all segment info associated with a VM */ extern void copy_segments(struct task_struct *p, struct mm_struct * mm); diff -Nrup linux-2.4.20-ori/include/asm-ia64/processor.h linux-2.4.20/include/asm-ia64/processor.h --- linux-2.4.20-ori/include/asm-ia64/processor.h 2002-11-29 00:53:15.000000000 +0100 +++ linux-2.4.20/include/asm-ia64/processor.h 2003-03-19 18:08:25.000000000 +0100 @@ -373,7 +373,7 @@ struct task_struct; * do_basic_setup() and the timing is such that free_initmem() has * been called already. */ -extern int kernel_thread (int (*fn)(void *), void *arg, unsigned long flags); +extern int arch_kernel_thread (int (*fn)(void *), void *arg, unsigned long flags); /* Copy and release all segment info associated with a VM */ #define copy_segments(tsk, mm) do { } while (0) diff -Nrup linux-2.4.20-ori/include/asm-m68k/processor.h linux-2.4.20/include/asm-m68k/processor.h --- linux-2.4.20-ori/include/asm-m68k/processor.h 2001-10-05 21:11:05.000000000 +0200 +++ linux-2.4.20/include/asm-m68k/processor.h 2003-03-19 18:08:25.000000000 +0100 @@ -105,7 +105,7 @@ static inline void release_thread(struct { } -extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); +extern int arch_kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); #define copy_segments(tsk, mm) do { } while (0) #define release_segments(mm) do { } while (0) diff -Nrup linux-2.4.20-ori/include/asm-mips/processor.h linux-2.4.20/include/asm-mips/processor.h --- linux-2.4.20-ori/include/asm-mips/processor.h 2002-11-29 00:53:15.000000000 +0100 +++ linux-2.4.20/include/asm-mips/processor.h 2003-03-19 18:08:25.000000000 +0100 @@ -188,7 +188,7 @@ struct thread_struct { /* Free all resources held by a thread. */ #define release_thread(thread) do { } while(0) -extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); +extern int arch_kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); /* Copy and release all segment info associated with a VM */ #define copy_segments(p, mm) do { } while(0) diff -Nrup linux-2.4.20-ori/include/asm-mips64/processor.h linux-2.4.20/include/asm-mips64/processor.h --- linux-2.4.20-ori/include/asm-mips64/processor.h 2002-11-29 00:53:15.000000000 +0100 +++ linux-2.4.20/include/asm-mips64/processor.h 2003-03-19 18:08:25.000000000 +0100 @@ -231,7 +231,7 @@ struct thread_struct { /* Free all resources held by a thread. */ #define release_thread(thread) do { } while(0) -extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); +extern int arch_kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); /* Copy and release all segment info associated with a VM */ #define copy_segments(p, mm) do { } while(0) diff -Nrup linux-2.4.20-ori/include/asm-parisc/processor.h linux-2.4.20/include/asm-parisc/processor.h --- linux-2.4.20-ori/include/asm-parisc/processor.h 2002-11-29 00:53:15.000000000 +0100 +++ linux-2.4.20/include/asm-parisc/processor.h 2003-03-19 18:08:25.000000000 +0100 @@ -289,7 +289,7 @@ struct mm_struct; /* Free all resources held by a thread. */ extern void release_thread(struct task_struct *); -extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); +extern int arch_kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); extern void map_hpux_gateway_page(struct task_struct *tsk, struct mm_struct *mm); diff -Nrup linux-2.4.20-ori/include/asm-ppc/processor.h linux-2.4.20/include/asm-ppc/processor.h --- linux-2.4.20-ori/include/asm-ppc/processor.h 2002-11-29 00:53:15.000000000 +0100 +++ linux-2.4.20/include/asm-ppc/processor.h 2003-03-19 18:08:25.000000000 +0100 @@ -626,7 +626,7 @@ void release_thread(struct task_struct * /* * Create a new kernel thread. */ -extern long kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); +extern long arch_kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); /* * Bus types diff -Nrup linux-2.4.20-ori/include/asm-ppc64/processor.h linux-2.4.20/include/asm-ppc64/processor.h --- linux-2.4.20-ori/include/asm-ppc64/processor.h 2002-11-29 00:53:15.000000000 +0100 +++ linux-2.4.20/include/asm-ppc64/processor.h 2003-03-19 18:08:25.000000000 +0100 @@ -609,7 +609,7 @@ void release_thread(struct task_struct * /* * Create a new kernel thread. */ -extern long kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); +extern long arch_kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); /* * Bus types diff -Nrup linux-2.4.20-ori/include/asm-s390/processor.h linux-2.4.20/include/asm-s390/processor.h --- linux-2.4.20-ori/include/asm-s390/processor.h 2002-08-03 02:39:45.000000000 +0200 +++ linux-2.4.20/include/asm-s390/processor.h 2003-03-19 18:08:25.000000000 +0100 @@ -113,7 +113,7 @@ struct mm_struct; /* Free all resources held by a thread. */ extern void release_thread(struct task_struct *); -extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); +extern int arch_kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); /* Copy and release all segment info associated with a VM */ #define copy_segments(nr, mm) do { } while (0) diff -Nrup linux-2.4.20-ori/include/asm-s390x/processor.h linux-2.4.20/include/asm-s390x/processor.h --- linux-2.4.20-ori/include/asm-s390x/processor.h 2002-11-29 00:53:15.000000000 +0100 +++ linux-2.4.20/include/asm-s390x/processor.h 2003-03-19 18:08:25.000000000 +0100 @@ -128,7 +128,7 @@ struct mm_struct; /* Free all resources held by a thread. */ extern void release_thread(struct task_struct *); -extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); +extern int arch_kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); /* Copy and release all segment info associated with a VM */ #define copy_segments(nr, mm) do { } while (0) diff -Nrup linux-2.4.20-ori/include/asm-sh/processor.h linux-2.4.20/include/asm-sh/processor.h --- linux-2.4.20-ori/include/asm-sh/processor.h 2001-10-05 21:11:05.000000000 +0200 +++ linux-2.4.20/include/asm-sh/processor.h 2003-03-19 18:08:25.000000000 +0100 @@ -137,7 +137,7 @@ extern void release_thread(struct task_s /* * create a kernel thread without removing it from tasklists */ -extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); +extern int arch_kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); /* * Bus types diff -Nrup linux-2.4.20-ori/include/asm-sparc/processor.h linux-2.4.20/include/asm-sparc/processor.h --- linux-2.4.20-ori/include/asm-sparc/processor.h 2001-10-11 08:42:47.000000000 +0200 +++ linux-2.4.20/include/asm-sparc/processor.h 2003-03-19 18:08:25.000000000 +0100 @@ -146,7 +146,7 @@ extern __inline__ void start_thread(stru /* Free all resources held by a thread. */ #define release_thread(tsk) do { } while(0) -extern pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); +extern pid_t arch_kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); #define copy_segments(tsk, mm) do { } while (0) diff -Nrup linux-2.4.20-ori/include/asm-sparc64/processor.h linux-2.4.20/include/asm-sparc64/processor.h --- linux-2.4.20-ori/include/asm-sparc64/processor.h 2002-08-03 02:39:45.000000000 +0200 +++ linux-2.4.20/include/asm-sparc64/processor.h 2003-03-19 18:08:25.000000000 +0100 @@ -270,7 +270,7 @@ do { \ /* Free all resources held by a thread. */ #define release_thread(tsk) do { } while(0) -extern pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); +extern pid_t arch_kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); #define copy_segments(tsk, mm) do { } while (0) #define release_segments(mm) do { } while (0) diff -Nrup linux-2.4.20-ori/include/linux/sched.h linux-2.4.20/include/linux/sched.h --- linux-2.4.20-ori/include/linux/sched.h 2002-11-29 00:53:15.000000000 +0100 +++ linux-2.4.20/include/linux/sched.h 2003-03-19 18:09:22.000000000 +0100 @@ -339,6 +339,7 @@ struct task_struct { /* ??? */ unsigned long personality; int did_exec:1; + unsigned task_dumpable:1; pid_t pid; pid_t pgrp; pid_t tty_old_pgrp; @@ -448,6 +449,8 @@ struct task_struct { #define PT_TRACESYSGOOD 0x00000008 #define PT_PTRACE_CAP 0x00000010 /* ptracer can follow suid-exec */ +#define is_dumpable(tsk) ((tsk)->task_dumpable && (tsk)->mm->dumpable) + /* * Limit the stack by to some sane default: root can always * increase this limit if needed.. 8MB seems reasonable. @@ -802,6 +805,7 @@ extern int do_fork(unsigned long, unsign extern void FASTCALL(add_wait_queue(wait_queue_head_t *q, wait_queue_t * wait)); extern void FASTCALL(add_wait_queue_exclusive(wait_queue_head_t *q, wait_queue_t * wait)); extern void FASTCALL(remove_wait_queue(wait_queue_head_t *q, wait_queue_t * wait)); +extern long kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); #define __wait_event(wq, condition) \ do { \ diff -Nrup linux-2.4.20-ori/kernel/fork.c linux-2.4.20/kernel/fork.c --- linux-2.4.20-ori/kernel/fork.c 2002-11-29 00:53:15.000000000 +0100 +++ linux-2.4.20/kernel/fork.c 2003-03-19 18:08:25.000000000 +0100 @@ -27,6 +27,7 @@ #include #include #include +#include /* The idle threads do not count.. */ int nr_threads; @@ -565,6 +566,31 @@ static inline void copy_flags(unsigned l p->flags = new_flags; } +long kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) +{ + struct task_struct *task = current; + unsigned old_task_dumpable; + long ret; + + /* lock out any potential ptracer */ + task_lock(task); + if (task->ptrace) { + task_unlock(task); + return -EPERM; + } + + old_task_dumpable = task->task_dumpable; + task->task_dumpable = 0; + task_unlock(task); + + ret = arch_kernel_thread(fn, arg, flags); + + /* never reached in child process, only in parent */ + current->task_dumpable = old_task_dumpable; + + return ret; +} + /* * Ok, this is the main fork-routine. It copies the system process * information (task[nr]) and sets up the necessary registers. It also diff -Nrup linux-2.4.20-ori/kernel/ptrace.c linux-2.4.20/kernel/ptrace.c --- linux-2.4.20-ori/kernel/ptrace.c 2002-08-03 02:39:46.000000000 +0200 +++ linux-2.4.20/kernel/ptrace.c 2003-03-19 18:08:25.000000000 +0100 @@ -21,6 +21,10 @@ */ int ptrace_check_attach(struct task_struct *child, int kill) { + mb(); + if (!is_dumpable(child)) + return -EPERM; + if (!(child->ptrace & PT_PTRACED)) return -ESRCH; @@ -70,7 +74,7 @@ int ptrace_attach(struct task_struct *ta (current->gid != task->gid)) && !capable(CAP_SYS_PTRACE)) goto bad; rmb(); - if (!task->mm->dumpable && !capable(CAP_SYS_PTRACE)) + if (!is_dumpable(task) && !capable(CAP_SYS_PTRACE)) goto bad; /* the same process cannot be attached many times */ if (task->ptrace & PT_PTRACED) @@ -136,6 +140,8 @@ int access_process_vm(struct task_struct /* Worry about races with exit() */ task_lock(tsk); mm = tsk->mm; + if (!is_dumpable(tsk) || (&init_mm == mm)) + mm = NULL; if (mm) atomic_inc(&mm->mm_users); task_unlock(tsk); diff -Nrup linux-2.4.20-ori/kernel/sys.c linux-2.4.20/kernel/sys.c --- linux-2.4.20-ori/kernel/sys.c 2002-08-03 02:39:46.000000000 +0200 +++ linux-2.4.20/kernel/sys.c 2003-03-19 18:08:25.000000000 +0100 @@ -1219,7 +1219,7 @@ asmlinkage long sys_prctl(int option, un error = put_user(current->pdeath_signal, (int *)arg2); break; case PR_GET_DUMPABLE: - if (current->mm->dumpable) + if (is_dumpable(current)) error = 1; break; case PR_SET_DUMPABLE: @@ -1227,7 +1227,8 @@ asmlinkage long sys_prctl(int option, un error = -EINVAL; break; } - current->mm->dumpable = arg2; + if (is_dumpable(current)) + current->mm->dumpable = arg2; break; case PR_SET_UNALIGN: #ifdef SET_UNALIGN_CTL