1 diff -urN linux249ac18/arch/s390/kernel/signal.c linux2410ac7/arch/s390/kernel/signal.c
2 --- linux249ac18/arch/s390/kernel/signal.c Thu Oct 4 14:25:04 2001
3 +++ linux2410ac7/arch/s390/kernel/signal.c Sat Oct 6 22:09:44 2001
5 #include <linux/ptrace.h>
6 #include <linux/unistd.h>
7 #include <linux/stddef.h>
8 +#include <linux/personality.h>
9 #include <asm/ucontext.h>
10 #include <asm/uaccess.h>
18 + struct signal_struct *sig;
19 set_current_state(TASK_STOPPED);
20 current->exit_code = signr;
21 - if (!(current->p_pptr->sig->action[SIGCHLD-1].sa.sa_flags & SA_NOCLDSTOP))
22 + sig = current->p_pptr->sig;
23 + if (sig && !(sig->action[SIGCHLD-1].sa.sa_flags & SA_NOCLDSTOP))
24 notify_parent(current, SIGCHLD);
29 case SIGQUIT: case SIGILL: case SIGTRAP:
30 case SIGABRT: case SIGFPE: case SIGSEGV:
31 diff -urN linux249ac18/arch/i386/kernel/ptrace.c linux2410ac7/arch/i386/kernel/ptrace.c
32 --- linux249ac18/arch/i386/kernel/ptrace.c Thu Oct 4 14:24:59 2001
33 +++ linux2410ac7/arch/i386/kernel/ptrace.c Wed Sep 19 01:04:23 2001
39 + * Called by kernel/ptrace.c when detaching..
41 + * Make sure the single step bit is not set.
43 +void ptrace_disable(struct task_struct *child)
47 + tmp = get_stack_long(child, EFL_OFFSET) & ~TRAP_FLAG;
48 + put_stack_long(child, EFL_OFFSET, tmp);
51 asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
53 struct task_struct *child;
58 - case PTRACE_DETACH: { /* detach a process that was attached. */
62 - if ((unsigned long) data > _NSIG)
65 - child->exit_code = data;
66 - write_lock_irq(&tasklist_lock);
67 - REMOVE_LINKS(child);
68 - child->p_pptr = child->p_opptr;
70 - write_unlock_irq(&tasklist_lock);
71 - /* make sure the single step bit is not set. */
72 - tmp = get_stack_long(child, EFL_OFFSET) & ~TRAP_FLAG;
73 - put_stack_long(child, EFL_OFFSET, tmp);
74 - wake_up_process(child);
77 + /* detach a process that was attached. */
78 + ret = ptrace_detach(child, data);
82 case PTRACE_GETREGS: { /* Get all gp regs from the child. */
83 if (!access_ok(VERIFY_WRITE, (unsigned *)data, FRAME_SIZE*sizeof(long))) {
84 diff -urN linux249ac18/arch/s390x/kernel/ptrace.c linux2410ac7/arch/s390x/kernel/ptrace.c
85 --- linux249ac18/arch/s390x/kernel/ptrace.c Fri Jul 20 20:39:55 2001
86 +++ linux2410ac7/arch/s390x/kernel/ptrace.c Wed Sep 19 00:56:19 2001
92 + * Called by kernel/ptrace.c when detaching..
94 + * Make sure single step bits etc are not set.
96 +void ptrace_disable(struct task_struct *child)
98 + /* make sure the single step bit is not set. */
99 + clear_single_step(child);
102 asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
104 struct task_struct *child;
108 case PTRACE_DETACH: /* detach a process that was attached. */
110 - if ((unsigned long) data >= _NSIG)
112 - child->ptrace &= ~(PT_PTRACED|PT_TRACESYS);
113 - child->exit_code = data;
114 - write_lock_irqsave(&tasklist_lock, flags);
115 - REMOVE_LINKS(child);
116 - child->p_pptr = child->p_opptr;
118 - write_unlock_irqrestore(&tasklist_lock, flags);
119 - /* make sure the single step bit is not set. */
120 - clear_single_step(child);
121 - wake_up_process(child);
123 + ret = ptrace_detach(child, data);
126 case PTRACE_PEEKUSR_AREA:
127 case PTRACE_POKEUSR_AREA:
128 if((ret=copy_from_user(&parea,(void *)addr,sizeof(parea)))==0)
129 diff -urN linux249ac18/arch/s390x/kernel/signal.c linux2410ac7/arch/s390x/kernel/signal.c
130 --- linux249ac18/arch/s390x/kernel/signal.c Thu Oct 4 14:25:04 2001
131 +++ linux2410ac7/arch/s390x/kernel/signal.c Sat Oct 6 22:09:45 2001
133 #include <linux/ptrace.h>
134 #include <linux/unistd.h>
135 #include <linux/stddef.h>
136 +#include <linux/personality.h>
137 #include <asm/ucontext.h>
138 #include <asm/uaccess.h>
140 @@ -549,13 +550,16 @@
146 + struct signal_struct *sig;
147 set_current_state(TASK_STOPPED);
148 current->exit_code = signr;
149 - if (!(current->p_pptr->sig->action[SIGCHLD-1].sa.sa_flags & SA_NOCLDSTOP))
150 + sig = current->p_pptr->sig;
151 + if (sig && !(sig->action[SIGCHLD-1].sa.sa_flags & SA_NOCLDSTOP))
152 notify_parent(current, SIGCHLD);
157 case SIGQUIT: case SIGILL: case SIGTRAP:
158 case SIGABRT: case SIGFPE: case SIGSEGV:
159 diff -urN linux249ac18/arch/i386/kernel/signal.c linux2410ac7/arch/i386/kernel/signal.c
160 --- linux249ac18/arch/i386/kernel/signal.c Thu Oct 4 14:24:59 2001
161 +++ linux2410ac7/arch/i386/kernel/signal.c Fri Sep 14 22:15:40 2001
162 @@ -666,13 +666,16 @@
168 + struct signal_struct *sig;
169 current->state = TASK_STOPPED;
170 current->exit_code = signr;
171 - if (!(current->p_pptr->sig->action[SIGCHLD-1].sa.sa_flags & SA_NOCLDSTOP))
172 + sig = current->p_pptr->sig;
173 + if (sig && !(sig->action[SIGCHLD-1].sa.sa_flags & SA_NOCLDSTOP))
174 notify_parent(current, SIGCHLD);
179 case SIGQUIT: case SIGILL: case SIGTRAP:
180 case SIGABRT: case SIGFPE: case SIGSEGV:
181 diff -urN linux249ac18/fs/exec.c linux2410ac7/fs/exec.c
182 --- linux249ac18/fs/exec.c Thu Oct 4 14:25:28 2001
183 +++ linux2410ac7/fs/exec.c Tue Sep 18 21:39:32 2001
185 #include <linux/pagemap.h>
186 #include <linux/highmem.h>
187 #include <linux/spinlock.h>
188 +#include <linux/personality.h>
189 #define __NO_VERSION__
190 #include <linux/module.h>
196 - if (get_user(str, argv+argc) || !str || !(len = strnlen_user(str, bprm->p)))
197 + if (get_user(str, argv+argc) || !(len = strnlen_user(str, bprm->p)))
203 static inline int must_not_trace_exec(struct task_struct * p)
205 - return (p->ptrace & PT_PTRACED) && !cap_raised(p->p_pptr->cap_effective, CAP_SYS_PTRACE);
206 + return (p->ptrace & PT_PTRACED) && !(p->ptrace & PT_PTRACE_CAP);
210 diff -urN linux249ac18/arch/ia64/kernel/ptrace.c linux2410ac7/arch/ia64/kernel/ptrace.c
211 --- linux249ac18/arch/ia64/kernel/ptrace.c Tue Jul 31 18:30:08 2001
212 +++ linux2410ac7/arch/ia64/kernel/ptrace.c Wed Sep 19 01:03:51 2001
218 + * Called by kernel/ptrace.c when detaching..
220 + * Make sure the single step bit is not set.
222 +void ptrace_disable(struct task_struct *child)
224 + /* make sure the single step/take-branch tra bits are not set: */
225 + ia64_psr(pt)->ss = 0;
226 + ia64_psr(pt)->tb = 0;
228 + /* Turn off flag indicating that the KRBS is sync'd with child's VM: */
229 + child->thread.flags &= ~IA64_THREAD_KRBS_SYNCED;
233 sys_ptrace (long request, pid_t pid, unsigned long addr, unsigned long data,
234 long arg4, long arg5, long arg6, long arg7, long stack)
238 case PTRACE_DETACH: /* detach a process that was attached. */
243 - child->ptrace &= ~(PT_PTRACED|PT_TRACESYS);
244 - child->exit_code = data;
245 - write_lock_irqsave(&tasklist_lock, flags);
246 - REMOVE_LINKS(child);
247 - child->p_pptr = child->p_opptr;
249 - write_unlock_irqrestore(&tasklist_lock, flags);
251 - /* make sure the single step/take-branch tra bits are not set: */
252 - ia64_psr(pt)->ss = 0;
253 - ia64_psr(pt)->tb = 0;
255 - /* Turn off flag indicating that the KRBS is sync'd with child's VM: */
256 - child->thread.flags &= ~IA64_THREAD_KRBS_SYNCED;
258 - wake_up_process(child);
260 + ret = ptrace_detach(child, data);
264 diff -urN linux249ac18/include/linux/mm.h linux2410ac7/include/linux/mm.h
265 --- linux249ac18/include/linux/mm.h Thu Oct 4 14:25:37 2001
266 +++ linux2410ac7/include/linux/mm.h Sat Oct 6 22:10:14 2001
268 extern int ptrace_readdata(struct task_struct *tsk, unsigned long src, char *dst, int len);
269 extern int ptrace_writedata(struct task_struct *tsk, char * src, unsigned long dst, int len);
270 extern int ptrace_attach(struct task_struct *tsk);
271 +extern int ptrace_detach(struct task_struct *, unsigned int);
272 +extern void ptrace_disable(struct task_struct *);
275 * On a two-level page table, this ends up being trivial. Thus the
276 diff -urN linux249ac18/include/linux/sched.h linux2410ac7/include/linux/sched.h
277 --- linux249ac18/include/linux/sched.h Thu Oct 4 14:25:37 2001
278 +++ linux2410ac7/include/linux/sched.h Sat Oct 6 22:10:14 2001
280 #define PT_TRACESYS 0x00000002
281 #define PT_DTRACE 0x00000004 /* delayed trace (used on m68k, i386) */
282 #define PT_TRACESYSGOOD 0x00000008
283 +#define PT_PTRACE_CAP 0x00000010 /* ptracer can follow suid-exec */
286 * Limit the stack by to some sane default: root can always
287 diff -urN linux249ac18/arch/ppc/kernel/ptrace.c linux2410ac7/arch/ppc/kernel/ptrace.c
288 --- linux249ac18/arch/ppc/kernel/ptrace.c Fri Jul 20 20:39:55 2001
289 +++ linux2410ac7/arch/ppc/kernel/ptrace.c Wed Sep 19 00:56:19 2001
291 regs->msr &= ~MSR_SE;
295 + * Called by kernel/ptrace.c when detaching..
297 + * Make sure single step bits etc are not set.
299 +void ptrace_disable(struct task_struct *child)
301 + /* make sure the single step bit is not set. */
302 + clear_single_step(child);
305 int sys_ptrace(long request, long pid, long addr, long data)
307 struct task_struct *child;
312 - case PTRACE_DETACH: { /* detach a process that was attached. */
314 - if ((unsigned long) data > _NSIG)
316 - child->ptrace &= ~(PT_PTRACED|PT_TRACESYS);
317 - child->exit_code = data;
318 - write_lock_irq(&tasklist_lock);
319 - REMOVE_LINKS(child);
320 - child->p_pptr = child->p_opptr;
322 - write_unlock_irq(&tasklist_lock);
323 - /* make sure the single step bit is not set. */
324 - clear_single_step(child);
325 - wake_up_process(child);
327 + case PTRACE_DETACH:
328 + ret = ptrace_detach(child, data);
334 diff -urN linux249ac18/arch/s390/kernel/ptrace.c linux2410ac7/arch/s390/kernel/ptrace.c
335 --- linux249ac18/arch/s390/kernel/ptrace.c Fri Jul 20 20:39:55 2001
336 +++ linux2410ac7/arch/s390/kernel/ptrace.c Wed Sep 19 00:58:03 2001
342 + * Called by kernel/ptrace.c when detaching..
344 + * Make sure single step bits etc are not set.
346 +void ptrace_disable(struct task_struct *child)
348 + /* make sure the single step bit is not set. */
349 + clear_single_step(child);
352 asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
354 struct task_struct *child;
358 case PTRACE_DETACH: /* detach a process that was attached. */
360 - if ((unsigned long) data >= _NSIG)
362 - child->ptrace &= ~(PT_PTRACED|PT_TRACESYS);
363 - child->exit_code = data;
364 - write_lock_irqsave(&tasklist_lock, flags);
365 - REMOVE_LINKS(child);
366 - child->p_pptr = child->p_opptr;
368 - write_unlock_irqrestore(&tasklist_lock, flags);
369 - /* make sure the single step bit is not set. */
370 - clear_single_step(child);
371 - wake_up_process(child);
373 + ret = ptrace_detach(child, data);
375 case PTRACE_PEEKUSR_AREA:
376 case PTRACE_POKEUSR_AREA:
377 diff -urN linux249ac18/arch/s390/kernel/s390_ksyms.c linux2410ac7/arch/s390/kernel/s390_ksyms.c
378 --- linux249ac18/arch/s390/kernel/s390_ksyms.c Thu Oct 4 14:25:04 2001
379 +++ linux2410ac7/arch/s390/kernel/s390_ksyms.c Sat Oct 6 22:09:44 2001
381 EXPORT_SYMBOL(console_device);
382 EXPORT_SYMBOL_NOVERS(do_call_softirq);
384 -#if CONFIG_IP_MULTICAST
385 -/* Required for lcs gigabit ethernet multicast support */
386 -EXPORT_SYMBOL(arp_mc_map);
390 diff -urN linux249ac18/kernel/ptrace.c linux2410ac7/kernel/ptrace.c
391 --- linux249ac18/kernel/ptrace.c Fri Jul 20 20:39:56 2001
392 +++ linux2410ac7/kernel/ptrace.c Wed Sep 19 00:32:16 2001
396 task->ptrace |= PT_PTRACED;
397 + if (capable(CAP_SYS_PTRACE))
398 + task->ptrace |= PT_PTRACE_CAP;
401 write_lock_irq(&tasklist_lock);
406 +int ptrace_detach(struct task_struct *child, unsigned int data)
408 + if ((unsigned long) data > _NSIG)
411 + /* Architecture-specific hardware disable .. */
412 + ptrace_disable(child);
414 + /* .. re-parent .. */
416 + child->exit_code = data;
417 + write_lock_irq(&tasklist_lock);
418 + REMOVE_LINKS(child);
419 + child->p_pptr = child->p_opptr;
421 + write_unlock_irq(&tasklist_lock);
423 + /* .. and wake it up. */
424 + wake_up_process(child);
429 * Access another process' address space, one page at a time.
430 diff -urN linux249ac18/arch/alpha/kernel/ptrace.c linux2410ac7/arch/alpha/kernel/ptrace.c
431 --- linux249ac18/arch/alpha/kernel/ptrace.c Fri Jul 20 20:39:55 2001
432 +++ linux2410ac7/arch/alpha/kernel/ptrace.c Wed Sep 19 01:03:51 2001
434 return (nsaved != 0);
438 + * Called by kernel/ptrace.c when detaching..
440 + * Make sure the single step bit is not set.
442 +void ptrace_disable(struct task_struct *child)
444 + ptrace_cancel_bpt(child);
448 sys_ptrace(long request, long pid, long addr, long data,
449 int a4, int a5, struct pt_regs regs)
454 - case PTRACE_DETACH: /* detach a process that was attached. */
456 - if ((unsigned long) data > _NSIG)
458 - child->ptrace &= ~(PT_PTRACED|PT_TRACESYS);
459 - wake_up_process(child);
460 - child->exit_code = data;
461 - write_lock_irq(&tasklist_lock);
462 - REMOVE_LINKS(child);
463 - child->p_pptr = child->p_opptr;
465 - write_unlock_irq(&tasklist_lock);
466 - /* make sure single-step breakpoint is gone. */
467 - ptrace_cancel_bpt(child);
469 + case PTRACE_DETACH: /* detach a process that was attached. */
470 + ret = ptrace_detach(child, data);
475 --- linux/arch/ia64/kernel/ptrace.c~ Sun Oct 7 14:03:08 2001
476 +++ linux/arch/ia64/kernel/ptrace.c Sun Oct 7 14:15:24 2001
478 void ptrace_disable(struct task_struct *child)
480 /* make sure the single step/take-branch tra bits are not set: */
481 + struct pt_regs *pt;
482 + pt = ia64_task_regs(child);
483 ia64_psr(pt)->ss = 0;
484 ia64_psr(pt)->tb = 0;
486 --- linux/arch/alpha/kernel/signal.c~ Wed Jan 24 23:16:23 2001
487 +++ linux/arch/alpha/kernel/signal.c Mon Oct 8 18:13:55 2001
488 @@ -697,15 +697,18 @@
494 + struct signal_struct *sig;
495 current->state = TASK_STOPPED;
496 current->exit_code = signr;
497 - if (!(current->p_pptr->sig->action[SIGCHLD-1]
498 + sig = current->p_pptr->sig;
499 + if (sig && !(sig->action[SIGCHLD-1]
500 .sa.sa_flags & SA_NOCLDSTOP))
501 notify_parent(current, SIGCHLD);
503 single_stepping |= ptrace_cancel_bpt(current);
507 case SIGQUIT: case SIGILL: case SIGTRAP:
508 case SIGABRT: case SIGFPE: case SIGSEGV:
509 --- linux/arch/ppc/kernel/signal.c~ Tue May 22 01:04:47 2001
510 +++ linux/arch/ppc/kernel/signal.c Mon Oct 8 19:26:20 2001
511 @@ -625,14 +625,16 @@
517 + struct signal_struct *sig;
518 current->state = TASK_STOPPED;
519 current->exit_code = signr;
520 - if (!(current->p_pptr->sig->action[SIGCHLD-1].sa.sa_flags & SA_NOCLDSTOP))
521 + sig = current->p_pptr->sig;
522 + if (sig && !(sig->action[SIGCHLD-1].sa.sa_flags & SA_NOCLDSTOP))
523 notify_parent(current, SIGCHLD);
528 case SIGQUIT: case SIGILL: case SIGTRAP:
529 case SIGABRT: case SIGFPE: case SIGSEGV:
530 case SIGBUS: case SIGSYS: case SIGXCPU: case SIGXFSZ:
531 --- linux/arch/ppc64/kernel/signal.c~ Mon Oct 8 18:37:54 2001
532 +++ linux/arch/ppc64/kernel/signal.c Mon Oct 8 19:26:53 2001
533 @@ -752,13 +752,16 @@
539 + struct signal_struct *sig;
540 current->state = TASK_STOPPED;
541 current->exit_code = signr;
542 - if (!(current->p_pptr->sig->action[SIGCHLD-1].sa.sa_flags & SA_NOCLDSTOP))
543 + sig = current->p_pptr->sig;
544 + if (sig && !(sig->action[SIGCHLD-1].sa.sa_flags & SA_NOCLDSTOP))
545 notify_parent(current, SIGCHLD);
550 case SIGQUIT: case SIGILL: case SIGTRAP:
551 case SIGABRT: case SIGFPE: case SIGSEGV: