Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 17780
Collapse All | Expand All

(-)linux.orig/arch/alpha/kernel/entry.S (-2 / +2 lines)
Lines 231-242 kernel_clone: Link Here
231
.end	kernel_clone
231
.end	kernel_clone
232
232
233
/*
233
/*
234
 * kernel_thread(fn, arg, clone_flags)
234
 * arch_kernel_thread(fn, arg, clone_flags)
235
 */
235
 */
236
.align 3
236
.align 3
237
.globl	kernel_thread
237
.globl	kernel_thread
238
.ent	kernel_thread
238
.ent	kernel_thread
239
kernel_thread:
239
arch_kernel_thread:
240
	ldgp	$29,0($27)	/* we can be called from a module */
240
	ldgp	$29,0($27)	/* we can be called from a module */
241
	.frame $30, 4*8, $26
241
	.frame $30, 4*8, $26
242
	subq	$30,4*8,$30
242
	subq	$30,4*8,$30
(-)linux.orig/arch/arm/kernel/process.c (-1 / +1 lines)
Lines 366-372 void dump_thread(struct pt_regs * regs, Link Here
366
 * a system call from a "real" process, but the process memory space will
366
 * a system call from a "real" process, but the process memory space will
367
 * not be free'd until both the parent and the child have exited.
367
 * not be free'd until both the parent and the child have exited.
368
 */
368
 */
369
pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags)
369
pid_t arch_kernel_thread(int (*fn)(void *), void *arg, unsigned long flags)
370
{
370
{
371
	pid_t __ret;
371
	pid_t __ret;
372
372
(-)linux.orig/arch/cris/kernel/entry.S (-3 / +3 lines)
Lines 736-747 hw_bp_trig_ptr: Link Here
736
 * the grosser the code, at least with the gcc version in cris-dist-1.13.
736
 * the grosser the code, at least with the gcc version in cris-dist-1.13.
737
 */
737
 */
738
738
739
/* int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) */
739
/* int arch_kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) */
740
/*                   r10                r11         r12  */
740
/*                   r10                r11         r12  */
741
741
742
	.text
742
	.text
743
	.global kernel_thread
743
	.global arch_kernel_thread
744
kernel_thread:
744
arch_kernel_thread:
745
745
746
	/* Save ARG for later.  */
746
	/* Save ARG for later.  */
747
	move.d $r11, $r13
747
	move.d $r11, $r13
(-)linux.orig/arch/i386/kernel/process.c (-1 / +2 lines)
Lines 495-501 void release_segments(struct mm_struct * Link Here
495
/*
495
/*
496
 * Create a kernel thread
496
 * Create a kernel thread
497
 */
497
 */
498
int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
498
int arch_kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
499
{
499
{
500
	long retval, d0;
500
	long retval, d0;
501
501
Lines 518-523 int kernel_thread(int (*fn)(void *), voi Link Here
518
		 "r" (arg), "r" (fn),
518
		 "r" (arg), "r" (fn),
519
		 "b" (flags | CLONE_VM)
519
		 "b" (flags | CLONE_VM)
520
		: "memory");
520
		: "memory");
521
521
	return retval;
522
	return retval;
522
}
523
}
523
524
(-)linux.orig/arch/ia64/kernel/process.c (-2 / +2 lines)
Lines 220-226 ia64_load_extra (struct task_struct *tas Link Here
220
 *	|                     | <-- sp (lowest addr)
220
 *	|                     | <-- sp (lowest addr)
221
 *	+---------------------+
221
 *	+---------------------+
222
 *
222
 *
223
 * Note: if we get called through kernel_thread() then the memory
223
 * Note: if we get called through arch_kernel_thread() then the memory
224
 * above "(highest addr)" is valid kernel stack memory that needs to
224
 * above "(highest addr)" is valid kernel stack memory that needs to
225
 * be copied as well.
225
 * be copied as well.
226
 *
226
 *
Lines 469-475 ia64_set_personality (struct elf64_hdr * Link Here
469
}
469
}
470
470
471
pid_t
471
pid_t
472
kernel_thread (int (*fn)(void *), void *arg, unsigned long flags)
472
arch_kernel_thread (int (*fn)(void *), void *arg, unsigned long flags)
473
{
473
{
474
	struct task_struct *parent = current;
474
	struct task_struct *parent = current;
475
	int result, tid;
475
	int result, tid;
(-)linux.orig/arch/m68k/kernel/process.c (-1 / +1 lines)
Lines 124-130 void show_regs(struct pt_regs * regs) Link Here
124
/*
124
/*
125
 * Create a kernel thread
125
 * Create a kernel thread
126
 */
126
 */
127
int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
127
int arch_kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
128
{
128
{
129
	int pid;
129
	int pid;
130
	mm_segment_t fs;
130
	mm_segment_t fs;
(-)linux.orig/arch/mips/kernel/process.c (-1 / +1 lines)
Lines 155-161 void dump_thread(struct pt_regs *regs, s Link Here
155
/*
155
/*
156
 * Create a kernel thread
156
 * Create a kernel thread
157
 */
157
 */
158
int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
158
int arch_kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
159
{
159
{
160
	long retval;
160
	long retval;
161
161
(-)linux.orig/arch/mips64/kernel/process.c (-1 / +1 lines)
Lines 152-158 void dump_thread(struct pt_regs *regs, s Link Here
152
/*
152
/*
153
 * Create a kernel thread
153
 * Create a kernel thread
154
 */
154
 */
155
int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags)
155
int arch_kernel_thread(int (*fn)(void *), void *arg, unsigned long flags)
156
{
156
{
157
	int retval;
157
	int retval;
158
158
(-)linux.orig/arch/parisc/kernel/process.c (-1 / +1 lines)
Lines 118-124 void machine_heartbeat(void) Link Here
118
 */
118
 */
119
119
120
extern pid_t __kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
120
extern pid_t __kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
121
pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags)
121
pid_t arch_kernel_thread(int (*fn)(void *), void *arg, unsigned long flags)
122
{
122
{
123
123
124
	/*
124
	/*
(-)linux.orig/arch/ppc/kernel/misc.S (-2 / +2 lines)
Lines 899-907 _GLOBAL(cvt_df) Link Here
899
899
900
/*
900
/*
901
 * Create a kernel thread
901
 * Create a kernel thread
902
 *   kernel_thread(fn, arg, flags)
902
 *   arch_kernel_thread(fn, arg, flags)
903
 */
903
 */
904
_GLOBAL(kernel_thread)
904
_GLOBAL(arch_kernel_thread)
905
	mr	r6,r3		/* function */
905
	mr	r6,r3		/* function */
906
	ori	r3,r5,CLONE_VM	/* flags */
906
	ori	r3,r5,CLONE_VM	/* flags */
907
	li	r0,__NR_clone
907
	li	r0,__NR_clone
(-)linux.orig/arch/ppc64/kernel/misc.S (-2 / +2 lines)
Lines 493-501 _GLOBAL(cvt_df) Link Here
493
493
494
/*
494
/*
495
 * Create a kernel thread
495
 * Create a kernel thread
496
 *   kernel_thread(fn, arg, flags)
496
 *   arch_kernel_thread(fn, arg, flags)
497
 */
497
 */
498
_GLOBAL(kernel_thread)
498
_GLOBAL(arch_kernel_thread)
499
	mr	r6,r3		/* function */
499
	mr	r6,r3		/* function */
500
	ori	r3,r5,CLONE_VM	/* flags */
500
	ori	r3,r5,CLONE_VM	/* flags */
501
	li	r0,__NR_clone
501
	li	r0,__NR_clone
(-)linux.orig/arch/s390/kernel/process.c (-1 / +1 lines)
Lines 105-111 void show_regs(struct pt_regs *regs) Link Here
105
		show_trace((unsigned long *) regs->gprs[15]);
105
		show_trace((unsigned long *) regs->gprs[15]);
106
}
106
}
107
107
108
int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
108
int arch_kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
109
{
109
{
110
        int clone_arg = flags | CLONE_VM;
110
        int clone_arg = flags | CLONE_VM;
111
        int retval;
111
        int retval;
(-)linux.orig/arch/s390x/kernel/process.c (-1 / +1 lines)
Lines 102-108 void show_regs(struct pt_regs *regs) Link Here
102
		show_trace((unsigned long *) regs->gprs[15]);
102
		show_trace((unsigned long *) regs->gprs[15]);
103
}
103
}
104
104
105
int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
105
int arch_kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
106
{
106
{
107
        int clone_arg = flags | CLONE_VM;
107
        int clone_arg = flags | CLONE_VM;
108
        int retval;
108
        int retval;
(-)linux.orig/arch/sh/kernel/process.c (-1 / +1 lines)
Lines 118-124 void free_task_struct(struct task_struct Link Here
118
 * This is the mechanism for creating a new kernel thread.
118
 * This is the mechanism for creating a new kernel thread.
119
 *
119
 *
120
 */
120
 */
121
int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
121
int arch_kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
122
{	/* Don't use this in BL=1(cli).  Or else, CPU resets! */
122
{	/* Don't use this in BL=1(cli).  Or else, CPU resets! */
123
	register unsigned long __sc0 __asm__ ("r0");
123
	register unsigned long __sc0 __asm__ ("r0");
124
	register unsigned long __sc3 __asm__ ("r3") = __NR_clone;
124
	register unsigned long __sc3 __asm__ ("r3") = __NR_clone;
(-)linux.orig/arch/sparc/kernel/process.c (-1 / +1 lines)
Lines 676-682 out: Link Here
676
 * a system call from a "real" process, but the process memory space will
676
 * a system call from a "real" process, but the process memory space will
677
 * not be free'd until both the parent and the child have exited.
677
 * not be free'd until both the parent and the child have exited.
678
 */
678
 */
679
pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
679
pid_t arch_kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
680
{
680
{
681
	long retval;
681
	long retval;
682
682
(-)linux.orig/arch/sparc64/kernel/process.c (-1 / +1 lines)
Lines 658-664 int copy_thread(int nr, unsigned long cl Link Here
658
 * a system call from a "real" process, but the process memory space will
658
 * a system call from a "real" process, but the process memory space will
659
 * not be free'd until both the parent and the child have exited.
659
 * not be free'd until both the parent and the child have exited.
660
 */
660
 */
661
pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
661
pid_t arch_kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
662
{
662
{
663
	long retval;
663
	long retval;
664
664
(-)linux.orig/arch/um/kernel/process_kern.c (-2 / +2 lines)
Lines 171-184 static int new_thread_proc(void *stack) Link Here
171
	os_usr1_process(os_getpid());
171
	os_usr1_process(os_getpid());
172
}
172
}
173
173
174
int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
174
int arch_kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
175
{
175
{
176
	int pid;
176
	int pid;
177
177
178
	current->thread.request.u.thread.proc = fn;
178
	current->thread.request.u.thread.proc = fn;
179
	current->thread.request.u.thread.arg = arg;
179
	current->thread.request.u.thread.arg = arg;
180
	pid = do_fork(CLONE_VM | flags, 0, NULL, 0);
180
	pid = do_fork(CLONE_VM | flags, 0, NULL, 0);
181
	if(pid < 0) panic("do_fork failed in kernel_thread");
181
	if(pid < 0) panic("do_fork failed in arch_kernel_thread");
182
	return(pid);
182
	return(pid);
183
}
183
}
184
184
(-)linux.orig/fs/exec.c (-2 / +4 lines)
Lines 559-566 int flush_old_exec(struct linux_binprm * Link Here
559
559
560
	current->sas_ss_sp = current->sas_ss_size = 0;
560
	current->sas_ss_sp = current->sas_ss_size = 0;
561
561
562
	if (current->euid == current->uid && current->egid == current->gid)
562
	if (current->euid == current->uid && current->egid == current->gid) {
563
		current->mm->dumpable = 1;
563
		current->mm->dumpable = 1;
564
		current->task_dumpable = 1;
565
	}
564
	name = bprm->filename;
566
	name = bprm->filename;
565
	for (i=0; (ch = *(name++)) != '\0';) {
567
	for (i=0; (ch = *(name++)) != '\0';) {
566
		if (ch == '/')
568
		if (ch == '/')
Lines 952-958 int do_coredump(long signr, struct pt_re Link Here
952
	binfmt = current->binfmt;
954
	binfmt = current->binfmt;
953
	if (!binfmt || !binfmt->core_dump)
955
	if (!binfmt || !binfmt->core_dump)
954
		goto fail;
956
		goto fail;
955
	if (!current->mm->dumpable)
957
	if (!is_dumpable(current))
956
		goto fail;
958
		goto fail;
957
	current->mm->dumpable = 0;
959
	current->mm->dumpable = 0;
958
	if (current->rlim[RLIMIT_CORE].rlim_cur < binfmt->min_coredump)
960
	if (current->rlim[RLIMIT_CORE].rlim_cur < binfmt->min_coredump)
(-)linux.orig/include/asm-alpha/processor.h (-1 / +1 lines)
Lines 119-125 struct task_struct; Link Here
119
extern void release_thread(struct task_struct *);
119
extern void release_thread(struct task_struct *);
120
120
121
/* Create a kernel thread without removing it from tasklists.  */
121
/* Create a kernel thread without removing it from tasklists.  */
122
extern long kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
122
extern long arch_kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
123
123
124
#define copy_segments(tsk, mm)		do { } while (0)
124
#define copy_segments(tsk, mm)		do { } while (0)
125
#define release_segments(mm)		do { } while (0)
125
#define release_segments(mm)		do { } while (0)
(-)linux.orig/include/asm-arm/processor.h (-1 / +1 lines)
Lines 117-123 extern void __free_task_struct(struct ta Link Here
117
/*
117
/*
118
 * Create a new kernel thread
118
 * Create a new kernel thread
119
 */
119
 */
120
extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
120
extern int arch_kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
121
121
122
#endif
122
#endif
123
123
(-)linux.orig/include/asm-cris/processor.h (-1 / +1 lines)
Lines 81-87 struct thread_struct { Link Here
81
#define INIT_THREAD  { \
81
#define INIT_THREAD  { \
82
   0, 0, 0x20 }  /* ccr = int enable, nothing else */
82
   0, 0, 0x20 }  /* ccr = int enable, nothing else */
83
83
84
extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
84
extern int arch_kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
85
85
86
/* give the thread a program location
86
/* give the thread a program location
87
 * set user-mode (The 'U' flag (User mode flag) is CCR/DCCR bit 8) 
87
 * set user-mode (The 'U' flag (User mode flag) is CCR/DCCR bit 8) 
(-)linux.orig/include/asm-i386/processor.h (-1 / +1 lines)
Lines 433-439 extern void release_thread(struct task_s Link Here
433
/*
433
/*
434
 * create a kernel thread without removing it from tasklists
434
 * create a kernel thread without removing it from tasklists
435
 */
435
 */
436
extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
436
extern int arch_kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
437
437
438
/* Copy and release all segment info associated with a VM */
438
/* Copy and release all segment info associated with a VM */
439
extern void copy_segments(struct task_struct *p, struct mm_struct * mm);
439
extern void copy_segments(struct task_struct *p, struct mm_struct * mm);
(-)linux.orig/include/asm-ia64/processor.h (-1 / +1 lines)
Lines 476-482 struct task_struct; Link Here
476
 * do_basic_setup() and the timing is such that free_initmem() has
476
 * do_basic_setup() and the timing is such that free_initmem() has
477
 * been called already.
477
 * been called already.
478
 */
478
 */
479
extern int kernel_thread (int (*fn)(void *), void *arg, unsigned long flags);
479
extern int arch_kernel_thread (int (*fn)(void *), void *arg, unsigned long flags);
480
480
481
/* Copy and release all segment info associated with a VM */
481
/* Copy and release all segment info associated with a VM */
482
#define copy_segments(tsk, mm)			do { } while (0)
482
#define copy_segments(tsk, mm)			do { } while (0)
(-)linux.orig/include/asm-m68k/processor.h (-1 / +1 lines)
Lines 105-111 static inline void release_thread(struct Link Here
105
{
105
{
106
}
106
}
107
107
108
extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
108
extern int arch_kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
109
109
110
#define copy_segments(tsk, mm)		do { } while (0)
110
#define copy_segments(tsk, mm)		do { } while (0)
111
#define release_segments(mm)		do { } while (0)
111
#define release_segments(mm)		do { } while (0)
(-)linux.orig/include/asm-mips/processor.h (-1 / +1 lines)
Lines 186-192 struct thread_struct { Link Here
186
/* Free all resources held by a thread. */
186
/* Free all resources held by a thread. */
187
#define release_thread(thread) do { } while(0)
187
#define release_thread(thread) do { } while(0)
188
188
189
extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
189
extern int arch_kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
190
190
191
/* Copy and release all segment info associated with a VM */
191
/* Copy and release all segment info associated with a VM */
192
#define copy_segments(p, mm) do { } while(0)
192
#define copy_segments(p, mm) do { } while(0)
(-)linux.orig/include/asm-mips64/processor.h (-1 / +1 lines)
Lines 245-251 struct thread_struct { Link Here
245
/* Free all resources held by a thread. */
245
/* Free all resources held by a thread. */
246
#define release_thread(thread) do { } while(0)
246
#define release_thread(thread) do { } while(0)
247
247
248
extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
248
extern int arch_kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
249
249
250
/* Copy and release all segment info associated with a VM */
250
/* Copy and release all segment info associated with a VM */
251
#define copy_segments(p, mm) do { } while(0)
251
#define copy_segments(p, mm) do { } while(0)
(-)linux.orig/include/asm-parisc/processor.h (-1 / +1 lines)
Lines 305-311 struct task_struct; Link Here
305
305
306
/* Free all resources held by a thread. */
306
/* Free all resources held by a thread. */
307
extern void release_thread(struct task_struct *);
307
extern void release_thread(struct task_struct *);
308
extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
308
extern int arch_kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
309
309
310
#define copy_segments(tsk, mm)	do { } while (0)
310
#define copy_segments(tsk, mm)	do { } while (0)
311
#define release_segments(mm)	do { } while (0)
311
#define release_segments(mm)	do { } while (0)
(-)linux.orig/include/asm-ppc/processor.h (-1 / +1 lines)
Lines 593-599 void release_thread(struct task_struct * Link Here
593
/*
593
/*
594
 * Create a new kernel thread.
594
 * Create a new kernel thread.
595
 */
595
 */
596
extern long kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
596
extern long arch_kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
597
597
598
/*
598
/*
599
 * Bus types
599
 * Bus types
(-)linux.orig/include/asm-ppc64/processor.h (-1 / +1 lines)
Lines 609-615 void release_thread(struct task_struct * Link Here
609
/*
609
/*
610
 * Create a new kernel thread.
610
 * Create a new kernel thread.
611
 */
611
 */
612
extern long kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
612
extern long arch_kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
613
613
614
/*
614
/*
615
 * Bus types
615
 * Bus types
(-)linux.orig/include/asm-s390/processor.h (-1 / +1 lines)
Lines 113-119 struct mm_struct; Link Here
113
113
114
/* Free all resources held by a thread. */
114
/* Free all resources held by a thread. */
115
extern void release_thread(struct task_struct *);
115
extern void release_thread(struct task_struct *);
116
extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
116
extern int arch_kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
117
117
118
/* Copy and release all segment info associated with a VM */
118
/* Copy and release all segment info associated with a VM */
119
#define copy_segments(nr, mm)           do { } while (0)
119
#define copy_segments(nr, mm)           do { } while (0)
(-)linux.orig/include/asm-s390x/processor.h (-1 / +1 lines)
Lines 127-133 struct mm_struct; Link Here
127
127
128
/* Free all resources held by a thread. */
128
/* Free all resources held by a thread. */
129
extern void release_thread(struct task_struct *);
129
extern void release_thread(struct task_struct *);
130
extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
130
extern int arch_kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
131
131
132
/* Copy and release all segment info associated with a VM */
132
/* Copy and release all segment info associated with a VM */
133
#define copy_segments(nr, mm)           do { } while (0)
133
#define copy_segments(nr, mm)           do { } while (0)
(-)linux.orig/include/asm-sh/processor.h (-1 / +1 lines)
Lines 137-143 extern void release_thread(struct task_s Link Here
137
/*
137
/*
138
 * create a kernel thread without removing it from tasklists
138
 * create a kernel thread without removing it from tasklists
139
 */
139
 */
140
extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
140
extern int arch_kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
141
141
142
/*
142
/*
143
 * Bus types
143
 * Bus types
(-)linux.orig/include/asm-sparc/processor.h (-1 / +1 lines)
Lines 146-152 extern __inline__ void start_thread(stru Link Here
146
146
147
/* Free all resources held by a thread. */
147
/* Free all resources held by a thread. */
148
#define release_thread(tsk)		do { } while(0)
148
#define release_thread(tsk)		do { } while(0)
149
extern pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
149
extern pid_t arch_kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
150
150
151
151
152
#define copy_segments(tsk, mm)		do { } while (0)
152
#define copy_segments(tsk, mm)		do { } while (0)
(-)linux.orig/include/asm-sparc64/processor.h (-1 / +1 lines)
Lines 270-276 do { \ Link Here
270
/* Free all resources held by a thread. */
270
/* Free all resources held by a thread. */
271
#define release_thread(tsk)		do { } while(0)
271
#define release_thread(tsk)		do { } while(0)
272
272
273
extern pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
273
extern pid_t arch_kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
274
274
275
#define copy_segments(tsk, mm)		do { } while (0)
275
#define copy_segments(tsk, mm)		do { } while (0)
276
#define release_segments(mm)		do { } while (0)
276
#define release_segments(mm)		do { } while (0)
(-)linux.orig/include/linux/sched.h (+5 lines)
Lines 362-367 struct task_struct { Link Here
362
	/* ??? */
362
	/* ??? */
363
	unsigned long personality;
363
	unsigned long personality;
364
	int did_exec:1;
364
	int did_exec:1;
365
	unsigned task_dumpable:1;
365
	pid_t pid;
366
	pid_t pid;
366
	pid_t pgrp;
367
	pid_t pgrp;
367
	pid_t tty_old_pgrp;
368
	pid_t tty_old_pgrp;
Lines 485-490 struct task_struct { Link Here
485
#define PT_TRACESYSGOOD	0x00000008
486
#define PT_TRACESYSGOOD	0x00000008
486
#define PT_PTRACE_CAP	0x00000010	/* ptracer can follow suid-exec */
487
#define PT_PTRACE_CAP	0x00000010	/* ptracer can follow suid-exec */
487
488
489
#define is_dumpable(tsk)	((tsk)->task_dumpable && (tsk)->mm->dumpable)
490
488
/*
491
/*
489
 * Limit the stack by to some sane default: root can always
492
 * Limit the stack by to some sane default: root can always
490
 * increase this limit if needed..  8MB seems reasonable.
493
 * increase this limit if needed..  8MB seems reasonable.
Lines 848-853 extern void FASTCALL(remove_wait_queue(w Link Here
848
851
849
extern void wait_task_inactive(task_t * p);
852
extern void wait_task_inactive(task_t * p);
850
extern void kick_if_running(task_t * p);
853
extern void kick_if_running(task_t * p);
854
extern long kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
855
851
856
852
#define __wait_event(wq, condition) 					\
857
#define __wait_event(wq, condition) 					\
853
do {									\
858
do {									\
(-)linux.orig/kernel/fork.c (+26 lines)
Lines 28-33 Link Here
28
#include <asm/pgalloc.h>
28
#include <asm/pgalloc.h>
29
#include <asm/uaccess.h>
29
#include <asm/uaccess.h>
30
#include <asm/mmu_context.h>
30
#include <asm/mmu_context.h>
31
#include <asm/processor.h>
31
32
32
/* The idle threads do not count.. */
33
/* The idle threads do not count.. */
33
int nr_threads;
34
int nr_threads;
Lines 575-580 static inline void copy_flags(unsigned l Link Here
575
	p->flags = new_flags;
576
	p->flags = new_flags;
576
}
577
}
577
578
579
long kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
580
{
581
	struct task_struct *task = current;
582
	unsigned old_task_dumpable;
583
	long ret;
584
585
	/* lock out any potential ptracer */
586
	task_lock(task);
587
	if (task->ptrace) {
588
		task_unlock(task);
589
		return -EPERM;
590
	}
591
592
	old_task_dumpable = task->task_dumpable;
593
	task->task_dumpable = 0;
594
	task_unlock(task);
595
596
	ret = arch_kernel_thread(fn, arg, flags);
597
598
	/* never reached in child process, only in parent */
599
	current->task_dumpable = old_task_dumpable;
600
601
	return ret;
602
}
603
578
/*
604
/*
579
 *  Ok, this is the main fork-routine. It copies the system process
605
 *  Ok, this is the main fork-routine. It copies the system process
580
 * information (task[nr]) and sets up the necessary registers. It also
606
 * information (task[nr]) and sets up the necessary registers. It also
(-)linux.orig/kernel/ptrace.c (-1 / +7 lines)
Lines 21-26 Link Here
21
 */
21
 */
22
int ptrace_check_attach(struct task_struct *child, int kill)
22
int ptrace_check_attach(struct task_struct *child, int kill)
23
{
23
{
24
	mb();
25
	if (!is_dumpable(child))
26
		return -EPERM;
27
24
	if (!(child->ptrace & PT_PTRACED))
28
	if (!(child->ptrace & PT_PTRACED))
25
		return -ESRCH;
29
		return -ESRCH;
26
30
Lines 57-63 int ptrace_attach(struct task_struct *ta Link Here
57
 	    (current->gid != task->gid)) && !capable(CAP_SYS_PTRACE))
61
 	    (current->gid != task->gid)) && !capable(CAP_SYS_PTRACE))
58
		goto bad;
62
		goto bad;
59
	rmb();
63
	rmb();
60
	if (!task->mm->dumpable && !capable(CAP_SYS_PTRACE))
64
	if (!is_dumpable(task) && !capable(CAP_SYS_PTRACE))
61
		goto bad;
65
		goto bad;
62
	/* the same process cannot be attached many times */
66
	/* the same process cannot be attached many times */
63
	if (task->ptrace & PT_PTRACED)
67
	if (task->ptrace & PT_PTRACED)
Lines 123-128 int access_process_vm(struct task_struct Link Here
123
	/* Worry about races with exit() */
127
	/* Worry about races with exit() */
124
	task_lock(tsk);
128
	task_lock(tsk);
125
	mm = tsk->mm;
129
	mm = tsk->mm;
130
	if (!is_dumpable(tsk) || (&init_mm == mm))
131
		mm = NULL;
126
	if (mm)
132
	if (mm)
127
		atomic_inc(&mm->mm_users);
133
		atomic_inc(&mm->mm_users);
128
	task_unlock(tsk);
134
	task_unlock(tsk);
(-)linux.orig/kernel/sys.c (-2 / +3 lines)
Lines 1286-1292 asmlinkage long sys_prctl(int option, un Link Here
1286
			error = put_user(current->pdeath_signal, (int *)arg2);
1286
			error = put_user(current->pdeath_signal, (int *)arg2);
1287
			break;
1287
			break;
1288
		case PR_GET_DUMPABLE:
1288
		case PR_GET_DUMPABLE:
1289
			if (current->mm->dumpable)
1289
			if (is_dumpable(current))
1290
				error = 1;
1290
				error = 1;
1291
			break;
1291
			break;
1292
		case PR_SET_DUMPABLE:
1292
		case PR_SET_DUMPABLE:
Lines 1294-1300 asmlinkage long sys_prctl(int option, un Link Here
1294
				error = -EINVAL;
1294
				error = -EINVAL;
1295
				break;
1295
				break;
1296
			}
1296
			}
1297
			current->mm->dumpable = arg2;
1297
			if (is_dumpable(current))
1298
				current->mm->dumpable = arg2;
1298
			break;
1299
			break;
1299
	        case PR_SET_UNALIGN:
1300
	        case PR_SET_UNALIGN:
1300
#ifdef SET_UNALIGN_CTL
1301
#ifdef SET_UNALIGN_CTL

Return to bug 17780