#include <linux/types.h>
#include <linux/stddef.h>
#include <linux/sched.h>
+#include <linux/ptrace.h>
#include <asm/io.h>
#define DEFINE(sym, val) \
#include <linux/mc146818rtc.h>
#include <linux/module.h>
#include <linux/kallsyms.h>
+#include <linux/ptrace.h>
#include <asm/uaccess.h>
#include <asm/pgtable.h>
#include <linux/interrupt.h>
#include <linux/highmem.h>
#include <linux/kallsyms.h>
+#include <linux/ptrace.h>
#ifdef CONFIG_EISA
#include <linux/ioport.h>
#include <linux/smp.h>
#include <linux/smp_lock.h>
#include <linux/highmem.h>
+#include <linux/ptrace.h>
#include <asm/uaccess.h>
#include <asm/pgalloc.h>
+---------------------------------------------------------------------------*/
#include <linux/signal.h>
+#include <linux/ptrace.h>
#include <asm/uaccess.h>
#include <asm/desc.h>
#include <linux/string.h>
#include <linux/linkage.h>
#include <linux/init.h>
+#include <linux/ptrace.h>
#include <asm/setup.h>
#include <asm/fpu.h>
#include <linux/stddef.h>
#include <linux/sched.h>
#include <linux/kernel_stat.h>
+#include <linux/ptrace.h>
#include <asm/bootinfo.h>
#include <asm/irq.h>
#include <asm/hardirq.h>
#include <linux/string.h>
#include <linux/linkage.h>
#include <linux/init.h>
+#include <linux/ptrace.h>
#include <asm/setup.h>
#include <asm/fpu.h>
#include <linux/smp.h>
#include <linux/smp_lock.h>
#include <linux/time.h>
+#include <linux/ptrace.h>
#include <asm/ptrace.h>
#include <asm/uaccess.h>
#include <linux/sched.h>
#include <linux/string.h>
#include <linux/utsname.h>
+#include <linux/ptrace.h>
#include <asm/cachectl.h>
#include <asm/pgalloc.h>
#include <linux/file.h>
#include <linux/smp_lock.h>
#include <linux/slab.h>
+#include <linux/ptrace.h>
#include <asm/errno.h>
#include <asm/uaccess.h>
#include <linux/binfmts.h>
#include <linux/namei.h>
#include <linux/vfs.h>
+#include <linux/ptrace.h>
#include <asm/types.h>
#include <asm/uaccess.h>
#include <linux/init.h>
#include <linux/init_task.h>
#include <linux/prctl.h>
+#include <linux/ptrace.h>
#include <asm/pgtable.h>
#include <asm/uaccess.h>
#include <linux/dnotify.h>
#include <linux/security.h>
#include <linux/compat.h>
+#include <linux/ptrace.h>
#include <asm/types.h>
#include <asm/ipc.h>
#include <linux/binfmts.h>
#include <linux/compat.h>
#include <linux/vfs.h>
+#include <linux/ptrace.h>
#include <asm/types.h>
#include <asm/ipc.h>
#include <linux/mm.h>
#include <linux/slab.h>
#include <linux/a.out.h>
+#include <linux/ptrace.h>
#include <asm/io.h>
#include <asm/uaccess.h>
#include <linux/compat.h>
#include <linux/vfs.h>
#include <linux/netfilter_ipv4/ip_tables.h>
+#include <linux/ptrace.h>
#include <asm/types.h>
#include <asm/ipc.h>
#include "linux/slab.h"
#include "linux/smp_lock.h"
+#include "linux/ptrace.h"
#include "asm/ptrace.h"
#include "asm/pgtable.h"
#include "asm/tlbflush.h"
#include "linux/slab.h"
#include "linux/tty.h"
#include "linux/binfmts.h"
+#include "linux/ptrace.h"
#include "asm/signal.h"
#include "asm/uaccess.h"
#include "asm/unistd.h"
#include "linux/sched.h"
#include "linux/slab.h"
+#include "linux/ptrace.h"
#include "kern_util.h"
#include "time_user.h"
#include "signal_user.h"
#include "linux/signal.h"
#include "linux/kernel.h"
#include "linux/interrupt.h"
+#include "linux/ptrace.h"
#include "asm/system.h"
#include "asm/pgalloc.h"
#include "asm/ptrace.h"
#include "linux/types.h"
#include "linux/utime.h"
#include "linux/sys.h"
+#include "linux/ptrace.h"
#include "asm/unistd.h"
#include "asm/ptrace.h"
#include "asm/uaccess.h"
#include <linux/stddef.h>
#include <linux/sched.h>
#include <linux/kernel_stat.h>
+#include <linux/ptrace.h>
#include <asm/irq.h>
#include <asm/hardirq.h>
#include <asm/errno.h>
#include <linux/aio_abi.h>
#include <linux/compat.h>
#include <linux/vfs.h>
+#include <linux/ptrace.h>
#include <asm/mman.h>
#include <asm/types.h>
#include <asm/uaccess.h>
#include <linux/binfmts.h>
#include <linux/personality.h>
#include <linux/init.h>
+#include <linux/ptrace.h>
#include <asm/system.h>
#include <asm/uaccess.h>
#include <linux/kallsyms.h>
#include <linux/mount.h>
#include <linux/security.h>
+#include <linux/ptrace.h>
/*
* For hysterical raisins we keep the same inumbers as in the old procfs.
/* ptrace.h */
/* structs and defines to help the user use the ptrace system call. */
-#include <linux/compiler.h>
-
/* has the defines to get at the registers. */
#define PTRACE_TRACEME 0
#define PTRACE_O_TRACEVFORKDONE 0x00000020
#define PTRACE_O_TRACEEXIT 0x00000040
+#define PTRACE_O_MASK 0x0000007f
+
/* Wait extended result codes for the above trace options. */
#define PTRACE_EVENT_FORK 1
#define PTRACE_EVENT_VFORK 2
#define PTRACE_EVENT_EXIT 6
#include <asm/ptrace.h>
-#include <linux/sched.h>
+
+#ifdef __KERNEL__
+/*
+ * Ptrace flags
+ */
+
+#define PT_PTRACED 0x00000001
+#define PT_DTRACE 0x00000002 /* delayed trace (used on m68k, i386) */
+#define PT_TRACESYSGOOD 0x00000004
+#define PT_PTRACE_CAP 0x00000008 /* ptracer can follow suid-exec */
+#define PT_TRACE_FORK 0x00000010
+#define PT_TRACE_VFORK 0x00000020
+#define PT_TRACE_CLONE 0x00000040
+#define PT_TRACE_EXEC 0x00000080
+#define PT_TRACE_VFORK_DONE 0x00000100
+#define PT_TRACE_EXIT 0x00000200
+
+#define PT_TRACE_MASK 0x000003f4
+
+#include <linux/compiler.h> /* For unlikely. */
+#include <linux/sched.h> /* For struct task_struct. */
extern int ptrace_readdata(struct task_struct *tsk, unsigned long src, char *dst, int len);
extern int ptrace_writedata(struct task_struct *tsk, char * src, unsigned long dst, int len);
extern int ptrace_request(struct task_struct *child, long request, long addr, long data);
extern void ptrace_notify(int exit_code);
extern void __ptrace_link(struct task_struct *child,
- struct task_struct *new_parent);
+ struct task_struct *new_parent);
extern void __ptrace_unlink(struct task_struct *child);
static inline void ptrace_link(struct task_struct *child,
- struct task_struct *new_parent)
+ struct task_struct *new_parent)
{
if (unlikely(child->ptrace))
__ptrace_link(child, new_parent);
if (unlikely(child->ptrace))
__ptrace_unlink(child);
}
+#endif
#endif
#define PF_FSTRANS 0x00020000 /* inside a filesystem transaction */
#define PF_KSWAPD 0x00040000 /* I am kswapd */
-/*
- * Ptrace flags
- */
-
-#define PT_PTRACED 0x00000001
-#define PT_DTRACE 0x00000002 /* delayed trace (used on m68k, i386) */
-#define PT_TRACESYSGOOD 0x00000004
-#define PT_PTRACE_CAP 0x00000008 /* ptracer can follow suid-exec */
-#define PT_TRACE_FORK 0x00000010
-#define PT_TRACE_VFORK 0x00000020
-#define PT_TRACE_CLONE 0x00000040
-#define PT_TRACE_EXEC 0x00000080
-#define PT_TRACE_VFORK_DONE 0x00000100
-#define PT_TRACE_EXIT 0x00000200
-
#if CONFIG_SMP
extern void set_cpus_allowed(task_t *p, unsigned long new_mask);
#else
* only has special meaning to our real parent.
*/
if (tsk->exit_signal != -1) {
- if (tsk->parent == tsk->real_parent)
- do_notify_parent(tsk, tsk->exit_signal);
- else
- do_notify_parent(tsk, SIGCHLD);
+ int signal = tsk->parent == tsk->real_parent ? tsk->exit_signal : SIGCHLD;
+ do_notify_parent(tsk, signal);
}
tsk->state = TASK_ZOMBIE;
static int ptrace_setoptions(struct task_struct *child, long data)
{
+ child->ptrace &= ~PT_TRACE_MASK;
+
if (data & PTRACE_O_TRACESYSGOOD)
child->ptrace |= PT_TRACESYSGOOD;
- else
- child->ptrace &= ~PT_TRACESYSGOOD;
if (data & PTRACE_O_TRACEFORK)
child->ptrace |= PT_TRACE_FORK;
- else
- child->ptrace &= ~PT_TRACE_FORK;
if (data & PTRACE_O_TRACEVFORK)
child->ptrace |= PT_TRACE_VFORK;
- else
- child->ptrace &= ~PT_TRACE_VFORK;
if (data & PTRACE_O_TRACECLONE)
child->ptrace |= PT_TRACE_CLONE;
- else
- child->ptrace &= ~PT_TRACE_CLONE;
if (data & PTRACE_O_TRACEEXEC)
child->ptrace |= PT_TRACE_EXEC;
- else
- child->ptrace &= ~PT_TRACE_EXEC;
if (data & PTRACE_O_TRACEVFORKDONE)
child->ptrace |= PT_TRACE_VFORK_DONE;
- else
- child->ptrace &= ~PT_TRACE_VFORK_DONE;
if (data & PTRACE_O_TRACEEXIT)
child->ptrace |= PT_TRACE_EXIT;
- else
- child->ptrace &= ~PT_TRACE_EXIT;
-
- if ((data & (PTRACE_O_TRACESYSGOOD | PTRACE_O_TRACEFORK
- | PTRACE_O_TRACEVFORK | PTRACE_O_TRACECLONE
- | PTRACE_O_TRACEEXEC | PTRACE_O_TRACEEXIT
- | PTRACE_O_TRACEVFORKDONE))
- != data)
- return -EINVAL;
- return 0;
+ return (data & ~PTRACE_O_MASK) ? -EINVAL : 0;
}
static int ptrace_getsiginfo(struct task_struct *child, long data)
#include <linux/tty.h>
#include <linux/binfmts.h>
#include <linux/security.h>
+#include <linux/ptrace.h>
#include <asm/param.h>
#include <asm/uaccess.h>
#include <asm/siginfo.h>
#include <linux/smp_lock.h>
#include <linux/skbuff.h>
#include <linux/netlink.h>
+#include <linux/ptrace.h>
int cap_capable (struct task_struct *tsk, int cap)
{