Commit fd44ae68 authored by Daniel Jacobowitz's avatar Daniel Jacobowitz

Clean up ptrace_setoptions and PT_* constants

parent fb585be3
......@@ -7,6 +7,7 @@
#include <linux/types.h>
#include <linux/stddef.h>
#include <linux/sched.h>
#include <linux/ptrace.h>
#include <asm/io.h>
#define DEFINE(sym, val) \
......
......@@ -36,6 +36,7 @@
#include <linux/mc146818rtc.h>
#include <linux/module.h>
#include <linux/kallsyms.h>
#include <linux/ptrace.h>
#include <asm/uaccess.h>
#include <asm/pgtable.h>
......
......@@ -24,6 +24,7 @@
#include <linux/interrupt.h>
#include <linux/highmem.h>
#include <linux/kallsyms.h>
#include <linux/ptrace.h>
#ifdef CONFIG_EISA
#include <linux/ioport.h>
......
......@@ -40,6 +40,7 @@
#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>
......
......@@ -25,6 +25,7 @@
+---------------------------------------------------------------------------*/
#include <linux/signal.h>
#include <linux/ptrace.h>
#include <asm/uaccess.h>
#include <asm/desc.h>
......
......@@ -29,6 +29,7 @@
#include <linux/string.h>
#include <linux/linkage.h>
#include <linux/init.h>
#include <linux/ptrace.h>
#include <asm/setup.h>
#include <asm/fpu.h>
......
......@@ -11,6 +11,7 @@
#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>
......
......@@ -27,6 +27,7 @@
#include <linux/string.h>
#include <linux/linkage.h>
#include <linux/init.h>
#include <linux/ptrace.h>
#include <asm/setup.h>
#include <asm/fpu.h>
......
......@@ -12,6 +12,7 @@
#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>
......
......@@ -16,6 +16,7 @@
#include <linux/sched.h>
#include <linux/string.h>
#include <linux/utsname.h>
#include <linux/ptrace.h>
#include <asm/cachectl.h>
#include <asm/pgalloc.h>
......
......@@ -9,6 +9,7 @@
#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>
......
......@@ -53,6 +53,7 @@
#include <linux/binfmts.h>
#include <linux/namei.h>
#include <linux/vfs.h>
#include <linux/ptrace.h>
#include <asm/types.h>
#include <asm/uaccess.h>
......
......@@ -31,6 +31,7 @@
#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>
......
......@@ -58,6 +58,7 @@
#include <linux/dnotify.h>
#include <linux/security.h>
#include <linux/compat.h>
#include <linux/ptrace.h>
#include <asm/types.h>
#include <asm/ipc.h>
......
......@@ -58,6 +58,7 @@
#include <linux/binfmts.h>
#include <linux/compat.h>
#include <linux/vfs.h>
#include <linux/ptrace.h>
#include <asm/types.h>
#include <asm/ipc.h>
......
......@@ -15,6 +15,7 @@
#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>
......
......@@ -54,6 +54,7 @@
#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>
......
......@@ -5,6 +5,7 @@
#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"
......
......@@ -14,6 +14,7 @@
#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"
......
......@@ -5,6 +5,7 @@
#include "linux/sched.h"
#include "linux/slab.h"
#include "linux/ptrace.h"
#include "kern_util.h"
#include "time_user.h"
#include "signal_user.h"
......
......@@ -7,6 +7,7 @@
#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"
......
......@@ -6,6 +6,7 @@
#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"
......
......@@ -11,6 +11,7 @@
#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>
......
......@@ -59,6 +59,7 @@
#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>
......
......@@ -24,6 +24,7 @@
#include <linux/binfmts.h>
#include <linux/personality.h>
#include <linux/init.h>
#include <linux/ptrace.h>
#include <asm/system.h>
#include <asm/uaccess.h>
......
......@@ -31,6 +31,7 @@
#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.
......
......@@ -3,8 +3,6 @@
/* 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
......@@ -38,6 +36,8 @@
#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
......@@ -47,7 +47,27 @@
#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);
......@@ -58,11 +78,11 @@ extern int ptrace_check_attach(struct task_struct *task, int kill);
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);
......@@ -72,5 +92,6 @@ static inline void ptrace_unlink(struct task_struct *child)
if (unlikely(child->ptrace))
__ptrace_unlink(child);
}
#endif
#endif
......@@ -446,21 +446,6 @@ do { if (atomic_dec_and_test(&(tsk)->usage)) __put_task_struct(tsk); } while(0)
#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
......
......@@ -694,10 +694,8 @@ static void exit_notify(struct task_struct *tsk)
* 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;
......
......@@ -252,49 +252,30 @@ int ptrace_writedata(struct task_struct *tsk, char * src, unsigned long dst, int
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)
......
......@@ -19,6 +19,7 @@
#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>
......
......@@ -18,6 +18,7 @@
#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)
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment