rpms/kernel/devel kernel.spec, 1.235, 1.236 linux-2.6-proc-self-maps-fix.patch, 1.13, 1.14 linux-2.6-utrace-core.patch, 1.8, 1.9 linux-2.6-utrace-ptrace-compat-avr32.patch, 1.3, 1.4 linux-2.6-utrace-ptrace-compat-s390.patch, 1.2, 1.3 linux-2.6-utrace-ptrace-compat.patch, 1.8, 1.9 linux-2.6-utrace-regset-s390.patch, 1.3, 1.4 linux-2.6-utrace-regset.patch, 1.8, 1.9 linux-2.6-utrace-tracehook-avr32.patch, 1.2, 1.3 linux-2.6-utrace-tracehook-s390.patch, 1.2, 1.3 linux-2.6-utrace-tracehook-um.patch, 1.3, 1.4 linux-2.6-utrace-tracehook.patch, 1.15, 1.16
Roland McGrath (roland)
fedora-extras-commits at redhat.com
Mon Nov 12 08:20:19 UTC 2007
- Previous message (by thread): rpms/nginx/EL-5 .cvsignore, 1.7, 1.8 nginx.spec, 1.10, 1.11 sources, 1.8, 1.9
- Next message (by thread): rpms/python-biopython/F-7 .cvsignore, 1.2, 1.3 python-biopython.spec, 1.4, 1.5 sources, 1.2, 1.3 biopython-setup_test.patch, 1.1, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: roland
Update of /cvs/pkgs/rpms/kernel/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv10235
Modified Files:
kernel.spec linux-2.6-proc-self-maps-fix.patch
linux-2.6-utrace-core.patch
linux-2.6-utrace-ptrace-compat-avr32.patch
linux-2.6-utrace-ptrace-compat-s390.patch
linux-2.6-utrace-ptrace-compat.patch
linux-2.6-utrace-regset-s390.patch
linux-2.6-utrace-regset.patch
linux-2.6-utrace-tracehook-avr32.patch
linux-2.6-utrace-tracehook-s390.patch
linux-2.6-utrace-tracehook-um.patch
linux-2.6-utrace-tracehook.patch
Log Message:
utrace rebased
Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/kernel.spec,v
retrieving revision 1.235
retrieving revision 1.236
diff -u -r1.235 -r1.236
--- kernel.spec 11 Nov 2007 08:00:52 -0000 1.235
+++ kernel.spec 12 Nov 2007 08:19:34 -0000 1.236
@@ -921,7 +921,6 @@
%if !%{nopatches}
# Roland's utrace ptrace replacement.
-%if 0
# Main patch includes i386, x86_64, powerpc.
ApplyPatch linux-2.6-utrace-tracehook.patch
# Additional arch work by other contributors.
@@ -949,7 +948,6 @@
# setuid /proc/self/maps fix. (dependent on utrace)
ApplyPatch linux-2.6-proc-self-maps-fix.patch
-%endif
# Nouveau DRM + drm fixes
ApplyPatch nouveau-drm.patch
@@ -1680,6 +1678,9 @@
# Checkout F-8/ and commit there.
#
%changelog
+* Mon Nov 12 2007 Roland McGrath <roland at redhat.com>
+- utrace rebased
+
* Sun Nov 11 2007 Dave Jones <davej at redhat.com>
- 2.6.24-rc2-git2
linux-2.6-proc-self-maps-fix.patch:
Index: linux-2.6-proc-self-maps-fix.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/linux-2.6-proc-self-maps-fix.patch,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- linux-2.6-proc-self-maps-fix.patch 4 Jun 2007 22:34:01 -0000 1.13
+++ linux-2.6-proc-self-maps-fix.patch 12 Nov 2007 08:19:34 -0000 1.14
@@ -1,12 +1,37 @@
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=165351
-Index: linux-2.6/fs/proc/base.c
-===================================================================
---- linux-2.6.orig/fs/proc/base.c
+--- linux-2.6/fs/proc/task_mmu.c.proc-self-maps-fix
++++ linux-2.6/fs/proc/task_mmu.c
+@@ -420,12 +420,11 @@ static void *m_start(struct seq_file *m,
+ if (!priv->task)
+ return NULL;
+
+- mm = get_task_mm(priv->task);
++ mm = mm_for_maps(priv->task);
+ if (!mm)
+ return NULL;
+
+ priv->tail_vma = tail_vma = get_gate_vma(priv->task);
+- down_read(&mm->mmap_sem);
+
+ /* Start with last addr hint */
+ if (last_addr && (vma = find_vma(mm, last_addr))) {
+--- linux-2.6/fs/proc/internal.h.proc-self-maps-fix
++++ linux-2.6/fs/proc/internal.h
+@@ -27,6 +27,8 @@ struct vmalloc_info {
+ unsigned long largest_chunk;
+ };
+
++extern struct mm_struct *mm_for_maps(struct task_struct *);
++
+ #ifdef CONFIG_MMU
+ #define VMALLOC_TOTAL (VMALLOC_END - VMALLOC_START)
+ extern void get_vmalloc_info(struct vmalloc_info *vmi);
+--- linux-2.6/fs/proc/base.c.proc-self-maps-fix
+++ linux-2.6/fs/proc/base.c
-@@ -190,6 +190,26 @@ static int proc_root_link(struct inode *
- return result;
+@@ -193,6 +193,25 @@ int ptrace_may_attach(struct task_struct
+ return !err;
}
+struct mm_struct *mm_for_maps(struct task_struct *task)
@@ -28,38 +53,6 @@
+ mmput(mm);
+ return NULL;
+}
-+
- static int proc_pid_environ(struct task_struct *task, char * buffer)
- {
- int res = 0;
-Index: linux-2.6/fs/proc/internal.h
-===================================================================
---- linux-2.6.orig/fs/proc/internal.h
-+++ linux-2.6/fs/proc/internal.h
-@@ -16,6 +16,8 @@ struct vmalloc_info {
- unsigned long largest_chunk;
- };
-
-+extern struct mm_struct *mm_for_maps(struct task_struct *);
-+
- #ifdef CONFIG_MMU
- #define VMALLOC_TOTAL (VMALLOC_END - VMALLOC_START)
- extern void get_vmalloc_info(struct vmalloc_info *vmi);
-Index: linux-2.6/fs/proc/task_mmu.c
-===================================================================
---- linux-2.6.orig/fs/proc/task_mmu.c
-+++ linux-2.6/fs/proc/task_mmu.c
-@@ -348,12 +348,11 @@ static void *m_start(struct seq_file *m,
- if (!priv->task)
- return NULL;
-
-- mm = get_task_mm(priv->task);
-+ mm = mm_for_maps(priv->task);
- if (!mm)
- return NULL;
- priv->tail_vma = tail_vma = get_gate_vma(priv->task);
-- down_read(&mm->mmap_sem);
-
- /* Start with last addr hint */
- if (last_addr && (vma = find_vma(mm, last_addr))) {
+ static int proc_cwd_link(struct inode *inode, struct dentry **dentry, struct vfsmount **mnt)
+ {
linux-2.6-utrace-core.patch:
Index: linux-2.6-utrace-core.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/linux-2.6-utrace-core.patch,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- linux-2.6-utrace-core.patch 25 Sep 2007 01:28:29 -0000 1.8
+++ linux-2.6-utrace-core.patch 12 Nov 2007 08:19:34 -0000 1.9
@@ -27,8 +27,8 @@
include/linux/tracehook.h | 85 +
include/linux/utrace.h | 544 +++++++++
include/linux/sched.h | 5
- init/Kconfig | 20
- 9 files changed, 3600 insertions(+), 18 deletions(-)
+ init/Kconfig | 18
+ 9 files changed, 3598 insertions(+), 18 deletions(-)
create kernel/utrace.c
create Documentation/utrace.txt
create Documentation/DocBook/utrace.tmpl
@@ -36,10 +36,10 @@
--- linux-2.6/kernel/Makefile
+++ linux-2.6/kernel/Makefile
-@@ -51,6 +51,7 @@ obj-$(CONFIG_RELAY) += relay.o
- obj-$(CONFIG_SYSCTL) += utsname_sysctl.o
+@@ -58,6 +58,7 @@ obj-$(CONFIG_SYSCTL) += utsname_sysctl.o
obj-$(CONFIG_TASK_DELAY_ACCT) += delayacct.o
obj-$(CONFIG_TASKSTATS) += taskstats.o tsacct.o
+ obj-$(CONFIG_MARKERS) += marker.o
+obj-$(CONFIG_UTRACE) += utrace.o
ifneq ($(CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER),y)
@@ -2997,7 +2997,7 @@
- kernel-api.xml filesystems.xml lsm.xml usb.xml \
+ kernel-api.xml filesystems.xml lsm.xml utrace.xml usb.xml \
gadget.xml libata.xml mtdnand.xml librs.xml rapidio.xml \
- genericirq.xml
+ genericirq.xml s390-drivers.xml
--- linux-2.6/Documentation/DocBook/utrace.tmpl
+++ linux-2.6/Documentation/DocBook/utrace.tmpl
@@ -3851,7 +3851,7 @@
+#endif /* linux/utrace.h */
--- linux-2.6/include/linux/sched.h
+++ linux-2.6/include/linux/sched.h
-@@ -1081,6 +1081,11 @@ struct task_struct {
+@@ -1060,6 +1060,11 @@ struct task_struct {
struct audit_context *audit_context;
seccomp_t seccomp;
@@ -3865,13 +3865,10 @@
u32 self_exec_id;
--- linux-2.6/init/Kconfig
+++ linux-2.6/init/Kconfig
-@@ -667,4 +667,24 @@ config STOP_MACHINE
- help
- Need stop_machine() primitive.
+@@ -744,3 +744,21 @@ source "block/Kconfig"
-+menu "Block layer"
- source "block/Kconfig"
-+endmenu
+ config PREEMPT_NOTIFIERS
+ bool
+
+menu "Process debugging support"
+
linux-2.6-utrace-ptrace-compat-avr32.patch:
Index: linux-2.6-utrace-ptrace-compat-avr32.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/linux-2.6-utrace-ptrace-compat-avr32.patch,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- linux-2.6-utrace-ptrace-compat-avr32.patch 21 Aug 2007 19:42:55 -0000 1.3
+++ linux-2.6-utrace-ptrace-compat-avr32.patch 12 Nov 2007 08:19:34 -0000 1.4
@@ -12,12 +12,12 @@
---
- arch/avr32/kernel/ptrace.c | 98 ++++++++------------------------------------
- 1 files changed, 18 insertions(+), 80 deletions(-)
+ arch/avr32/kernel/ptrace.c | 93 +++++++++-----------------------------------
+ 1 files changed, 18 insertions(+), 75 deletions(-)
--- linux-2.6/arch/avr32/kernel/ptrace.c
+++ linux-2.6/arch/avr32/kernel/ptrace.c
-@@ -79,106 +79,44 @@ const struct utrace_regset_view *utrace_
+@@ -79,101 +79,44 @@ const struct utrace_regset_view *utrace_
}
#endif /* CONFIG_UTRACE */
@@ -109,11 +109,6 @@
- child->exit_code = data;
- wake_up_process(child);
- ret = 0;
-- break;
--
-- /* Detach a process that was attached */
-- case PTRACE_DETACH:
-- ret = ptrace_detach(child, data);
+ return ptrace_pokeusr(child, engine, avr32_uarea, addr, data);
break;
linux-2.6-utrace-ptrace-compat-s390.patch:
Index: linux-2.6-utrace-ptrace-compat-s390.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/linux-2.6-utrace-ptrace-compat-s390.patch,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- linux-2.6-utrace-ptrace-compat-s390.patch 21 Aug 2007 19:42:55 -0000 1.2
+++ linux-2.6-utrace-ptrace-compat-s390.patch 12 Nov 2007 08:19:34 -0000 1.3
@@ -7,13 +7,13 @@
---
- arch/s390/kernel/ptrace.c | 151 +++++++++++++++++++++++++++++++++++++
+ arch/s390/kernel/ptrace.c | 155 +++++++++++++++++++++++++++++++++++++
arch/s390/kernel/compat_wrapper.S | 2
- 2 files changed, 152 insertions(+), 1 deletions(-)
+ 2 files changed, 156 insertions(+), 1 deletions(-)
--- linux-2.6/arch/s390/kernel/ptrace.c
+++ linux-2.6/arch/s390/kernel/ptrace.c
-@@ -580,6 +580,157 @@ const struct utrace_regset_view *utrace_
+@@ -595,6 +595,161 @@ const struct utrace_regset_view *utrace_
}
@@ -122,11 +122,15 @@
+
+#ifdef CONFIG_COMPAT
+static const struct ptrace_layout_segment s390_compat_uarea[] = {
-+ {PT_PSWMASK / 2, PT_FPC / 2, 0, 0},
-+ {PT_FPC / 2, PT_CR_9 / 2, 1, 0},
-+ {PT_CR_9 / 2, PT_IEEE_IP / 2, 2, 0},
-+ {PT_IEEE_IP / 2, sizeof(struct user32), -1, -1},
-+ {0, 0, -1, 0}
++ { offsetof(struct user_regs_struct32, psw),
++ offsetof(struct user_regs_struct32, fp_regs), 0, 0 },
++ { offsetof(struct user_regs_struct32, fp_regs),
++ offsetof(struct user_regs_struct32, per_info), 1, 0 },
++ { offsetof(struct user_regs_struct32, per_info),
++ offsetof(struct user_regs_struct32, ieee_instruction_pointer), 2, 0 },
++ { offsetof(struct user_regs_struct32, ieee_instruction_pointer),
++ sizeof(struct user32), -1, -1 },
++ { 0, 0, -1, 0 }
+};
+
+int arch_compat_ptrace(compat_long_t *request,
linux-2.6-utrace-ptrace-compat.patch:
Index: linux-2.6-utrace-ptrace-compat.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/linux-2.6-utrace-ptrace-compat.patch,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- linux-2.6-utrace-ptrace-compat.patch 25 Sep 2007 01:28:29 -0000 1.8
+++ linux-2.6-utrace-ptrace-compat.patch 12 Nov 2007 08:19:34 -0000 1.9
@@ -13,31 +13,30 @@
---
fs/proc/base.c | 40 +
- arch/i386/kernel/ptrace.c | 40 +
- arch/x86_64/ia32/ptrace32.c | 56 +
- arch/x86_64/ia32/ia32entry.S | 2
- arch/x86_64/kernel/ptrace.c | 46 +
- arch/powerpc/kernel/ptrace.c | 452 +++++----
+ arch/powerpc/kernel/ptrace.c | 454 +++++----
arch/powerpc/kernel/signal_32.c | 52 +
arch/powerpc/kernel/Makefile | 2
- arch/powerpc/kernel/ptrace32.c | 408 --------
+ arch/powerpc/kernel/ptrace32.c | 416 --------
arch/powerpc/lib/sstep.c | 3
+ arch/x86/ia32/ptrace32.c | 57 +
+ arch/x86/ia32/ia32entry.S | 2
+ arch/x86/kernel/ptrace_64.c | 46 +
+ arch/x86/kernel/ptrace_32.c | 40 +
kernel/fork.c | 2
kernel/exit.c | 13
- kernel/ptrace.c | 2056 +++++++++++++++++++++++++++++++++++++--
+ kernel/ptrace.c | 2061 +++++++++++++++++++++++++++++++++++++--
kernel/sys_ni.c | 4
kernel/Makefile | 3
include/linux/sched.h | 4
include/linux/ptrace.h | 221 +++-
- include/asm-x86_64/tracehook.h | 1
- include/asm-x86_64/ptrace-abi.h | 3
+ include/asm-x86/ptrace-abi.h | 3
init/Kconfig | 15
- 20 files changed, 2643 insertions(+), 780 deletions(-)
+ 19 files changed, 2650 insertions(+), 788 deletions(-)
delete arch/powerpc/kernel/ptrace32.c
--- linux-2.6/fs/proc/base.c
+++ linux-2.6/fs/proc/base.c
-@@ -151,6 +151,46 @@ static int get_nr_threads(struct task_st
+@@ -154,6 +154,46 @@ static int get_nr_threads(struct task_st
return count;
}
@@ -84,193 +83,9 @@
static int proc_cwd_link(struct inode *inode, struct dentry **dentry, struct vfsmount **mnt)
{
struct task_struct *task = get_proc_task(inode);
---- linux-2.6/arch/i386/kernel/ptrace.c
-+++ linux-2.6/arch/i386/kernel/ptrace.c
-@@ -747,6 +747,46 @@ const struct utrace_regset_view *utrace_
- return &utrace_i386_native;
- }
-
-+#ifdef CONFIG_PTRACE
-+static const struct ptrace_layout_segment i386_uarea[] = {
-+ {0, FRAME_SIZE*4, 0, 0},
-+ {FRAME_SIZE*4, offsetof(struct user, u_debugreg[0]), -1, 0},
-+ {offsetof(struct user, u_debugreg[0]),
-+ offsetof(struct user, u_debugreg[8]), 4, 0},
-+ {0, 0, -1, 0}
-+};
-+
-+int arch_ptrace(long *req, struct task_struct *child,
-+ struct utrace_attached_engine *engine,
-+ unsigned long addr, unsigned long data, long *val)
-+{
-+ switch (*req) {
-+ case PTRACE_PEEKUSR:
-+ return ptrace_peekusr(child, engine, i386_uarea, addr, data);
-+ case PTRACE_POKEUSR:
-+ return ptrace_pokeusr(child, engine, i386_uarea, addr, data);
-+ case PTRACE_GETREGS:
-+ return ptrace_whole_regset(child, engine, data, 0, 0);
-+ case PTRACE_SETREGS:
-+ return ptrace_whole_regset(child, engine, data, 0, 1);
-+ case PTRACE_GETFPREGS:
-+ return ptrace_whole_regset(child, engine, data, 1, 0);
-+ case PTRACE_SETFPREGS:
-+ return ptrace_whole_regset(child, engine, data, 1, 1);
-+ case PTRACE_GETFPXREGS:
-+ return ptrace_whole_regset(child, engine, data, 2, 0);
-+ case PTRACE_SETFPXREGS:
-+ return ptrace_whole_regset(child, engine, data, 2, 1);
-+ case PTRACE_GET_THREAD_AREA:
-+ case PTRACE_SET_THREAD_AREA:
-+ return ptrace_onereg_access(child, engine,
-+ utrace_native_view(current), 3,
-+ addr, (void __user *)data,
-+ *req == PTRACE_SET_THREAD_AREA);
-+ }
-+ return -ENOSYS;
-+}
-+#endif
-
- void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code)
- {
---- linux-2.6/arch/x86_64/ia32/ptrace32.c
-+++ linux-2.6/arch/x86_64/ia32/ptrace32.c
-@@ -167,11 +167,6 @@ static int getreg32(struct task_struct *
-
- #undef R32
-
--asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data)
--{
-- return -ENOSYS;
--}
--
- static int
- ia32_genregs_get(struct task_struct *target,
- const struct utrace_regset *regset,
-@@ -604,3 +599,54 @@ const struct utrace_regset_view utrace_i
- .name = "i386", .e_machine = EM_386,
- .regsets = ia32_regsets, .n = ARRAY_SIZE(ia32_regsets)
- };
-+
-+
-+#ifdef CONFIG_PTRACE
-+/*
-+ * This matches the arch/i386/kernel/ptrace.c definitions.
-+ */
-+
-+static const struct ptrace_layout_segment ia32_uarea[] = {
-+ {0, sizeof(struct user_regs_struct32), 0, 0},
-+ {sizeof(struct user_regs_struct32),
-+ offsetof(struct user32, u_debugreg[0]), -1, 0},
-+ {offsetof(struct user32, u_debugreg[0]),
-+ offsetof(struct user32, u_debugreg[8]), 4, 0},
-+ {0, 0, -1, 0}
-+};
-+
-+int arch_compat_ptrace(compat_long_t *req, struct task_struct *child,
-+ struct utrace_attached_engine *engine,
-+ compat_ulong_t addr, compat_ulong_t data,
-+ compat_long_t *val)
-+{
-+ switch (*req) {
-+ case PTRACE_PEEKUSR:
-+ return ptrace_compat_peekusr(child, engine, ia32_uarea,
-+ addr, data);
-+ case PTRACE_POKEUSR:
-+ return ptrace_compat_pokeusr(child, engine, ia32_uarea,
-+ addr, data);
-+ case PTRACE_GETREGS:
-+ return ptrace_whole_regset(child, engine, data, 0, 0);
-+ case PTRACE_SETREGS:
-+ return ptrace_whole_regset(child, engine, data, 0, 1);
-+ case PTRACE_GETFPREGS:
-+ return ptrace_whole_regset(child, engine, data, 1, 0);
-+ case PTRACE_SETFPREGS:
-+ return ptrace_whole_regset(child, engine, data, 1, 1);
-+ case PTRACE_GETFPXREGS:
-+ return ptrace_whole_regset(child, engine, data, 2, 0);
-+ case PTRACE_SETFPXREGS:
-+ return ptrace_whole_regset(child, engine, data, 2, 1);
-+ case PTRACE_GET_THREAD_AREA:
-+ case PTRACE_SET_THREAD_AREA:
-+ return ptrace_onereg_access(child, engine,
-+ &utrace_ia32_view, 3,
-+ addr,
-+ (void __user *)(unsigned long)data,
-+ *req == PTRACE_SET_THREAD_AREA);
-+ }
-+ return -ENOSYS;
-+}
-+#endif /* CONFIG_PTRACE */
---- linux-2.6/arch/x86_64/ia32/ia32entry.S
-+++ linux-2.6/arch/x86_64/ia32/ia32entry.S
-@@ -434,7 +434,7 @@ ia32_sys_call_table:
- .quad sys_setuid16
- .quad sys_getuid16
- .quad compat_sys_stime /* stime */ /* 25 */
-- .quad sys32_ptrace /* ptrace */
-+ .quad compat_sys_ptrace /* ptrace */
- .quad sys_alarm
- .quad sys_fstat /* (old)fstat */
- .quad sys_pause
---- linux-2.6/arch/x86_64/kernel/ptrace.c
-+++ linux-2.6/arch/x86_64/kernel/ptrace.c
-@@ -722,6 +722,52 @@ const struct utrace_regset_view *utrace_
- }
-
-
-+#ifdef CONFIG_PTRACE
-+static const struct ptrace_layout_segment x86_64_uarea[] = {
-+ {0, sizeof(struct user_regs_struct), 0, 0},
-+ {sizeof(struct user_regs_struct),
-+ offsetof(struct user, u_debugreg[0]), -1, 0},
-+ {offsetof(struct user, u_debugreg[0]),
-+ offsetof(struct user, u_debugreg[8]), 3, 0},
-+ {0, 0, -1, 0}
-+};
-+
-+int arch_ptrace(long *req, struct task_struct *child,
-+ struct utrace_attached_engine *engine,
-+ unsigned long addr, unsigned long data, long *val)
-+{
-+ switch (*req) {
-+ case PTRACE_PEEKUSR:
-+ return ptrace_peekusr(child, engine, x86_64_uarea, addr, data);
-+ case PTRACE_POKEUSR:
-+ return ptrace_pokeusr(child, engine, x86_64_uarea, addr, data);
-+ case PTRACE_GETREGS:
-+ return ptrace_whole_regset(child, engine, data, 0, 0);
-+ case PTRACE_SETREGS:
-+ return ptrace_whole_regset(child, engine, data, 0, 1);
-+ case PTRACE_GETFPREGS:
-+ return ptrace_whole_regset(child, engine, data, 1, 0);
-+ case PTRACE_SETFPREGS:
-+ return ptrace_whole_regset(child, engine, data, 1, 1);
-+#ifdef CONFIG_IA32_EMULATION
-+ case PTRACE_GET_THREAD_AREA:
-+ case PTRACE_SET_THREAD_AREA:
-+ return ptrace_onereg_access(child, engine,
-+ &utrace_ia32_view, 3,
-+ addr, (void __user *)data,
-+ *req == PTRACE_SET_THREAD_AREA);
-+#endif
-+ /* normal 64bit interface to access TLS data.
-+ Works just like arch_prctl, except that the arguments
-+ are reversed. */
-+ case PTRACE_ARCH_PRCTL:
-+ return do_arch_prctl(child, data, addr);
-+ }
-+ return -ENOSYS;
-+}
-+#endif /* CONFIG_PTRACE */
-+
-+
- asmlinkage void syscall_trace_enter(struct pt_regs *regs)
- {
- /* do the secure computing check first */
--- linux-2.6/arch/powerpc/kernel/ptrace.c
+++ linux-2.6/arch/powerpc/kernel/ptrace.c
-@@ -564,249 +564,315 @@ const struct utrace_regset_view *utrace_
+@@ -590,248 +590,320 @@ const struct utrace_regset_view *utrace_
}
@@ -293,6 +108,7 @@
- unsigned long *reg = &((unsigned long *)child->thread.regs)[0];
- unsigned long __user *tmp = (unsigned long __user *)addr;
-
+- CHECK_FULL_REGS(child->thread.regs);
- for (i = 0; i < 32; i++) {
- ret = put_user(*reg, tmp);
- if (ret)
@@ -301,35 +117,6 @@
- tmp++;
- }
- break;
-- }
--
-- case PPC_PTRACE_SETREGS: { /* Set GPRs 0 - 31. */
-- int i;
-- unsigned long *reg = &((unsigned long *)child->thread.regs)[0];
-- unsigned long __user *tmp = (unsigned long __user *)addr;
--
-- for (i = 0; i < 32; i++) {
-- ret = get_user(*reg, tmp);
-- if (ret)
-- break;
-- reg++;
-- tmp++;
-- }
-- break;
-- }
--
-- case PPC_PTRACE_GETFPREGS: { /* Get FPRs 0 - 31. */
-- flush_fp_to_thread(child);
--/* ret = get_fpregs((void __user *)addr, child, 0);*/
-- break;
-- }
--
-- case PPC_PTRACE_SETFPREGS: { /* Get FPRs 0 - 31. */
-- flush_fp_to_thread(child);
--/* ret = set_fpregs((void __user *)addr, child, 0);*/
-- break;
-- }
--
+ switch (*request) {
+ case PPC_PTRACE_GETREGS: /* Get GPRs 0 - 31. */
+ case PPC_PTRACE_SETREGS: /* Set GPRs 0 - 31. */
@@ -346,11 +133,24 @@
+ (void __user *)addr,
+ *request == PPC_PTRACE_SETFPREGS);
}
-- return ret;
+ return -ENOSYS;
- }
++}
--long arch_ptrace(struct task_struct *child, long request, long addr, long data)
+- case PPC_PTRACE_SETREGS: { /* Set GPRs 0 - 31. */
+- int i;
+- unsigned long *reg = &((unsigned long *)child->thread.regs)[0];
+- unsigned long __user *tmp = (unsigned long __user *)addr;
+-
+- CHECK_FULL_REGS(child->thread.regs);
+- for (i = 0; i < 32; i++) {
+- ret = get_user(*reg, tmp);
+- if (ret)
+- break;
+- reg++;
+- tmp++;
+- }
+- break;
+- }
+static const struct ptrace_layout_segment ppc_uarea[] = {
+ {0, PT_FPR0 * sizeof(long), 0, 0},
+ {PT_FPR0 * sizeof(long), (PT_FPSCR + 1) * sizeof(long), 1, 0},
@@ -360,30 +160,28 @@
+int arch_ptrace(long *request, struct task_struct *child,
+ struct utrace_attached_engine *engine,
+ unsigned long addr, unsigned long data, long *val)
- {
-- int ret = -EPERM;
++{
+ switch (*request) {
+ case PTRACE_PEEKUSR:
+ return ptrace_peekusr(child, engine, ppc_uarea, addr, data);
+ case PTRACE_POKEUSR:
+ return ptrace_pokeusr(child, engine, ppc_uarea, addr, data);
-
-- switch (request) {
-- /* when I and D space are separate, these will need to be fixed. */
-- case PTRACE_PEEKTEXT: /* read word at location addr. */
-- case PTRACE_PEEKDATA:
-- ret = generic_ptrace_peekdata(child, addr, data);
-- break;
++
+ case PTRACE_GET_DEBUGREG:
-+ case PTRACE_SET_DEBUGREG:
+ return ptrace_onereg_access(child, engine,
+ utrace_native_view(current), 3,
+ addr, (unsigned long __user *)data,
-+ *request == PTRACE_SET_DEBUGREG);
++ NULL, 0);
++ case PTRACE_SET_DEBUGREG:
++ return ptrace_onereg_access(child, engine,
++ utrace_native_view(current), 3,
++ addr, NULL, &data, 1);
-- /* read the word at location addr in the USER area. */
-- case PTRACE_PEEKUSR: {
-- unsigned long index, tmp;
+- case PPC_PTRACE_GETFPREGS: { /* Get FPRs 0 - 31. */
+- flush_fp_to_thread(child);
+-/* ret = get_fpregs((void __user *)addr, child, 0);*/
+- break;
+- }
+#ifdef CONFIG_PPC64
+ case PTRACE_GETREGS64:
+ case PTRACE_SETREGS64:
@@ -397,7 +195,7 @@
+ return ptrace_regset_access(child, engine,
+ &utrace_ppc_native_view, 0,
+ 0, sizeof(struct pt_regs),
-+ (void __user *)addr,
++ (struct pt_regs __user *)data,
+ *request == PTRACE_SETREGS ||
+ *request == PTRACE_SETREGS64);
+
@@ -406,12 +204,11 @@
+ case PTRACE_SETFPREGS:
+ return ptrace_whole_regset(child, engine, data, 1, 1);
-- ret = -EIO;
-- /* convert to index and check */
--#ifdef CONFIG_PPC32
-- index = (unsigned long) addr >> 2;
-- if ((addr & 3) || (index > PT_FPSCR)
-- || (child->thread.regs == NULL))
+- case PPC_PTRACE_SETFPREGS: { /* Get FPRs 0 - 31. */
+- flush_fp_to_thread(child);
+-/* ret = set_fpregs((void __user *)addr, child, 0);*/
+- break;
+- }
+#ifdef CONFIG_ALTIVEC
+ case PTRACE_GETVRREGS:
+ return ptrace_whole_regset(child, engine, data, 2, 0);
@@ -421,27 +218,15 @@
+#ifdef CONFIG_SPE
+#ifdef CONFIG_ALTIVEC
+#define REGSET_EVR 3
- #else
-- index = (unsigned long) addr >> 3;
-- if ((addr & 7) || (index > PT_FPSCR))
++#else
+#define REGSET_EVR 2
+#endif
+ case PTRACE_GETEVRREGS:
+ return ptrace_whole_regset(child, engine, data, REGSET_EVR, 0);
+ case PTRACE_SETEVRREGS:
+ return ptrace_whole_regset(child, engine, data, REGSET_EVR, 1);
- #endif
-- break;
++#endif
-- CHECK_FULL_REGS(child->thread.regs);
-- if (index < PT_FPR0) {
-- tmp = 0;/*ptrace_get_reg(child, (int) index);*/
-- } else {
-- flush_fp_to_thread(child);
-- tmp = ((unsigned long *)child->thread.fpr)[index - PT_FPR0];
-- }
-- ret = put_user(tmp,(unsigned long __user *) data);
-- break;
+ /* Old reverse args ptrace callss */
+ case PPC_PTRACE_GETREGS: /* Get GPRs 0 - 31. */
+ case PPC_PTRACE_SETREGS: /* Set GPRs 0 - 31. */
@@ -449,18 +234,12 @@
+ case PPC_PTRACE_SETFPREGS: /* Get FPRs 0 - 31. */
+ return arch_ptrace_old(request, child, engine, addr, data, val);
}
-
-- /* If I and D space are separate, this will have to be fixed. */
-- case PTRACE_POKETEXT: /* write the word at location addr. */
-- case PTRACE_POKEDATA:
-- ret = generic_ptrace_pokedata(child, addr, data);
-- break;
+- return ret;
++
+ return -ENOSYS;
-+}
+ }
-- /* write the word at location addr in the USER area */
-- case PTRACE_POKEUSR: {
-- unsigned long index;
+-long arch_ptrace(struct task_struct *child, long request, long addr, long data)
+#ifdef CONFIG_PPC64
+/*
+ * Here are the old "legacy" powerpc specific getregs/setregs ptrace calls,
@@ -471,7 +250,8 @@
+ struct utrace_attached_engine *engine,
+ compat_ulong_t addr, compat_ulong_t data,
+ compat_long_t *val)
-+{
+ {
+- int ret = -EPERM;
+ void __user *uaddr = (void __user *) (unsigned long) addr;
+ switch (*request) {
+ case PPC_PTRACE_GETREGS: /* Get GPRs 0 - 31. */
@@ -484,7 +264,13 @@
+ }
+ return -ENOSYS;
+}
-+
+
+- switch (request) {
+- /* when I and D space are separate, these will need to be fixed. */
+- case PTRACE_PEEKTEXT: /* read word at location addr. */
+- case PTRACE_PEEKDATA:
+- ret = generic_ptrace_peekdata(child, addr, data);
+- break;
+static const struct ptrace_layout_segment ppc32_uarea[] = {
+ {0, PT_FPR0 * sizeof(u32), 0, 0},
+ {PT_FPR0 * sizeof(u32), (PT_FPSCR32 + 1) * sizeof(u32), 1, 0},
@@ -498,9 +284,11 @@
+ compat_long_t *val)
+{
+ long lrequest = *request;
-+ void __user *uaddr = (void __user *) (unsigned long) addr;
+ int ret = -ENOSYS;
-+
+
+- /* read the word at location addr in the USER area. */
+- case PTRACE_PEEKUSR: {
+- unsigned long index, tmp;
+ switch (*request) {
+ case PTRACE_PEEKUSR:
+ return ptrace_compat_peekusr(child, engine, ppc32_uarea,
@@ -510,20 +298,76 @@
+ addr, data);
+
+ /*
-+ * Read 4 bytes of the other process' storage
-+ * data is a pointer specifying where the user wants the
-+ * 4 bytes copied into
-+ * addr is a pointer in the user's storage that contains an 8 byte
-+ * address in the other process of the 4 bytes that is to be read
++ * Read 4 bytes of the other process' storage
++ * data is a pointer specifying where the user wants the
++ * 4 bytes copied into
++ * addr is a pointer in the user's storage that contains an 8 byte
++ * address in the other process of the 4 bytes that is to be read
++ * (this is run in a 32-bit process looking at a 64-bit process)
++ * when I and D space are separate, these will need to be fixed.
++ */
++ case PPC_PTRACE_PEEKTEXT_3264:
++ case PPC_PTRACE_PEEKDATA_3264: {
++ u32 tmp;
++ int copied;
++ u32 __user * addrOthers;
+
+ ret = -EIO;
+- /* convert to index and check */
+-#ifdef CONFIG_PPC32
+- index = (unsigned long) addr >> 2;
+- if ((addr & 3) || (index > PT_FPSCR)
+- || (child->thread.regs == NULL))
+-#else
+- index = (unsigned long) addr >> 3;
+- if ((addr & 7) || (index > PT_FPSCR))
+-#endif
++
++ /* Get the addr in the other process that we want to read */
++ if (get_user(addrOthers, ((u32 __user * __user *)
++ (unsigned long) addr)) != 0)
+ break;
+
+- CHECK_FULL_REGS(child->thread.regs);
+- if (index < PT_FPR0) {
+- tmp = 0;/*ptrace_get_reg(child, (int) index);*/
+- } else {
+- flush_fp_to_thread(child);
+- tmp = ((unsigned long *)child->thread.fpr)[index - PT_FPR0];
+- }
+- ret = put_user(tmp,(unsigned long __user *) data);
++ copied = access_process_vm(child, (u64)addrOthers, &tmp,
++ sizeof(tmp), 0);
++ if (copied != sizeof(tmp))
++ break;
++ ret = put_user(tmp, (u32 __user *)(unsigned long)data);
+ break;
+ }
+
+- /* If I and D space are separate, this will have to be fixed. */
+- case PTRACE_POKETEXT: /* write the word at location addr. */
+- case PTRACE_POKEDATA:
+- ret = generic_ptrace_pokedata(child, addr, data);
+- break;
+-
+- /* write the word at location addr in the USER area */
+- case PTRACE_POKEUSR: {
+- unsigned long index;
++ /*
++ * Write 4 bytes into the other process' storage
++ * data is the 4 bytes that the user wants written
++ * addr is a pointer in the user's storage that contains an
++ * 8 byte address in the other process where the 4 bytes
++ * that is to be written
+ * (this is run in a 32-bit process looking at a 64-bit process)
+ * when I and D space are separate, these will need to be fixed.
+ */
-+ case PPC_PTRACE_PEEKTEXT_3264:
-+ case PPC_PTRACE_PEEKDATA_3264: {
-+ u32 tmp;
-+ int copied;
++ case PPC_PTRACE_POKETEXT_3264:
++ case PPC_PTRACE_POKEDATA_3264: {
++ u32 tmp = data;
+ u32 __user * addrOthers;
++ /* Get the addr in the other process that we want to write into */
ret = -EIO;
- /* convert to index and check */
-#ifdef CONFIG_PPC32
@@ -534,8 +378,10 @@
- index = (unsigned long) addr >> 3;
- if ((addr & 7) || (index > PT_FPSCR))
-#endif
-- break;
-
++ if (get_user(addrOthers, ((u32 __user * __user *)
++ (unsigned long) addr)) != 0)
+ break;
+-
- CHECK_FULL_REGS(child->thread.regs);
- if (index < PT_FPR0) {
-/* ret = ptrace_put_reg(child, index, data);*/
@@ -546,22 +392,18 @@
- }
- break;
- }
-+ /* Get the addr in the other process that we want to read */
-+ if (get_user(addrOthers, ((u32 __user * __user *)
-+ (unsigned long) addr)) != 0)
-+ break;
-
+-
- case PTRACE_GET_DEBUGREG: {
- ret = -EINVAL;
- /* We only support one DABR and no IABRS at the moment */
- if (addr > 0)
-+ copied = access_process_vm(child, (u64)addrOthers, &tmp,
-+ sizeof(tmp), 0);
-+ if (copied != sizeof(tmp))
++ ret = 0;
++ if (access_process_vm(child, (u64)addrOthers, &tmp,
++ sizeof(tmp), 1) == sizeof(tmp))
break;
- ret = put_user(child->thread.dabr,
- (unsigned long __user *)data);
-+ ret = put_user(tmp, (u32 __user *)(unsigned long)data);
++ ret = -EIO;
break;
}
@@ -569,23 +411,18 @@
-/* ret = ptrace_set_debugreg(child, addr, data);*/
- break;
+ /*
-+ * Write 4 bytes into the other process' storage
-+ * data is the 4 bytes that the user wants written
-+ * addr is a pointer in the user's storage that contains an
-+ * 8 byte address in the other process where the 4 bytes
-+ * that is to be written
-+ * (this is run in a 32-bit process looking at a 64-bit process)
-+ * when I and D space are separate, these will need to be fixed.
++ * This is like PTRACE_PEEKUSR on a 64-bit process,
++ * but here we access only 4 bytes at a time.
+ */
-+ case PPC_PTRACE_POKETEXT_3264:
-+ case PPC_PTRACE_POKEDATA_3264: {
-+ u32 tmp = data;
-+ u32 __user * addrOthers;
++ case PPC_PTRACE_PEEKUSR_3264: {
++ union
++ {
++ u64 whole;
++ u32 half[2];
++ } reg;
++ int setno;
++ const struct utrace_regset *regset;
-- case PTRACE_DETACH:
-- ret = ptrace_detach(child, data);
-- break;
--
-#ifdef CONFIG_PPC64
- case PTRACE_GETREGS64:
-#endif
@@ -594,22 +431,29 @@
- if (!access_ok(VERIFY_WRITE, (void __user *)data,
- sizeof(struct pt_regs))) {
- ret = -EIO;
-+ /* Get the addr in the other process that we want to write into */
+ ret = -EIO;
-+ if (get_user(addrOthers, ((u32 __user * __user *)
-+ (unsigned long) addr)) != 0)
++ if ((addr & 3) || addr > PT_FPSCR*8)
break;
-- }
- ret = 0;
++
++ setno = 0;
++ if (addr >= PT_FPR0*8) {
++ setno = 1;
++ addr -= PT_FPR0*8;
+ }
+- CHECK_FULL_REGS(child->thread.regs);
+- ret = 0;
- for (ui = 0; ui < PT_REGS_COUNT; ui ++) {
-/* ret |= __put_user(ptrace_get_reg(child, ui),
- (unsigned long __user *) data);*/
- data += sizeof(long);
- }
-+ if (access_process_vm(child, (u64)addrOthers, &tmp,
-+ sizeof(tmp), 1) == sizeof(tmp))
-+ break;
-+ ret = -EIO;
++ regset = utrace_regset(child, NULL,
++ &utrace_ppc_native_view, setno);
++ ret = (*regset->get)(child, regset, addr &~ 7,
++ sizeof(reg.whole), ®.whole, NULL);
++ if (ret == 0)
++ ret = put_user(reg.half[(addr >> 2) & 1],
++ (u32 __user *)(unsigned long)data);
break;
}
@@ -623,10 +467,10 @@
- sizeof(struct pt_regs))) {
- ret = -EIO;
+ /*
-+ * This is like PTRACE_PEEKUSR on a 64-bit process,
++ * This is like PTRACE_POKEUSR on a 64-bit process,
+ * but here we access only 4 bytes at a time.
+ */
-+ case PPC_PTRACE_PEEKUSR_3264: {
++ case PPC_PTRACE_POKEUSR_3264: {
+ union
+ {
+ u64 whole;
@@ -638,12 +482,8 @@
+ ret = -EIO;
+ if ((addr & 3) || addr > PT_FPSCR*8)
break;
-+
-+ setno = 0;
-+ if (addr >= PT_FPR0*8) {
-+ setno = 1;
-+ addr -= PT_FPR0*8;
- }
+- }
+- CHECK_FULL_REGS(child->thread.regs);
- ret = 0;
- for (ui = 0; ui < PT_REGS_COUNT; ui ++) {
- ret = __get_user(tmp, (unsigned long __user *) data);
@@ -652,41 +492,12 @@
-/* ptrace_put_reg(child, ui, tmp);*/
- data += sizeof(long);
- }
-+ regset = utrace_regset(child, NULL,
-+ &utrace_ppc_native_view, setno);
-+ ret = (*regset->get)(child, regset, addr &~ 7,
-+ sizeof(reg.whole), ®.whole, NULL);
-+ if (ret == 0)
-+ ret = put_user(reg.half[(addr >> 2) & 1],
-+ (u32 __user *)(unsigned long)data);
- break;
- }
-
-- case PTRACE_GETFPREGS: { /* Get the child FPU state (FPR0...31 + FPSCR) */
-- flush_fp_to_thread(child);
--/* ret = get_fpregs((void __user *)data, child, 1);*/
- break;
- }
-+ /*
-+ * This is like PTRACE_POKEUSR on a 64-bit process,
-+ * but here we access only 4 bytes at a time.
-+ */
-+ case PPC_PTRACE_POKEUSR_3264: {
-+ union
-+ {
-+ u64 whole;
-+ u32 half[2];
-+ } reg;
-+ int setno;
-+ const struct utrace_regset *regset;
-- case PTRACE_SETFPREGS: { /* Set the child FPU state (FPR0...31 + FPSCR) */
+- case PTRACE_GETFPREGS: { /* Get the child FPU state (FPR0...31 + FPSCR) */
- flush_fp_to_thread(child);
--/* ret = set_fpregs((void __user *)data, child, 1);*/
-+ ret = -EIO;
-+ if ((addr & 3) || addr > PT_FPSCR*8)
-+ break;
-+
+-/* ret = get_fpregs((void __user *)data, child, 1);*/
+ setno = 0;
+ if (addr >= PT_FPR0*8) {
+ setno = 1;
@@ -703,31 +514,39 @@
break;
}
--#ifdef CONFIG_ALTIVEC
-- case PTRACE_GETVRREGS:
-- /* Get the child altivec register state. */
-- flush_altivec_to_thread(child);
--/* ret = get_vrregs((unsigned long __user *)data, child);*/
+- case PTRACE_SETFPREGS: { /* Set the child FPU state (FPR0...31 + FPSCR) */
+- flush_fp_to_thread(child);
+-/* ret = set_fpregs((void __user *)data, child, 1);*/
- break;
+- }
+ case PTRACE_GET_DEBUGREG:
-+ case PTRACE_SET_DEBUGREG:
+ return ptrace_onereg_access(child, engine,
+ utrace_native_view(current), 3,
+ addr,
+ (u32 __user *) (unsigned long) data,
-+ *request == PTRACE_SET_DEBUGREG);
++ NULL, 0);
++ case PTRACE_SET_DEBUGREG:
++ return ptrace_onereg_access(child, engine,
++ utrace_native_view(current), 3,
++ addr, NULL, &data, 1);
+
+ case PTRACE_GETREGS:
+ case PTRACE_SETREGS:
+ return ptrace_regset_access(child, engine,
+ utrace_native_view(current), 0,
-+ 0, PT_REGS_COUNT * sizeof(int),
-+ uaddr,
++ 0, PT_REGS_COUNT * sizeof(u32),
++ (u32 __user *) (unsigned long) data,
+ *request == PTRACE_SETREGS);
+-#ifdef CONFIG_ALTIVEC
+ case PTRACE_GETFPREGS:
+ case PTRACE_SETFPREGS:
-+ case PTRACE_GETVRREGS:
+ case PTRACE_GETVRREGS:
+- /* Get the child altivec register state. */
+- flush_altivec_to_thread(child);
+-/* ret = get_vrregs((unsigned long __user *)data, child);*/
+- break;
+-
case PTRACE_SETVRREGS:
- /* Set the child altivec register state. */
- flush_altivec_to_thread(child);
@@ -737,8 +556,7 @@
-#ifdef CONFIG_SPE
- case PTRACE_GETEVRREGS:
- /* Get the child spe register state. */
-- if (child->thread.regs->msr & MSR_SPE)
-- giveup_spe(child);
+- flush_spe_to_thread(child);
-/* ret = get_evrregs((unsigned long __user *)data, child);*/
- break;
-
@@ -746,9 +564,9 @@
- /* Set the child spe register state. */
- /* this is to clear the MSR_SPE bit to force a reload
- * of register state from memory */
-- if (child->thread.regs->msr & MSR_SPE)
-- giveup_spe(child);
+- flush_spe_to_thread(child);
-/* ret = set_evrregs(child, (unsigned long __user *)data);*/
+- ret = set_evrregs(child, (unsigned long __user *)data);
- break;
-#endif
+ case PTRACE_GETREGS64:
@@ -853,7 +671,7 @@
firmware.o sysfs.o nvram_64.o
--- linux-2.6/arch/powerpc/kernel/ptrace32.c
+++ linux-2.6/arch/powerpc/kernel/ptrace32.c
-@@ -1,408 +0,0 @@
+@@ -1,416 +0,0 @@
-/*
- * ptrace for 32-bit processes running on a 64-bit kernel.
- *
@@ -907,6 +725,7 @@
- unsigned long *reg = &((unsigned long *)child->thread.regs)[0];
- unsigned int __user *tmp = (unsigned int __user *)addr;
-
+- CHECK_FULL_REGS(child->thread.regs);
- for (i = 0; i < 32; i++) {
- ret = put_user(*reg, tmp);
- if (ret)
@@ -922,6 +741,7 @@
- unsigned long *reg = &((unsigned long *)child->thread.regs)[0];
- unsigned int __user *tmp = (unsigned int __user *)addr;
-
+- CHECK_FULL_REGS(child->thread.regs);
- for (i = 0; i < 32; i++) {
- ret = get_user(*reg, tmp);
- if (ret)
@@ -1021,6 +841,7 @@
- if ((addr & 3) || (index > PT_FPSCR32))
- break;
-
+- CHECK_FULL_REGS(child->thread.regs);
- if (index < PT_FPR0) {
- tmp = 0;/*ptrace_get_reg(child, index);*/
- } else {
@@ -1067,6 +888,7 @@
- if ((addr & 3) || numReg > PT_FPSCR)
- break;
-
+- CHECK_FULL_REGS(child->thread.regs);
- if (numReg >= PT_FPR0) {
- flush_fp_to_thread(child);
- tmp = ((unsigned long int *)child->thread.fpr)[numReg - PT_FPR0];
@@ -1127,6 +949,7 @@
- if ((addr & 3) || (index > PT_FPSCR32))
- break;
-
+- CHECK_FULL_REGS(child->thread.regs);
- if (index < PT_FPR0) {
-/* ret = ptrace_put_reg(child, index, data);*/
- } else {
@@ -1164,6 +987,7 @@
- */
- if ((addr & 3) || (numReg > PT_FPSCR))
- break;
+- CHECK_FULL_REGS(child->thread.regs);
- if (numReg < PT_FPR0) {
- unsigned long freg = 0;/*ptrace_get_reg(child, numReg);*/
- if (index % 2)
@@ -1201,6 +1025,7 @@
- ret = -EIO;
- break;
- }
+- CHECK_FULL_REGS(child->thread.regs);
- ret = 0;
- for (ui = 0; ui < PT_REGS_COUNT; ui ++) {
-/* ret |= __put_user(ptrace_get_reg(child, ui),
@@ -1218,6 +1043,7 @@
- ret = -EIO;
- break;
- }
+- CHECK_FULL_REGS(child->thread.regs);
- ret = 0;
- for (ui = 0; ui < PT_REGS_COUNT; ui ++) {
- ret = __get_user(tmp, (unsigned int __user *) data);
@@ -1272,8 +1098,193 @@
+#include <asm/paca.h>
+#endif
- extern char system_call_common[];
+ extern char system_call_common[];
+
+--- linux-2.6/arch/x86/ia32/ptrace32.c
++++ linux-2.6/arch/x86/ia32/ptrace32.c
+@@ -167,11 +167,6 @@ static int getreg32(struct task_struct *
+
+ #undef R32
+
+-asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data)
+-{
+- return -ENOSYS;
+-}
+-
+ static int
+ ia32_genregs_get(struct task_struct *target,
+ const struct utrace_regset *regset,
+@@ -604,3 +599,55 @@ const struct utrace_regset_view utrace_i
+ .name = "i386", .e_machine = EM_386,
+ .regsets = ia32_regsets, .n = ARRAY_SIZE(ia32_regsets)
+ };
++
++
++#ifdef CONFIG_PTRACE
++/*
++ * This matches the arch/i386/kernel/ptrace.c definitions.
++ */
++
++static const struct ptrace_layout_segment ia32_uarea[] = {
++ {0, sizeof(struct user_regs_struct32), 0, 0},
++ {sizeof(struct user_regs_struct32),
++ offsetof(struct user32, u_debugreg[0]), -1, 0},
++ {offsetof(struct user32, u_debugreg[0]),
++ offsetof(struct user32, u_debugreg[8]), 4, 0},
++ {0, 0, -1, 0}
++};
++
++int arch_compat_ptrace(compat_long_t *req, struct task_struct *child,
++ struct utrace_attached_engine *engine,
++ compat_ulong_t addr, compat_ulong_t data,
++ compat_long_t *val)
++{
++ switch (*req) {
++ case PTRACE_PEEKUSR:
++ return ptrace_compat_peekusr(child, engine, ia32_uarea,
++ addr, data);
++ case PTRACE_POKEUSR:
++ return ptrace_compat_pokeusr(child, engine, ia32_uarea,
++ addr, data);
++ case PTRACE_GETREGS:
++ return ptrace_whole_regset(child, engine, data, 0, 0);
++ case PTRACE_SETREGS:
++ return ptrace_whole_regset(child, engine, data, 0, 1);
++ case PTRACE_GETFPREGS:
++ return ptrace_whole_regset(child, engine, data, 1, 0);
++ case PTRACE_SETFPREGS:
++ return ptrace_whole_regset(child, engine, data, 1, 1);
++ case PTRACE_GETFPXREGS:
++ return ptrace_whole_regset(child, engine, data, 2, 0);
++ case PTRACE_SETFPXREGS:
++ return ptrace_whole_regset(child, engine, data, 2, 1);
++ case PTRACE_GET_THREAD_AREA:
++ case PTRACE_SET_THREAD_AREA:
++ return ptrace_onereg_access(child, engine,
++ &utrace_ia32_view, 3,
++ addr,
++ (void __user *)(unsigned long)data,
++ NULL,
++ *req == PTRACE_SET_THREAD_AREA);
++ }
++ return -ENOSYS;
++}
++#endif /* CONFIG_PTRACE */
+--- linux-2.6/arch/x86/ia32/ia32entry.S
++++ linux-2.6/arch/x86/ia32/ia32entry.S
+@@ -427,7 +427,7 @@ ia32_sys_call_table:
+ .quad sys_setuid16
+ .quad sys_getuid16
+ .quad compat_sys_stime /* stime */ /* 25 */
+- .quad sys32_ptrace /* ptrace */
++ .quad compat_sys_ptrace /* ptrace */
+ .quad sys_alarm
+ .quad sys_fstat /* (old)fstat */
+ .quad sys_pause
+--- linux-2.6/arch/x86/kernel/ptrace_64.c
++++ linux-2.6/arch/x86/kernel/ptrace_64.c
+@@ -721,6 +721,52 @@ const struct utrace_regset_view *utrace_
+ }
+
+
++#ifdef CONFIG_PTRACE
++static const struct ptrace_layout_segment x86_64_uarea[] = {
++ {0, sizeof(struct user_regs_struct), 0, 0},
++ {sizeof(struct user_regs_struct),
++ offsetof(struct user, u_debugreg[0]), -1, 0},
++ {offsetof(struct user, u_debugreg[0]),
++ offsetof(struct user, u_debugreg[8]), 3, 0},
++ {0, 0, -1, 0}
++};
++
++int arch_ptrace(long *req, struct task_struct *child,
++ struct utrace_attached_engine *engine,
++ unsigned long addr, unsigned long data, long *val)
++{
++ switch (*req) {
++ case PTRACE_PEEKUSR:
++ return ptrace_peekusr(child, engine, x86_64_uarea, addr, data);
++ case PTRACE_POKEUSR:
++ return ptrace_pokeusr(child, engine, x86_64_uarea, addr, data);
++ case PTRACE_GETREGS:
++ return ptrace_whole_regset(child, engine, data, 0, 0);
++ case PTRACE_SETREGS:
++ return ptrace_whole_regset(child, engine, data, 0, 1);
++ case PTRACE_GETFPREGS:
++ return ptrace_whole_regset(child, engine, data, 1, 0);
++ case PTRACE_SETFPREGS:
++ return ptrace_whole_regset(child, engine, data, 1, 1);
++#ifdef CONFIG_IA32_EMULATION
++ case PTRACE_GET_THREAD_AREA:
++ case PTRACE_SET_THREAD_AREA:
++ return ptrace_onereg_access(child, engine,
++ &utrace_ia32_view, 3,
++ addr, (void __user *)data, NULL,
++ *req == PTRACE_SET_THREAD_AREA);
++#endif
++ /* normal 64bit interface to access TLS data.
++ Works just like arch_prctl, except that the arguments
++ are reversed. */
++ case PTRACE_ARCH_PRCTL:
++ return do_arch_prctl(child, data, addr);
++ }
++ return -ENOSYS;
++}
++#endif /* CONFIG_PTRACE */
++
++
+ asmlinkage void syscall_trace_enter(struct pt_regs *regs)
+ {
+ /* do the secure computing check first */
+--- linux-2.6/arch/x86/kernel/ptrace_32.c
++++ linux-2.6/arch/x86/kernel/ptrace_32.c
+@@ -746,6 +746,46 @@ const struct utrace_regset_view *utrace_
+ return &utrace_i386_native;
+ }
+
++#ifdef CONFIG_PTRACE
++static const struct ptrace_layout_segment i386_uarea[] = {
++ {0, FRAME_SIZE*4, 0, 0},
++ {FRAME_SIZE*4, offsetof(struct user, u_debugreg[0]), -1, 0},
++ {offsetof(struct user, u_debugreg[0]),
++ offsetof(struct user, u_debugreg[8]), 4, 0},
++ {0, 0, -1, 0}
++};
++
++int arch_ptrace(long *req, struct task_struct *child,
++ struct utrace_attached_engine *engine,
++ unsigned long addr, unsigned long data, long *val)
++{
++ switch (*req) {
++ case PTRACE_PEEKUSR:
++ return ptrace_peekusr(child, engine, i386_uarea, addr, data);
++ case PTRACE_POKEUSR:
++ return ptrace_pokeusr(child, engine, i386_uarea, addr, data);
++ case PTRACE_GETREGS:
++ return ptrace_whole_regset(child, engine, data, 0, 0);
++ case PTRACE_SETREGS:
++ return ptrace_whole_regset(child, engine, data, 0, 1);
++ case PTRACE_GETFPREGS:
++ return ptrace_whole_regset(child, engine, data, 1, 0);
++ case PTRACE_SETFPREGS:
++ return ptrace_whole_regset(child, engine, data, 1, 1);
++ case PTRACE_GETFPXREGS:
++ return ptrace_whole_regset(child, engine, data, 2, 0);
++ case PTRACE_SETFPXREGS:
++ return ptrace_whole_regset(child, engine, data, 2, 1);
++ case PTRACE_GET_THREAD_AREA:
++ case PTRACE_SET_THREAD_AREA:
++ return ptrace_onereg_access(child, engine,
++ utrace_native_view(current), 3,
++ addr, (void __user *)data, NULL,
++ *req == PTRACE_SET_THREAD_AREA);
++ }
++ return -ENOSYS;
++}
++#endif
+ void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code)
+ {
--- linux-2.6/kernel/fork.c
+++ linux-2.6/kernel/fork.c
@@ -49,6 +49,7 @@
@@ -1282,9 +1293,9 @@
#include <linux/random.h>
+#include <linux/ptrace.h>
#include <linux/tty.h>
+ #include <linux/proc_fs.h>
- #include <asm/pgtable.h>
-@@ -1038,6 +1039,7 @@ static struct task_struct *copy_process(
+@@ -1046,6 +1047,7 @@ static struct task_struct *copy_process(
INIT_LIST_HEAD(&p->sibling);
p->vfork_done = NULL;
spin_lock_init(&p->alloc_lock);
@@ -1302,16 +1313,16 @@
#include <linux/profile.h>
#include <linux/mount.h>
#include <linux/proc_fs.h>
-@@ -883,6 +884,8 @@ fastcall NORET_TYPE void do_exit(long co
- tsk->flags |= PF_EXITING;
- spin_unlock_irq(&tsk->pi_lock);
+@@ -900,6 +901,8 @@ fastcall NORET_TYPE void do_exit(long co
+ smp_mb();
+ spin_unlock_wait(&tsk->pi_lock);
+ ptrace_exit(tsk);
+
if (unlikely(in_atomic()))
printk(KERN_INFO "note: %s[%d] exited with preempt_count %d\n",
- current->comm, current->pid,
-@@ -1510,9 +1513,15 @@ check_continued:
+ current->comm, task_pid_nr(current),
+@@ -1533,9 +1536,15 @@ check_continued:
break;
}
}
@@ -1331,13 +1342,14 @@
tsk = next_thread(tsk);
--- linux-2.6/kernel/ptrace.c
+++ linux-2.6/kernel/ptrace.c
-@@ -19,213 +19,2009 @@
+@@ -19,218 +19,2015 @@
#include <linux/security.h>
#include <linux/signal.h>
#include <linux/syscalls.h>
+#include <linux/utrace.h>
+#include <linux/tracehook.h>
#include <linux/audit.h>
+ #include <linux/pid_namespace.h>
+#include <asm/tracehook.h>
#include <asm/pgtable.h>
@@ -1495,11 +1507,12 @@
+ NO_LOCKS;
+
+ return state;
-+}
-+
+ }
+
+-int ptrace_attach(struct task_struct *task)
+static void
+ptrace_state_free(struct rcu_head *rhead)
-+{
+ {
+ struct ptrace_state *state = container_of(rhead,
+ struct ptrace_state, rcu);
+ kfree(state);
@@ -1671,11 +1684,10 @@
+ NO_LOCKS;
+
+ return retval;
- }
-
--int ptrace_attach(struct task_struct *task)
++}
++
+static int ptrace_attach(struct task_struct *task)
- {
++{
+ struct utrace_attached_engine *engine;
+ struct ptrace_state *state;
int retval;
@@ -1688,7 +1700,7 @@
if (task->pid <= 1)
- goto out;
+ goto bad;
- if (task->tgid == current->tgid)
+ if (same_thread_group(task, current))
goto bad;
- retval = may_attach(task);
- if (retval)
@@ -1708,11 +1720,11 @@
+ retval = -EPERM;
goto bad;
+ }
-
-- retval = -ENOSYS;
++
+ pr_debug("%d ptrace_attach %d after utrace_attach: %lu exit_code %x\n",
+ current->pid, task->pid, task->state, task->exit_code);
-+
+
+- retval = -ENOSYS;
+ NO_LOCKS;
+ if (ptrace_may_attach(task)) {
+ state = ptrace_setup(task, engine, current, 0,
@@ -1777,7 +1789,8 @@
+static int ptrace_detach(struct task_struct *task,
+ struct utrace_attached_engine *engine,
+ struct ptrace_state *state)
-+{
+ {
+- if (!valid_signal(data))
+
+ int error;
+
@@ -1965,8 +1978,7 @@
+ const struct utrace_regset_view *view,
+ int setno, unsigned long offset, unsigned int size,
+ void __user *data, int write)
- {
-- if (!valid_signal(data))
++{
+ const struct utrace_regset *regset = utrace_regset(target, engine,
+ view, setno);
+ int ret;
@@ -2002,7 +2014,7 @@
+ struct utrace_attached_engine *engine,
+ const struct utrace_regset_view *view,
+ int setno, unsigned long regno,
-+ void __user *data, int write)
++ void __user *udata, void *kdata, int write)
{
- int copied = 0;
+ const struct utrace_regset *regset = utrace_regset(target, engine,
@@ -2027,18 +2039,20 @@
+ pos = (regno - regset->bias) * regset->size;
+
+ if (write) {
-+ if (!access_ok(VERIFY_READ, data, regset->size))
++ if (kdata == NULL &&
++ !access_ok(VERIFY_READ, udata, regset->size))
+ ret = -EIO;
+ else
+ ret = (*regset->set)(target, regset, pos, regset->size,
-+ NULL, data);
++ kdata, udata);
+ }
+ else {
-+ if (!access_ok(VERIFY_WRITE, data, regset->size))
++ if (kdata == NULL &&
++ !access_ok(VERIFY_WRITE, udata, regset->size))
+ ret = -EIO;
+ else
+ ret = (*regset->get)(target, regset, pos, regset->size,
-+ NULL, data);
++ kdata, udata);
+ }
+
+ return ret;
@@ -2142,7 +2156,7 @@
+
+ ret = -ESRCH;
+ read_lock(&tasklist_lock);
-+ child = find_task_by_pid(pid);
++ child = find_task_by_vpid(pid);
+ if (child)
+ get_task_struct(child);
+ read_unlock(&tasklist_lock);
@@ -2184,14 +2198,6 @@
+ if (child->state == TASK_STOPPED)
+ ret = 0;
+ unlock_task_sighand(child, &flags);
-+ }
-+ if (ret == 0) {
-+ ret = ptrace_update(child, state,
-+ UTRACE_ACTION_QUIESCE, 0);
-+ if (unlikely(ret == -EALREADY))
-+ ret = -ESRCH;
-+ if (unlikely(ret))
-+ BUG_ON(ret != -ESRCH);
}
- if (copy_to_user(dst, buf, retval))
- return -EFAULT;
@@ -2199,6 +2205,14 @@
- src += retval;
- dst += retval;
- len -= retval;
++ if (ret == 0) {
++ ret = ptrace_update(child, state,
++ UTRACE_ACTION_QUIESCE, 0);
++ if (unlikely(ret == -EALREADY))
++ ret = -ESRCH;
++ if (unlikely(ret))
++ BUG_ON(ret != -ESRCH);
++ }
+
+ if (ret) {
+ pr_debug("%d not stopped (%lu)\n",
@@ -2243,22 +2257,17 @@
+ put_task_struct(child);
+out:
+ return ret;
- }
-
--int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long dst, int len)
++}
++
+static inline int is_sysemu(long req)
- {
-- int copied = 0;
++{
+#ifdef PTRACE_SYSEMU
+ if (req == PTRACE_SYSEMU || req == PTRACE_SYSEMU_SINGLESTEP)
+ return 1;
+#endif
+ return 0;
+}
-
-- while (len > 0) {
-- char buf[128];
-- int this_len, retval;
++
+static inline int is_singlestep(long req)
+{
+#ifdef PTRACE_SYSEMU_SINGLESTEP
@@ -2270,23 +2279,22 @@
+ return 1;
+#endif
+ return 0;
-+}
+ }
-- this_len = (len > sizeof(buf)) ? sizeof(buf) : len;
-- if (copy_from_user(buf, src, this_len))
-- return -EFAULT;
-- retval = access_process_vm(tsk, dst, buf, this_len, 1);
-- if (!retval) {
-- if (copied)
+-int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long dst, int len)
+static inline int is_blockstep(long req)
-+{
+ {
+- int copied = 0;
+#ifdef PTRACE_SINGLEBLOCK
+ if (req == PTRACE_SINGLEBLOCK)
+ return 1;
+#endif
+ return 0;
+}
-+
+
+- while (len > 0) {
+- char buf[128];
+- int this_len, retval;
+static int
+ptrace_common(long request, struct task_struct *child,
+ struct utrace_attached_engine *engine,
@@ -2295,7 +2303,13 @@
+{
+ unsigned long flags;
+ int ret = -EIO;
-+
+
+- this_len = (len > sizeof(buf)) ? sizeof(buf) : len;
+- if (copy_from_user(buf, src, this_len))
+- return -EFAULT;
+- retval = access_process_vm(tsk, dst, buf, this_len, 1);
+- if (!retval) {
+- if (copied)
+ NO_LOCKS;
+
+ switch (request) {
@@ -2557,13 +2571,13 @@
+ return ret;
}
+#endif
++
-/**
- * ptrace_traceme -- helper for PTRACE_TRACEME
- *
- * Performs checks and sets PT_PTRACED.
- * Should be used by all ptrace implementations for PTRACE_TRACEME.
-+
+/*
+ * Detach the zombie being reported for wait.
*/
@@ -2573,13 +2587,13 @@
+ struct task_struct *p, struct ptrace_state *state)
{
- int ret = -EPERM;
-+ int detach_error;
-+ struct utrace_attached_engine *engine;
-
+-
- ret = security_ptrace(current->parent, current);
- if (ret)
- return -EPERM;
--
++ int detach_error;
++ struct utrace_attached_engine *engine;
+
- return -ENOSYS;
+restart:
+ NO_LOCKS;
@@ -2649,25 +2663,28 @@
+ __releases(tasklist_lock)
{
- struct task_struct *child;
++ struct pid_namespace *ns;
+ struct ptrace_state *state;
+ struct task_struct *p;
+ int err = -ECHILD;
+ int exit_code, why, status;
+
+ rcu_read_lock();
++ ns = current->nsproxy->pid_ns;
+ list_for_each_entry_rcu(state, &tsk->ptracees, entry) {
+ p = state->task;
+
+ if (pid > 0) {
-+ if (p->pid != pid)
++ if (task_pid_nr_ns(p, ns) != pid)
+ continue;
+ } else if (!pid) {
-+ if (process_group(p) != process_group(current))
++ if (task_pgrp_nr_ns(p, ns) != task_pgrp_vnr(current))
+ continue;
+ } else if (pid != -1) {
-+ if (process_group(p) != -pid)
++ if (task_pgrp_nr_ns(p, ns) != -pid)
+ continue;
+ }
++
+ if (((p->exit_signal != SIGCHLD) ^ ((options & __WCLONE) != 0))
+ && !(options & __WALL))
+ continue;
@@ -2922,7 +2939,7 @@
+ }
read_lock(&tasklist_lock);
-- child = find_task_by_pid(pid);
+- child = find_task_by_vpid(pid);
- if (child)
- get_task_struct(child);
+ if (unlikely(parent->signal == NULL))
@@ -2946,15 +2963,15 @@
- return child;
}
--asmlinkage long sys_ptrace(long request, long pid, long addr, long data)
+-#ifndef arch_ptrace_attach
+-#define arch_ptrace_attach(child) do { } while (0)
+static u32
+ptrace_report(struct utrace_attached_engine *engine,
+ struct task_struct *tsk,
+ struct ptrace_state *state,
+ int code)
+ __releases(RCU)
- {
-- return -ENOSYS;
++{
+ const struct utrace_regset *regset;
+
+ pr_debug("%d ptrace_report %d engine %p"
@@ -3005,26 +3022,19 @@
+ (*regset->writeback)(tsk, regset, 0);
+
+ return UTRACE_ACTION_RESUME;
- }
-
--int generic_ptrace_peekdata(struct task_struct *tsk, long addr, long data)
++}
++
+static inline u32
+ptrace_event(struct utrace_attached_engine *engine,
+ struct task_struct *tsk,
+ struct ptrace_state *state,
+ int event)
+ __releases(RCU)
- {
-- unsigned long tmp;
-- int copied;
++{
+ state->syscall = 0;
+ return ptrace_report(engine, tsk, state, (event << 8) | SIGTRAP);
+}
-
-- copied = access_process_vm(tsk, addr, &tmp, sizeof(tmp), 0);
-- if (copied != sizeof(tmp))
-- return -EIO;
-- return put_user(tmp, (unsigned long __user *)data);
++
+/*
+ * Unlike other report callbacks, this can't be called while ptrace_exit
+ * is doing ptrace_done in parallel, so we don't need get_ptrace_state.
@@ -3180,15 +3190,13 @@
+ NO_LOCKS;
+ printk(KERN_ERR "ptrace out of memory, lost child %d of %d",
+ child->pid, parent->pid);
- }
-
--int generic_ptrace_pokedata(struct task_struct *tsk, long addr, long data)
++}
++
+static u32
+ptrace_report_clone(struct utrace_attached_engine *engine,
+ struct task_struct *parent,
+ unsigned long clone_flags, struct task_struct *child)
- {
-- int copied;
++{
+ int event, option;
+ struct ptrace_state *state;
+
@@ -3219,9 +3227,7 @@
+ }
+ else
+ event = 0;
-
-- copied = access_process_vm(tsk, addr, &data, sizeof(data), 1);
-- return (copied == sizeof(data)) ? 0 : -EIO;
++
+ if (!(clone_flags & CLONE_UNTRACED)
+ && (event || (clone_flags & CLONE_PTRACE))) {
+ /*
@@ -3281,7 +3287,7 @@
+ state->have_eventmsg = 0;
+ state->u.siginfo = info;
+ return ptrace_report(engine, tsk, state, signo) | UTRACE_SIGNAL_IGN;
- }
++}
+
+static u32
+ptrace_report_jctl(struct utrace_attached_engine *engine,
@@ -3352,8 +3358,9 @@
+ *retval = -ENOSYS;
+ }
+ }
-+#endif
-+
+ #endif
+
+-asmlinkage long sys_ptrace(long request, long pid, long addr, long data)
+ state->syscall = 1;
+ return ptrace_report(engine, tsk, state,
+ ((state->options & PTRACE_O_TRACESYSGOOD)
@@ -3363,17 +3370,25 @@
+static u32
+ptrace_report_syscall_entry(struct utrace_attached_engine *engine,
+ struct task_struct *tsk, struct pt_regs *regs)
-+{
+ {
+- return -ENOSYS;
+ return ptrace_report_syscall(engine, tsk, regs, 1);
-+}
-+
+ }
+
+-int generic_ptrace_peekdata(struct task_struct *tsk, long addr, long data)
+static u32
+ptrace_report_syscall_exit(struct utrace_attached_engine *engine,
+ struct task_struct *tsk, struct pt_regs *regs)
-+{
+ {
+- unsigned long tmp;
+- int copied;
+ return ptrace_report_syscall(engine, tsk, regs, 0);
+}
-+
+
+- copied = access_process_vm(tsk, addr, &tmp, sizeof(tmp), 0);
+- if (copied != sizeof(tmp))
+- return -EIO;
+- return put_user(tmp, (unsigned long __user *)data);
+static u32
+ptrace_report_exit(struct utrace_attached_engine *engine,
+ struct task_struct *tsk, long orig_code, long *code)
@@ -3426,18 +3441,22 @@
+ END_CHECK;
+
+ return parent;
-+}
-+
+ }
+
+-int generic_ptrace_pokedata(struct task_struct *tsk, long addr, long data)
+static int
+ptrace_allow_access_process_vm(struct utrace_attached_engine *engine,
+ struct task_struct *target,
+ struct task_struct *caller)
-+{
+ {
+- int copied;
+ struct ptrace_state *state;
+ int ours = 0;
+
+ START_CHECK;
-+
+
+- copied = access_process_vm(tsk, addr, &data, sizeof(data), 1);
+- return (copied == sizeof(data)) ? 0 : -EIO;
+ state = get_ptrace_state(engine, target);
+ if (likely(state != NULL)) {
+ ours = (((engine->flags & UTRACE_ACTION_QUIESCE)
@@ -3452,7 +3471,7 @@
+ END_CHECK;
+
+ return ours;
-+}
+ }
+
+
+static const struct utrace_engine_ops ptrace_utrace_ops =
@@ -3473,7 +3492,7 @@
+};
--- linux-2.6/kernel/sys_ni.c
+++ linux-2.6/kernel/sys_ni.c
-@@ -114,6 +114,10 @@ cond_syscall(sys_vm86);
+@@ -122,6 +122,10 @@ cond_syscall(sys_vm86);
cond_syscall(compat_sys_ipc);
cond_syscall(compat_sys_sysctl);
@@ -3495,9 +3514,9 @@
signal.o sys.o kmod.o workqueue.o pid.o \
rcupdate.o extable.o params.o posix-timers.o \
kthread.o wait.o kfifo.o sys_ni.o posix-cpu-timers.o mutex.o \
-@@ -52,6 +52,7 @@ obj-$(CONFIG_SYSCTL) += utsname_sysctl.o
- obj-$(CONFIG_TASK_DELAY_ACCT) += delayacct.o
+@@ -59,6 +59,7 @@ obj-$(CONFIG_TASK_DELAY_ACCT) += delayac
obj-$(CONFIG_TASKSTATS) += taskstats.o tsacct.o
+ obj-$(CONFIG_MARKERS) += marker.o
obj-$(CONFIG_UTRACE) += utrace.o
+obj-$(CONFIG_PTRACE) += ptrace.o
@@ -3505,7 +3524,7 @@
# According to Alan Modra <alan at linuxcare.com.au>, the -fno-omit-frame-pointer is
--- linux-2.6/include/linux/sched.h
+++ linux-2.6/include/linux/sched.h
-@@ -1179,6 +1179,10 @@ struct task_struct {
+@@ -1157,6 +1157,10 @@ struct task_struct {
atomic_t fs_excl; /* holding fs exclusive resources */
struct rcu_head rcu;
@@ -3625,7 +3644,7 @@
+ struct utrace_attached_engine *engine,
+ const struct utrace_regset_view *view,
+ int setno, unsigned long regno,
-+ void __user *data, int write);
++ void __user *udata, void *kdata, int write);
+
+
+/*
@@ -3752,21 +3771,11 @@
int generic_ptrace_peekdata(struct task_struct *tsk, long addr, long data);
int generic_ptrace_pokedata(struct task_struct *tsk, long addr, long data);
---- linux-2.6/include/asm-x86_64/tracehook.h
-+++ linux-2.6/include/asm-x86_64/tracehook.h
-@@ -15,6 +15,7 @@
-
- #include <linux/sched.h>
- #include <asm/ptrace.h>
-+#include <asm/proto.h>
-
- /*
- * See linux/tracehook.h for the descriptions of what these need to do.
---- linux-2.6/include/asm-x86_64/ptrace-abi.h
-+++ linux-2.6/include/asm-x86_64/ptrace-abi.h
-@@ -48,4 +48,7 @@
-
- #define PTRACE_ARCH_PRCTL 30 /* arch_prctl for child */
+--- linux-2.6/include/asm-x86/ptrace-abi.h
++++ linux-2.6/include/asm-x86/ptrace-abi.h
+@@ -78,4 +78,7 @@
+ # define PTRACE_SYSEMU_SINGLESTEP 32
+ #endif
+#define PTRACE_SYSEMU 31
+#define PTRACE_SYSEMU_SINGLESTEP 32
@@ -3774,7 +3783,7 @@
#endif
--- linux-2.6/init/Kconfig
+++ linux-2.6/init/Kconfig
-@@ -673,10 +673,21 @@ endmenu
+@@ -747,10 +747,21 @@ config PREEMPT_NOTIFIERS
menu "Process debugging support"
linux-2.6-utrace-regset-s390.patch:
Index: linux-2.6-utrace-regset-s390.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/linux-2.6-utrace-regset-s390.patch,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- linux-2.6-utrace-regset-s390.patch 21 Aug 2007 19:42:55 -0000 1.3
+++ linux-2.6-utrace-regset-s390.patch 12 Nov 2007 08:19:34 -0000 1.4
@@ -9,8 +9,8 @@
---
arch/s390/kernel/Makefile | 2
- arch/s390/kernel/ptrace.c | 948 +++++++++++++++++++--------------------------
- 2 files changed, 394 insertions(+), 556 deletions(-)
+ arch/s390/kernel/ptrace.c | 958 +++++++++++++++++++--------------------------
+ 2 files changed, 409 insertions(+), 551 deletions(-)
--- linux-2.6/arch/s390/kernel/Makefile
+++ linux-2.6/arch/s390/kernel/Makefile
@@ -35,7 +35,7 @@
#include <asm/segment.h>
#include <asm/page.h>
-@@ -116,633 +118,467 @@ tracehook_single_step_enabled(struct tas
+@@ -116,628 +118,482 @@ tracehook_single_step_enabled(struct tas
return task->thread.per_info.single_step;
}
@@ -163,13 +163,15 @@
+ unsigned long pswmask = regs->psw.mask;
+ ret = utrace_regset_copyin(&pos, &count, &kbuf, &ubuf,
+ &pswmask, PT_PSWMASK, PT_PSWADDR);
-+ if (pswmask != PSW_MASK_MERGE(psw_user_bits, pswmask)
++ if (ret == 0 &&
+#ifdef CONFIG_COMPAT
-+ && pswmask != PSW_MASK_MERGE(psw_user32_bits, pswmask)
++ pswmask != PSW_MASK_MERGE(psw_user32_bits, pswmask) &&
+#endif
-+ )
++ pswmask != PSW_MASK_MERGE(psw_user_bits, pswmask))
+ /* Invalid psw mask. */
-+ return -EINVAL;
++ ret = -EINVAL;
++ if (ret)
++ return ret;
+ regs->psw.mask = pswmask;
+ FixPerRegisters(target);
+ }
@@ -188,6 +190,8 @@
+ ret = utrace_regset_copyin(&pos, &count, &kbuf, &ubuf,
+ ®s->psw.addr, PT_PSWADDR,
+ PT_ACR0);
++ if (ret)
++ return ret;
+#ifndef CONFIG_64BIT
+ /* I'd like to reject addresses without the
+ high order bit but older gdb's rely on it */
@@ -269,6 +273,14 @@
-#endif
- data != PSW_MASK_MERGE(psw_user_bits, data))
- /* Invalid psw mask. */
+- return -EINVAL;
+-#ifndef CONFIG_64BIT
+- if (addr == (addr_t) &dummy->regs.psw.addr)
+- /* I'd like to reject addresses without the
+- high order bit but older gdb's rely on it */
+- data |= PSW_ADDR_AMODE;
+-#endif
+- *(addr_t *)((addr_t) &task_pt_regs(child)->psw + addr) = data;
+static int
+fpregs_set(struct task_struct *target,
+ const struct utrace_regset *regset,
@@ -281,23 +293,13 @@
+ save_fp_regs(&target->thread.fp_regs);
+
+ /* If setting FPC, must validate it first. */
-+ if (count > 0 && pos == 0) {
-+ unsigned long fpc;
++ if (count > 0 && pos < offsetof(s390_fp_regs, fprs)) {
++ u32 fpc[2] = { target->thread.fp_regs.fpc, 0 };
++ BUILD_BUG_ON(offsetof(s390_fp_regs, fprs) != sizeof(fpc));
+ ret = utrace_regset_copyin(&pos, &count, &kbuf, &ubuf,
+ &fpc, 0, sizeof(fpc));
+ if (ret)
+ return ret;
-+
-+ if ((fpc & ~((unsigned long) FPC_VALID_MASK
-+ << (BITS_PER_LONG - 32))) != 0)
- return -EINVAL;
--#ifndef CONFIG_64BIT
-- if (addr == (addr_t) &dummy->regs.psw.addr)
-- /* I'd like to reject addresses without the
-- high order bit but older gdb's rely on it */
-- data |= PSW_ADDR_AMODE;
--#endif
-- *(addr_t *)((addr_t) &task_pt_regs(child)->psw + addr) = data;
- } else if (addr < (addr_t) (&dummy->regs.orig_gpr2)) {
- /*
@@ -316,17 +318,16 @@
- else
-#endif
- *(addr_t *)((addr_t) &child->thread.acrs + offset) = data;
-+ memcpy(&target->thread.fp_regs, &fpc, sizeof(fpc));
-+ }
++ if ((fpc[0] & ~FPC_VALID_MASK) != 0 || fpc[1] != 0)
++ return -EINVAL;
- } else if (addr == (addr_t) &dummy->regs.orig_gpr2) {
- /*
- * orig_gpr2 is stored on the kernel stack
- */
- task_pt_regs(child)->orig_gpr2 = data;
-+ if (ret == 0)
-+ ret = utrace_regset_copyin(&pos, &count, &kbuf, &ubuf,
-+ &target->thread.fp_regs, 0, -1);
++ target->thread.fp_regs.fpc = fpc[0];
++ }
- } else if (addr < (addr_t) (&dummy->regs.fp_regs + 1)) {
- /*
@@ -338,8 +339,9 @@
- return -EINVAL;
- offset = addr - (addr_t) &dummy->regs.fp_regs;
- *(addr_t *)((addr_t) &child->thread.fp_regs + offset) = data;
-+ if (ret == 0 && target == current)
-+ restore_fp_regs(&target->thread.fp_regs);
++ if (ret == 0 && count > 0)
++ ret = utrace_regset_copyin(&pos, &count, &kbuf, &ubuf,
++ target->thread.fp_regs.fprs, 0, -1);
- } else if (addr < (addr_t) (&dummy->regs.per_info + 1)) {
- /*
@@ -347,7 +349,9 @@
- */
- offset = addr - (addr_t) &dummy->regs.per_info;
- *(addr_t *)((addr_t) &child->thread.per_info + offset) = data;
--
++ if (ret == 0 && target == current)
++ restore_fp_regs(&target->thread.fp_regs);
+
- }
+ return ret;
+}
@@ -526,12 +530,13 @@
+ int ret = 0;
+
+ /* Fake a 31 bit psw mask. */
-+ if (count > 0 && pos == PT_PSWMASK / 2) {
++ if (count > 0 && pos == offsetof(struct user_regs_struct32, psw.mask)) {
+ u32 pswmask = PSW32_MASK_MERGE(psw32_user_bits,
+ (u32) (regs->psw.mask >> 32));
-+ ret = utrace_regset_copyout(&pos, &count, &kbuf, &ubuf,
-+ &pswmask, PT_PSWMASK / 2,
-+ PT_PSWADDR / 2);
++ ret = utrace_regset_copyout(
++ &pos, &count, &kbuf, &ubuf, &pswmask,
++ offsetof(struct user_regs_struct32, psw.mask),
++ offsetof(struct user_regs_struct32, psw.addr));
+ }
- } else if (addr < (addr_t) (&dummy32->regs.fp_regs + 1)) {
@@ -541,11 +546,13 @@
- offset = addr - (addr_t) &dummy32->regs.fp_regs;
- tmp = *(__u32 *)((addr_t) &child->thread.fp_regs + offset);
+ /* Fake a 31 bit psw address. */
-+ if (ret == 0 && count > 0 && pos == PT_PSWADDR / 2) {
++ if (ret == 0 && count > 0 &&
++ pos == offsetof(struct user_regs_struct32, psw.addr)) {
+ u32 pswaddr = (u32) regs->psw.addr | PSW32_ADDR_AMODE31;
-+ ret = utrace_regset_copyout(&pos, &count, &kbuf, &ubuf,
-+ &pswaddr, PT_PSWADDR / 2,
-+ PT_GPR0 / 2);
++ ret = utrace_regset_copyout(
++ &pos, &count, &kbuf, &ubuf, &pswaddr,
++ offsetof(struct user_regs_struct32, psw.addr),
++ offsetof(struct user_regs_struct32, gprs[0]));
+ }
- } else if (addr < (addr_t) (&dummy32->regs.per_info + 1)) {
@@ -561,8 +568,11 @@
- offset == (addr_t) &dummy_per32->lowcore.words.address)
- offset = offset*2 + 4;
+ /* The GPRs are directly on the stack. Just truncate them. */
-+ while (ret == 0 && count > 0 && pos < PT_ACR0 / 2) {
-+ u32 value = regs->gprs[(pos - PT_GPR0 / 2) / sizeof(u32)];
++ while (ret == 0 && count > 0 &&
++ pos < offsetof(struct user_regs_struct32, acrs[0])) {
++ unsigned int n =
++ pos - offsetof(struct user_regs_struct32, gprs[0]);
++ u32 value = regs->gprs[n / sizeof(u32)];
+ if (kbuf) {
+ *(u32 *) kbuf = value;
+ kbuf += sizeof(u32);
@@ -576,30 +586,29 @@
+ pos += sizeof(u32);
+ count -= sizeof(u32);
+ }
-+
+
+- } else
+- tmp = 0;
+ /* The ACRs are kept in the thread_struct. */
-+ if (ret == 0 && count > 0 && pos < PT_ACR0 / 2 + NUM_ACRS * ACR_SIZE) {
++ if (ret == 0 && count > 0 &&
++ pos < offsetof(struct user_regs_struct32, acrs[NUM_ACRS])) {
+ if (target == current)
+ save_access_regs(target->thread.acrs);
-+
-+ ret = utrace_regset_copyout(&pos, &count, &kbuf, &ubuf,
-+ target->thread.acrs,
-+ PT_ACR0 / 2,
-+ PT_ACR0 / 2 + NUM_ACRS * ACR_SIZE);
++ ret = utrace_regset_copyout(
++ &pos, &count, &kbuf, &ubuf, target->thread.acrs,
++ offsetof(struct user_regs_struct32, acrs[0]),
++ offsetof(struct user_regs_struct32, acrs[NUM_ACRS]));
+ }
-- } else
-- tmp = 0;
+- return put_user(tmp, (__u32 __user *) data);
+ /* Finally, the ORIG_GPR2 value. */
+ if (count > 0) {
+ if (kbuf)
+ *(u32 *) kbuf = regs->orig_gpr2;
-+ else if (put_user((u32) regs->orig_gpr2,
-+ (u32 __user *) ubuf))
++ else if (put_user((u32) regs->orig_gpr2, (u32 __user *) ubuf))
+ return -EFAULT;
+ }
-
-- return put_user(tmp, (__u32 __user *) data);
++
+ return 0;
}
@@ -622,18 +631,19 @@
+ int ret = 0;
+
+ /* Check for an invalid PSW mask. */
-+ if (count > 0 && pos == PT_PSWMASK / 2) {
++ if (count > 0 && pos == offsetof(struct user_regs_struct32, psw.mask)) {
+ u32 pswmask;
-+ ret = utrace_regset_copyin(&pos, &count, &kbuf, &ubuf,
-+ &pswmask, PT_PSWMASK / 2,
-+ PT_PSWADDR / 2);
++ ret = utrace_regset_copyin(
++ &pos, &count, &kbuf, &ubuf, &pswmask,
++ offsetof(struct user_regs_struct32, psw.mask),
++ offsetof(struct user_regs_struct32, psw.addr));
+ if (ret)
+ return ret;
- if (!test_thread_flag(TIF_31BIT) ||
- (addr & 3) || addr > sizeof(struct user32) - 3)
- return -EIO;
-+ if (pswmask != PSW_MASK_MERGE(psw_user32_bits, pswmask))
++ if (pswmask != PSW32_MASK_MERGE(psw32_user_bits, pswmask))
+ /* Invalid psw mask. */
+ return -EINVAL;
@@ -650,11 +660,12 @@
- */
- if (addr == (addr_t) &dummy32->regs.psw.mask) {
+ /* Build a 64 bit psw address from 31 bit address. */
-+ if (count > 0 && pos == PT_PSWADDR / 2) {
++ if (count > 0 && pos == offsetof(struct user_regs_struct32, psw.addr)) {
+ u32 pswaddr;
-+ ret = utrace_regset_copyin(&pos, &count, &kbuf, &ubuf,
-+ &pswaddr, PT_PSWADDR / 2,
-+ PT_GPR0 / 2);
++ ret = utrace_regset_copyin(
++ &pos, &count, &kbuf, &ubuf, &pswaddr,
++ offsetof(struct user_regs_struct32, psw.addr),
++ offsetof(struct user_regs_struct32, gprs[0]));
+ if (ret == 0)
/* Build a 64 bit psw mask from 31 bit mask. */
- if (tmp != PSW32_MASK_MERGE(psw32_user_bits, tmp))
@@ -674,7 +685,10 @@
+ }
+
+ /* The GPRs are directly onto the stack. */
-+ while (ret == 0 && count > 0 && pos < PT_ACR0 / 2) {
++ while (ret == 0 && count > 0 &&
++ pos < offsetof(struct user_regs_struct32, acrs[0])) {
++ unsigned int n =
++ pos - offsetof(struct user_regs_struct32, gprs[0]);
+ u32 value;
+
+ if (kbuf) {
@@ -699,7 +713,7 @@
- * orig_gpr2 is stored on the kernel stack
- */
- *(__u32*)((addr_t) &task_pt_regs(child)->orig_gpr2 + 4) = tmp;
-+ regs->gprs[(pos - PT_GPR0 / 2) / sizeof(u32)] = value;
++ regs->gprs[n / sizeof(u32)] = value;
+ }
- } else if (addr < (addr_t) (&dummy32->regs.fp_regs + 1)) {
@@ -713,16 +727,17 @@
- offset = addr - (addr_t) &dummy32->regs.fp_regs;
- *(__u32 *)((addr_t) &child->thread.fp_regs + offset) = tmp;
+ /* The ACRs are kept in the thread_struct. */
-+ if (count > 0 && pos < PT_ORIGGPR2 / 2) {
-+ if (target == current
-+ && (pos != PT_ACR0 / 2
-+ || count < sizeof(target->thread.acrs)))
++ if (count > 0 &&
++ pos < offsetof(struct user_regs_struct32, acrs[NUM_ACRS])) {
++ if (target == current &&
++ (pos != offsetof(struct user_regs_struct32, acrs[0]) ||
++ count < sizeof(target->thread.acrs)))
+ save_access_regs(target->thread.acrs);
+
-+ ret = utrace_regset_copyin(&pos, &count, &kbuf, &ubuf,
-+ target->thread.acrs,
-+ PT_ACR0 / 2,
-+ PT_ACR0 / 2 + NUM_ACRS * ACR_SIZE);
++ ret = utrace_regset_copyin(
++ &pos, &count, &kbuf, &ubuf, target->thread.acrs,
++ offsetof(struct user_regs_struct32, acrs[0]),
++ offsetof(struct user_regs_struct32, acrs[NUM_ACRS]));
- } else if (addr < (addr_t) (&dummy32->regs.per_info + 1)) {
- /*
@@ -955,7 +970,7 @@
- tracehook_disable_single_step(child);
- wake_up_process(child);
- return 0;
--
+
- case PTRACE_KILL:
- /*
- * make the child exit. Best I can do is send it a sigkill.
@@ -983,16 +998,11 @@
- /* give it a chance to run. */
- wake_up_process(child);
- return 0;
--
-- case PTRACE_DETACH:
-- /* detach a process that was attached. */
-- return ptrace_detach(child, data);
-
+static const struct utrace_regset s390_compat_regsets[] = {
+ {
+ .core_note_type = NT_PRSTATUS,
+ .size = sizeof(u32), .align = sizeof(u32),
-+ .n = sizeof(s390_regs) / sizeof(long),
++ .n = offsetof(struct user_regs_struct32, fp_regs) / sizeof(u32),
+ .get = s390_genregs_get, .set = s390_genregs_set
+ },
+ {
linux-2.6-utrace-regset.patch:
View full diff with command:
/usr/bin/cvs -f diff -kk -u -N -r 1.8 -r 1.9 linux-2.6-utrace-regset.patch
Index: linux-2.6-utrace-regset.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/linux-2.6-utrace-regset.patch,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- linux-2.6-utrace-regset.patch 25 Sep 2007 01:28:29 -0000 1.8
+++ linux-2.6-utrace-regset.patch 12 Nov 2007 08:19:34 -0000 1.9
@@ -11,924 +11,831 @@
---
- arch/i386/kernel/i387.c | 143 ++++---
- arch/i386/kernel/ptrace.c | 811 +++++++++++++++++++++++-----------------
- arch/x86_64/ia32/ptrace32.c | 722 +++++++++++++++++++++++-------------
- arch/x86_64/ia32/fpu32.c | 92 ++++-
- arch/x86_64/kernel/ptrace.c | 726 ++++++++++++++++++++++--------------
arch/powerpc/kernel/Makefile | 2
arch/powerpc/kernel/ptrace32.c | 20 -
- arch/powerpc/kernel/ptrace.c | 617 ++++++++++++++++++++----------
+ arch/powerpc/kernel/ptrace.c | 644 ++++++++++++++++++++++----------
+ arch/x86/ia32/ptrace32.c | 722 +++++++++++++++++++++++-------------
+ arch/x86/ia32/fpu32.c | 92 ++++-
+ arch/x86/kernel/ptrace_32.c | 806 +++++++++++++++++++++++-----------------
+ arch/x86/kernel/i387_32.c | 143 ++++---
+ arch/x86/kernel/ptrace_64.c | 721 ++++++++++++++++++++++--------------
kernel/ptrace.c | 9
include/linux/tracehook.h | 255 ++++++++++++-
- include/asm-i386/i387.h | 13 -
- include/asm-x86_64/fpu32.h | 3
- include/asm-x86_64/tracehook.h | 8
- 13 files changed, 2203 insertions(+), 1218 deletions(-)
+ include/asm-x86/fpu32.h | 3
+ include/asm-x86/i387_32.h | 13 -
+ include/asm-x86/tracehook.h | 8
+ 13 files changed, 2230 insertions(+), 1208 deletions(-)
---- linux-2.6/arch/i386/kernel/i387.c
-+++ linux-2.6/arch/i386/kernel/i387.c
-@@ -222,14 +222,10 @@ void set_fpu_twd( struct task_struct *ts
- * FXSR floating point environment conversions.
- */
+--- linux-2.6/arch/powerpc/kernel/Makefile
++++ linux-2.6/arch/powerpc/kernel/Makefile
+@@ -10,6 +10,8 @@ CFLAGS_prom_init.o += -fPIC
+ CFLAGS_btext.o += -fPIC
+ endif
--static int convert_fxsr_to_user( struct _fpstate __user *buf,
-- struct i387_fxsave_struct *fxsave )
-+static inline void
-+convert_fxsr_env_to_i387(unsigned long env[7],
-+ struct i387_fxsave_struct *fxsave)
- {
-- unsigned long env[7];
-- struct _fpreg __user *to;
-- struct _fpxreg *from;
-- int i;
--
- env[0] = (unsigned long)fxsave->cwd | 0xffff0000ul;
- env[1] = (unsigned long)fxsave->swd | 0xffff0000ul;
- env[2] = twd_fxsr_to_i387(fxsave);
-@@ -237,7 +233,17 @@ static int convert_fxsr_to_user( struct
- env[4] = fxsave->fcs | ((unsigned long)fxsave->fop << 16);
- env[5] = fxsave->foo;
- env[6] = fxsave->fos;
-+}
++CFLAGS_ptrace.o += -DUTS_MACHINE='"$(UTS_MACHINE)"'
+
-+static int convert_fxsr_to_user(struct _fpstate __user *buf,
-+ struct i387_fxsave_struct *fxsave)
-+{
-+ unsigned long env[7];
-+ struct _fpreg __user *to;
-+ struct _fpxreg *from;
-+ int i;
+ obj-y := semaphore.o cputable.o ptrace.o syscalls.o \
+ irq.o align.o signal_32.o pmc.o vdso.o \
+ init_task.o process.o systbl.o idle.o \
+--- linux-2.6/arch/powerpc/kernel/ptrace32.c
++++ linux-2.6/arch/powerpc/kernel/ptrace32.c
+@@ -35,10 +35,6 @@
+ #include <asm/system.h>
+ #include <asm/tracehook.h>
-+ convert_fxsr_env_to_i387(env, fxsave);
- if ( __copy_to_user( buf, env, 7 * sizeof(unsigned long) ) )
- return 1;
+-/*
+- * does not yet catch signals sent when the child dies.
+- * in exit.c or in signal.c.
+- */
-@@ -255,6 +261,20 @@ static int convert_fxsr_to_user( struct
- return 0;
- }
+ /*
+ * Here are the old "legacy" powerpc specific getregs/setregs ptrace calls,
+@@ -173,7 +169,7 @@ long compat_sys_ptrace(int request, int
-+static inline void
-+convert_fxsr_env_from_i387(struct i387_fxsave_struct *fxsave,
-+ const unsigned long env[7])
-+{
-+ fxsave->cwd = (unsigned short)(env[0] & 0xffff);
-+ fxsave->swd = (unsigned short)(env[1] & 0xffff);
-+ fxsave->twd = twd_i387_to_fxsr((unsigned short)(env[2] & 0xffff));
-+ fxsave->fip = env[3];
-+ fxsave->fop = (unsigned short)((env[4] & 0xffff0000ul) >> 16);
-+ fxsave->fcs = (env[4] & 0xffff);
-+ fxsave->foo = env[5];
-+ fxsave->fos = env[6];
-+}
-+
- static int convert_fxsr_from_user( struct i387_fxsave_struct *fxsave,
- struct _fpstate __user *buf )
- {
-@@ -266,14 +286,7 @@ static int convert_fxsr_from_user( struc
- if ( __copy_from_user( env, buf, 7 * sizeof(long) ) )
- return 1;
+ CHECK_FULL_REGS(child->thread.regs);
+ if (index < PT_FPR0) {
+- tmp = ptrace_get_reg(child, index);
++ tmp = 0;/*ptrace_get_reg(child, index);*/
+ } else {
+ flush_fp_to_thread(child);
+ /*
+@@ -223,7 +219,7 @@ long compat_sys_ptrace(int request, int
+ flush_fp_to_thread(child);
+ tmp = ((unsigned long int *)child->thread.fpr)[numReg - PT_FPR0];
+ } else { /* register within PT_REGS struct */
+- tmp = ptrace_get_reg(child, numReg);
++/* tmp = ptrace_get_reg(child, numReg);*/
+ }
+ reg32bits = ((u32*)&tmp)[part];
+ ret = put_user(reg32bits, (u32 __user *)data);
+@@ -281,7 +277,7 @@ long compat_sys_ptrace(int request, int
-- fxsave->cwd = (unsigned short)(env[0] & 0xffff);
-- fxsave->swd = (unsigned short)(env[1] & 0xffff);
-- fxsave->twd = twd_i387_to_fxsr((unsigned short)(env[2] & 0xffff));
-- fxsave->fip = env[3];
-- fxsave->fop = (unsigned short)((env[4] & 0xffff0000ul) >> 16);
-- fxsave->fcs = (env[4] & 0xffff);
-- fxsave->foo = env[5];
-- fxsave->fos = env[6];
-+ convert_fxsr_env_from_i387(fxsave, env);
+ CHECK_FULL_REGS(child->thread.regs);
+ if (index < PT_FPR0) {
+- ret = ptrace_put_reg(child, index, data);
++/* ret = ptrace_put_reg(child, index, data);*/
+ } else {
+ flush_fp_to_thread(child);
+ /*
+@@ -319,12 +315,12 @@ long compat_sys_ptrace(int request, int
+ break;
+ CHECK_FULL_REGS(child->thread.regs);
+ if (numReg < PT_FPR0) {
+- unsigned long freg = ptrace_get_reg(child, numReg);
++ unsigned long freg = 0;/*ptrace_get_reg(child, numReg);*/
+ if (index % 2)
+ freg = (freg & ~0xfffffffful) | (data & 0xfffffffful);
+ else
+ freg = (freg & 0xfffffffful) | (data << 32);
+- ret = ptrace_put_reg(child, numReg, freg);
++/* ret = ptrace_put_reg(child, numReg, freg);*/
+ } else {
+ flush_fp_to_thread(child);
+ ((unsigned int *)child->thread.regs)[index] = data;
+@@ -358,8 +354,8 @@ long compat_sys_ptrace(int request, int
+ CHECK_FULL_REGS(child->thread.regs);
+ ret = 0;
+ for (ui = 0; ui < PT_REGS_COUNT; ui ++) {
+- ret |= __put_user(ptrace_get_reg(child, ui),
+- (unsigned int __user *) data);
++/* ret |= __put_user(ptrace_get_reg(child, ui),
++ (unsigned int __user *) data);*/
+ data += sizeof(int);
+ }
+ break;
+@@ -379,7 +375,7 @@ long compat_sys_ptrace(int request, int
+ ret = __get_user(tmp, (unsigned int __user *) data);
+ if (ret)
+ break;
+- ptrace_put_reg(child, ui, tmp);
++/* ptrace_put_reg(child, ui, tmp);*/
+ data += sizeof(int);
+ }
+ break;
+--- linux-2.6/arch/powerpc/kernel/ptrace.c
++++ linux-2.6/arch/powerpc/kernel/ptrace.c
+@@ -27,6 +27,7 @@
+ #include <linux/signal.h>
+ #include <linux/seccomp.h>
+ #include <linux/audit.h>
++#include <linux/elf.h>
+ #ifdef CONFIG_PPC32
+ #include <linux/module.h>
+ #endif
+@@ -38,11 +39,6 @@
[...4875 lines suppressed...]
- }
-
-- case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */
-- case PTRACE_CONT: { /* restart after signal. */
-- ret = -EIO;
-- if (!valid_signal(data))
-- break;
-- if (request == PTRACE_SYSCALL)
-- set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
-- else
-- clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
-- child->exit_code = data;
-- /* make sure the single step bit is not set. */
-- tracehook_disable_single_step(child);
-- wake_up_process(child);
-- ret = 0;
-- break;
-- }
--
--/*
-- * make the child exit. Best I can do is send it a sigkill.
-- * perhaps it should be put in the status that it wants to
-- * exit.
-- */
-- case PTRACE_KILL: {
-- ret = 0;
-- if (child->exit_state == EXIT_ZOMBIE) /* already dead */
-- break;
-- child->exit_code = SIGKILL;
-- /* make sure the single step bit is not set. */
-- tracehook_disable_single_step(child);
-- wake_up_process(child);
-- break;
-- }
--
-- case PTRACE_SINGLESTEP: { /* set the trap flag. */
-- ret = -EIO;
-- if (!valid_signal(data))
-- break;
-- clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
-- tracehook_enable_single_step(child);
-- child->exit_code = data;
-- /* give it a chance to run. */
-- wake_up_process(child);
-- ret = 0;
-- break;
-- }
--
- case PTRACE_GET_DEBUGREG: {
- ret = -EINVAL;
- /* We only support one DABR and no IABRS at the moment */
-@@ -501,7 +702,7 @@ long arch_ptrace(struct task_struct *chi
- }
-
- case PTRACE_SET_DEBUGREG:
-- ret = ptrace_set_debugreg(child, addr, data);
-+/* ret = ptrace_set_debugreg(child, addr, data);*/
- break;
-
- case PTRACE_DETACH:
-@@ -520,8 +721,8 @@ long arch_ptrace(struct task_struct *chi
- }
- ret = 0;
- for (ui = 0; ui < PT_REGS_COUNT; ui ++) {
-- ret |= __put_user(ptrace_get_reg(child, ui),
-- (unsigned long __user *) data);
-+/* ret |= __put_user(ptrace_get_reg(child, ui),
-+ (unsigned long __user *) data);*/
- data += sizeof(long);
- }
- break;
-@@ -543,7 +744,7 @@ long arch_ptrace(struct task_struct *chi
- ret = __get_user(tmp, (unsigned long __user *) data);
- if (ret)
- break;
-- ptrace_put_reg(child, ui, tmp);
-+/* ptrace_put_reg(child, ui, tmp);*/
- data += sizeof(long);
- }
- break;
-@@ -551,13 +752,13 @@ long arch_ptrace(struct task_struct *chi
-
- case PTRACE_GETFPREGS: { /* Get the child FPU state (FPR0...31 + FPSCR) */
- flush_fp_to_thread(child);
-- ret = get_fpregs((void __user *)data, child, 1);
-+/* ret = get_fpregs((void __user *)data, child, 1);*/
- break;
- }
-
- case PTRACE_SETFPREGS: { /* Set the child FPU state (FPR0...31 + FPSCR) */
- flush_fp_to_thread(child);
-- ret = set_fpregs((void __user *)data, child, 1);
-+/* ret = set_fpregs((void __user *)data, child, 1);*/
- break;
- }
-
-@@ -565,13 +766,13 @@ long arch_ptrace(struct task_struct *chi
- case PTRACE_GETVRREGS:
- /* Get the child altivec register state. */
- flush_altivec_to_thread(child);
-- ret = get_vrregs((unsigned long __user *)data, child);
-+/* ret = get_vrregs((unsigned long __user *)data, child);*/
- break;
-
- case PTRACE_SETVRREGS:
- /* Set the child altivec register state. */
- flush_altivec_to_thread(child);
-- ret = set_vrregs(child, (unsigned long __user *)data);
-+/* ret = set_vrregs(child, (unsigned long __user *)data);*/
- break;
- #endif
- #ifdef CONFIG_SPE
-@@ -579,7 +780,7 @@ long arch_ptrace(struct task_struct *chi
- /* Get the child spe register state. */
- if (child->thread.regs->msr & MSR_SPE)
- giveup_spe(child);
-- ret = get_evrregs((unsigned long __user *)data, child);
-+/* ret = get_evrregs((unsigned long __user *)data, child);*/
- break;
-
- case PTRACE_SETEVRREGS:
-@@ -588,7 +789,7 @@ long arch_ptrace(struct task_struct *chi
- * of register state from memory */
- if (child->thread.regs->msr & MSR_SPE)
- giveup_spe(child);
-- ret = set_evrregs(child, (unsigned long __user *)data);
-+/* ret = set_evrregs(child, (unsigned long __user *)data);*/
- break;
- #endif
-
++
+ asmlinkage void syscall_trace_enter(struct pt_regs *regs)
+ {
+ /* do the secure computing check first */
--- linux-2.6/kernel/ptrace.c
+++ linux-2.6/kernel/ptrace.c
-@@ -99,13 +99,6 @@ int ptrace_detach(struct task_struct *ch
+@@ -100,13 +100,6 @@ int ptrace_detach(struct task_struct *ch
if (!valid_signal(data))
return -EIO;
@@ -3841,9 +3856,9 @@
return -ENOSYS;
}
-@@ -213,12 +206,10 @@ struct task_struct *ptrace_get_task_stru
- return child;
- }
+@@ -218,12 +211,10 @@ struct task_struct *ptrace_get_task_stru
+ #define arch_ptrace_attach(child) do { } while (0)
+ #endif
-#ifndef __ARCH_SYS_PTRACE
asmlinkage long sys_ptrace(long request, long pid, long addr, long data)
@@ -4125,8 +4140,18 @@
/*
* Following are entry points from core code, where the user debugging
* support can affect the normal behavior. The locking situation is
---- linux-2.6/include/asm-i386/i387.h
-+++ linux-2.6/include/asm-i386/i387.h
+--- linux-2.6/include/asm-x86/fpu32.h
++++ linux-2.6/include/asm-x86/fpu32.h
+@@ -7,4 +7,7 @@ int restore_i387_ia32(struct task_struct
+ int save_i387_ia32(struct task_struct *tsk, struct _fpstate_ia32 __user *buf,
+ struct pt_regs *regs, int fsave);
+
++int get_fpregs32(struct user_i387_ia32_struct *, struct task_struct *);
++int set_fpregs32(struct task_struct *, const struct user_i387_ia32_struct *);
++
+ #endif
+--- linux-2.6/include/asm-x86/i387_32.h
++++ linux-2.6/include/asm-x86/i387_32.h
@@ -130,17 +130,12 @@ extern int save_i387( struct _fpstate __
extern int restore_i387( struct _fpstate __user *buf );
@@ -4149,21 +4174,11 @@
/*
* FPU state for core dumps...
---- linux-2.6/include/asm-x86_64/fpu32.h
-+++ linux-2.6/include/asm-x86_64/fpu32.h
-@@ -7,4 +7,7 @@ int restore_i387_ia32(struct task_struct
- int save_i387_ia32(struct task_struct *tsk, struct _fpstate_ia32 __user *buf,
- struct pt_regs *regs, int fsave);
+--- linux-2.6/include/asm-x86/tracehook.h
++++ linux-2.6/include/asm-x86/tracehook.h
+@@ -60,4 +60,12 @@ static inline void tracehook_abort_sysca
-+int get_fpregs32(struct user_i387_ia32_struct *, struct task_struct *);
-+int set_fpregs32(struct task_struct *, const struct user_i387_ia32_struct *);
-+
#endif
---- linux-2.6/include/asm-x86_64/tracehook.h
-+++ linux-2.6/include/asm-x86_64/tracehook.h
-@@ -48,4 +48,12 @@ static inline void tracehook_abort_sysca
- regs->orig_rax = -1L;
- }
+/*
+ * These are used directly by some of the regset code.
linux-2.6-utrace-tracehook-avr32.patch:
Index: linux-2.6-utrace-tracehook-avr32.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/linux-2.6-utrace-tracehook-avr32.patch,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- linux-2.6-utrace-tracehook-avr32.patch 20 Jul 2007 19:52:27 -0000 1.2
+++ linux-2.6-utrace-tracehook-avr32.patch 12 Nov 2007 08:19:34 -0000 1.3
@@ -97,7 +97,7 @@
/*
* Read the word at offset "offset" into the task's "struct user". We
* actually access the pt_regs struct stored on the kernel stack.
-@@ -248,32 +199,31 @@ long arch_ptrace(struct task_struct *chi
+@@ -243,32 +194,31 @@ long arch_ptrace(struct task_struct *chi
pr_debug("sys_ptrace returning %d (DC = 0x%08lx)\n", ret, __mfdr(DBGREG_DC));
return ret;
}
@@ -149,7 +149,7 @@
}
asmlinkage void do_debug_priv(struct pt_regs *regs)
-@@ -352,10 +302,10 @@ asmlinkage void do_debug(struct pt_regs
+@@ -347,10 +297,10 @@ asmlinkage void do_debug(struct pt_regs
__mtdr(DBGREG_DC, dc);
clear_thread_flag(TIF_SINGLE_STEP);
@@ -175,7 +175,7 @@
out:
--- linux-2.6/arch/avr32/kernel/entry-avr32b.S
+++ linux-2.6/arch/avr32/kernel/entry-avr32b.S
-@@ -223,15 +223,21 @@ ret_from_fork:
+@@ -230,15 +230,21 @@ ret_from_fork:
rjmp syscall_exit_cont
syscall_trace_enter:
linux-2.6-utrace-tracehook-s390.patch:
Index: linux-2.6-utrace-tracehook-s390.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/linux-2.6-utrace-tracehook-s390.patch,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- linux-2.6-utrace-tracehook-s390.patch 20 Jul 2007 19:52:27 -0000 1.2
+++ linux-2.6-utrace-tracehook-s390.patch 12 Nov 2007 08:19:34 -0000 1.3
@@ -157,7 +157,7 @@
/* give it a chance to run. */
wake_up_process(child);
return 0;
-@@ -731,30 +750,17 @@ syscall_trace(struct pt_regs *regs, int
+@@ -726,30 +745,17 @@ syscall_trace(struct pt_regs *regs, int
if (unlikely(current->audit_context) && entryexit)
audit_syscall_exit(AUDITSC_RESULT(regs->gprs[2]), regs->gprs[2]);
linux-2.6-utrace-tracehook-um.patch:
Index: linux-2.6-utrace-tracehook-um.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/linux-2.6-utrace-tracehook-um.patch,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- linux-2.6-utrace-tracehook-um.patch 31 Jul 2007 18:25:55 -0000 1.3
+++ linux-2.6-utrace-tracehook-um.patch 12 Nov 2007 08:19:34 -0000 1.4
@@ -19,280 +19,30 @@
---
- arch/um/kernel/ptrace.c | 315 ++++-----------------------------------
- arch/um/kernel/skas/syscall.c | 4
- arch/um/kernel/signal.c | 5 -
- arch/um/kernel/exec.c | 1
- arch/um/kernel/process.c | 6 -
- arch/um/sys-i386/signal.c | 4
- include/asm-um/ptrace-x86_64.h | 2
- include/asm-um/ptrace-generic.h | 3
- include/asm-um/ptrace-i386.h | 2
- include/asm-um/tracehook.h | 57 +++++++
- include/asm-um/thread_info.h | 3
- 11 files changed, 106 insertions(+), 296 deletions(-)
+ arch/um/kernel/ptrace.c | 55 ++++++++++++++-------------------------
+ arch/um/kernel/skas/syscall.c | 2 -
+ arch/um/kernel/signal.c | 5 +++-
+ arch/um/kernel/exec.c | 1 -
+ arch/um/kernel/process.c | 2 +
+ arch/um/sys-i386/signal.c | 4 ---
+ include/asm-um/ptrace-x86_64.h | 2 +
+ include/asm-um/ptrace-i386.h | 2 +
+ include/asm-um/tracehook.h | 57 ++++++++++++++++++++++++++++++++++++++++
+ include/asm-um/thread_info.h | 3 ++
+ 10 files changed, 89 insertions(+), 44 deletions(-)
create include/asm-um/tracehook.h
--- linux-2.6/arch/um/kernel/ptrace.c
+++ linux-2.6/arch/um/kernel/ptrace.c
-@@ -3,249 +3,21 @@
- * Licensed under the GPL
- */
-
--#include "linux/sched.h"
--#include "linux/mm.h"
--#include "linux/errno.h"
--#include "linux/smp_lock.h"
--#include "linux/security.h"
--#include "linux/ptrace.h"
--#include "linux/audit.h"
--#ifdef CONFIG_PROC_MM
--#include "linux/proc_mm.h"
--#endif
--#include "asm/ptrace.h"
--#include "asm/uaccess.h"
--#include "kern_util.h"
--#include "skas_ptrace.h"
--#include "sysdep/ptrace.h"
--#include "os.h"
--
--static inline void set_singlestepping(struct task_struct *child, int on)
--{
-- if (on)
-- child->ptrace |= PT_DTRACE;
-- else
-- child->ptrace &= ~PT_DTRACE;
-- child->thread.singlestep_syscall = 0;
--
--#ifdef SUBARCH_SET_SINGLESTEPPING
-- SUBARCH_SET_SINGLESTEPPING(child, on);
--#endif
--}
-+#include <linux/audit.h>
-+#include <linux/elf.h>
-+#include <linux/module.h>
-+#include <linux/ptrace.h>
-+#include <linux/tracehook.h>
-
- /*
- * Called by kernel/ptrace.c when detaching..
- */
- void ptrace_disable(struct task_struct *child)
- {
-- set_singlestepping(child,0);
--}
--
--extern int peek_user(struct task_struct * child, long addr, long data);
--extern int poke_user(struct task_struct * child, long addr, long data);
--
--long arch_ptrace(struct task_struct *child, long request, long addr, long data)
--{
-- int i, ret;
-- unsigned long __user *p = (void __user *)(unsigned long)data;
--
-- switch (request) {
-- /* when I and D space are separate, these will need to be fixed. */
-- case PTRACE_PEEKTEXT: /* read word at location addr. */
-- case PTRACE_PEEKDATA:
-- ret = generic_ptrace_peekdata(child, addr, data);
-- break;
--
-- /* read the word at location addr in the USER area. */
-- case PTRACE_PEEKUSR:
-- ret = peek_user(child, addr, data);
-- break;
--
-- /* when I and D space are separate, this will have to be fixed. */
-- case PTRACE_POKETEXT: /* write the word at location addr. */
-- case PTRACE_POKEDATA:
-- ret = generic_ptrace_pokedata(child, addr, data);
-- break;
--
-- case PTRACE_POKEUSR: /* write the word at location addr in the USER area */
-- ret = poke_user(child, addr, data);
-- break;
--
-- case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */
-- case PTRACE_CONT: { /* restart after signal. */
-- ret = -EIO;
-- if (!valid_signal(data))
-- break;
--
-- set_singlestepping(child, 0);
-- if (request == PTRACE_SYSCALL) {
-- set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
-- }
-- else {
-- clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
-- }
-- child->exit_code = data;
-- wake_up_process(child);
-- ret = 0;
-- break;
-- }
--
--/*
-- * make the child exit. Best I can do is send it a sigkill.
-- * perhaps it should be put in the status that it wants to
-- * exit.
-- */
-- case PTRACE_KILL: {
-- ret = 0;
-- if (child->exit_state == EXIT_ZOMBIE) /* already dead */
-- break;
--
-- set_singlestepping(child, 0);
-- child->exit_code = SIGKILL;
-- wake_up_process(child);
-- break;
-- }
--
-- case PTRACE_SINGLESTEP: { /* set the trap flag. */
-- ret = -EIO;
-- if (!valid_signal(data))
-- break;
-- clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
-- set_singlestepping(child, 1);
-- child->exit_code = data;
-- /* give it a chance to run. */
-- wake_up_process(child);
-- ret = 0;
-- break;
-- }
--
-- case PTRACE_DETACH:
-- /* detach a process that was attached. */
-- ret = ptrace_detach(child, data);
-- break;
--
--#ifdef PTRACE_GETREGS
-- case PTRACE_GETREGS: { /* Get all gp regs from the child. */
-- if (!access_ok(VERIFY_WRITE, p, MAX_REG_OFFSET)) {
-- ret = -EIO;
-- break;
-- }
-- for ( i = 0; i < MAX_REG_OFFSET; i += sizeof(long) ) {
-- __put_user(getreg(child, i), p);
-- p++;
-- }
-- ret = 0;
-- break;
-- }
--#endif
--#ifdef PTRACE_SETREGS
-- case PTRACE_SETREGS: { /* Set all gp regs in the child. */
-- unsigned long tmp = 0;
-- if (!access_ok(VERIFY_READ, p, MAX_REG_OFFSET)) {
-- ret = -EIO;
-- break;
-- }
-- for ( i = 0; i < MAX_REG_OFFSET; i += sizeof(long) ) {
-- __get_user(tmp, p);
-- putreg(child, i, tmp);
-- p++;
-- }
-- ret = 0;
-- break;
-- }
--#endif
--#ifdef PTRACE_GETFPREGS
-- case PTRACE_GETFPREGS: /* Get the child FPU state. */
-- ret = get_fpregs(data, child);
-- break;
--#endif
--#ifdef PTRACE_SETFPREGS
-- case PTRACE_SETFPREGS: /* Set the child FPU state. */
-- ret = set_fpregs(data, child);
-- break;
--#endif
--#ifdef PTRACE_GETFPXREGS
-- case PTRACE_GETFPXREGS: /* Get the child FPU state. */
-- ret = get_fpxregs(data, child);
-- break;
--#endif
--#ifdef PTRACE_SETFPXREGS
-- case PTRACE_SETFPXREGS: /* Set the child FPU state. */
-- ret = set_fpxregs(data, child);
-- break;
--#endif
-- case PTRACE_GET_THREAD_AREA:
-- ret = ptrace_get_thread_area(child, addr,
-- (struct user_desc __user *) data);
-- break;
--
-- case PTRACE_SET_THREAD_AREA:
-- ret = ptrace_set_thread_area(child, addr,
-- (struct user_desc __user *) data);
-- break;
--
-- case PTRACE_FAULTINFO: {
-- /* Take the info from thread->arch->faultinfo,
-- * but transfer max. sizeof(struct ptrace_faultinfo).
-- * On i386, ptrace_faultinfo is smaller!
-- */
-- ret = copy_to_user(p, &child->thread.arch.faultinfo,
-- sizeof(struct ptrace_faultinfo));
-- if(ret)
-- break;
-- break;
-- }
--
--#ifdef PTRACE_LDT
-- case PTRACE_LDT: {
-- struct ptrace_ldt ldt;
--
-- if(copy_from_user(&ldt, p, sizeof(ldt))){
-- ret = -EIO;
-- break;
-- }
--
-- /* This one is confusing, so just punt and return -EIO for
-- * now
-- */
-- ret = -EIO;
-- break;
-- }
--#endif
--#ifdef CONFIG_PROC_MM
-- case PTRACE_SWITCH_MM: {
-- struct mm_struct *old = child->mm;
-- struct mm_struct *new = proc_mm_get_mm(data);
--
-- if(IS_ERR(new)){
-- ret = PTR_ERR(new);
-- break;
-- }
--
-- atomic_inc(&new->mm_users);
-- child->mm = new;
-- child->active_mm = new;
-- mmput(old);
-- ret = 0;
-- break;
-- }
--#endif
--#ifdef PTRACE_ARCH_PRCTL
-- case PTRACE_ARCH_PRCTL:
-- /* XXX Calls ptrace on the host - needs some SMP thinking */
-- ret = arch_prctl_skas(child, data, (void *) addr);
-- break;
--#endif
-- default:
-- ret = ptrace_request(child, request, addr, data);
-- break;
-- }
--
-- return ret;
- }
+@@ -5,6 +5,7 @@
--void send_sigtrap(struct task_struct *tsk, union uml_pt_regs *regs,
-- int error_code)
-+static void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs,
-+ int error_code)
- {
- struct siginfo info;
-
-@@ -254,56 +26,39 @@ void send_sigtrap(struct task_struct *ts
+ #include "linux/audit.h"
+ #include "linux/ptrace.h"
++#include "linux/tracehook.h"
+ #include "linux/sched.h"
+ #include "asm/uaccess.h"
+ #ifdef CONFIG_PROC_MM
+@@ -235,20 +236,18 @@ void send_sigtrap(struct task_struct *ts
info.si_code = TRAP_BRKPT;
/* User-mode eip? */
@@ -300,33 +50,28 @@
+ info.si_addr = UPT_IS_USER(®s->regs) ?
+ (void __user *) UPT_IP(®s->regs) : NULL;
- /* Send us the fakey SIGTRAP */
+ /* Send us the fake SIGTRAP */
force_sig_info(SIGTRAP, &info, tsk);
}
--/* XXX Check PT_DTRACE vs TIF_SINGLESTEP for singlestepping check and
+-/*
+- * XXX Check PT_DTRACE vs TIF_SINGLESTEP for singlestepping check and
- * PT_PTRACED vs TIF_SYSCALL_TRACE for syscall tracing check
-+/* notification of system call entry/exit
-+ * - triggered by current->work.syscall_trace
- */
--void syscall_trace(union uml_pt_regs *regs, int entryexit)
-+void do_syscall_trace(struct pt_regs *regs, int entryexit)
+- */
+ void syscall_trace(struct uml_pt_regs *regs, int entryexit)
{
- int is_singlestep = (current->ptrace & PT_DTRACE) && entryexit;
- int tracesysgood;
--
-- if (unlikely(current->audit_context)) {
-- if (!entryexit)
-- audit_syscall_entry(HOST_AUDIT_ARCH,
-- UPT_SYSCALL_NR(regs),
-- UPT_SYSCALL_ARG1(regs),
-- UPT_SYSCALL_ARG2(regs),
-- UPT_SYSCALL_ARG3(regs),
-- UPT_SYSCALL_ARG4(regs));
-- else audit_syscall_exit(AUDITSC_RESULT(UPT_SYSCALL_RET(regs)),
-- UPT_SYSCALL_RET(regs));
-- }
--
++ /* do the secure computing check first */
++ if (!entryexit)
++ secure_computing(PT_REGS_SYSCALL_NR(regs));
+
+ if (unlikely(current->audit_context)) {
+ if (!entryexit)
+@@ -262,33 +261,19 @@ void syscall_trace(struct uml_pt_regs *r
+ UPT_SYSCALL_RET(regs));
+ }
+
- /* Fake a debug trap */
- if (is_singlestep)
- send_sigtrap(current, regs, 0);
@@ -337,37 +82,31 @@
- if (!(current->ptrace & PT_PTRACED))
- return;
-
-- /* the 0x80 provides a way for the tracing parent to distinguish
-- between a syscall stop and SIGTRAP delivery */
+- /*
+- * the 0x80 provides a way for the tracing parent to distinguish
+- * between a syscall stop and SIGTRAP delivery
+- */
- tracesysgood = (current->ptrace & PT_TRACESYSGOOD);
- ptrace_notify(SIGTRAP | (tracesysgood ? 0x80 : 0));
-
- if (entryexit) /* force do_signal() --> is_syscall() */
- set_thread_flag(TIF_SIGPENDING);
-
-- /* this isn't the same as continuing with a signal, but it will do
+- /*
+- * this isn't the same as continuing with a signal, but it will do
- * for normal use. strace only continues with a signal if the
- * stopping signal is not SIGTRAP. -brl
- */
- if (current->exit_code) {
- send_sig(current->exit_code, current, 1);
- current->exit_code = 0;
-- }
-+ /* do the secure computing check first */
-+ if (!entryexit)
-+ secure_computing(PT_REGS_SYSCALL_NR(regs));
-+
-+ if (unlikely(current->audit_context) && entryexit)
-+ audit_syscall_exit(AUDITSC_RESULT(UPT_SYSCALL_RET(®s->regs)),
-+ UPT_SYSCALL_RET(®s->regs));
-+
+ if (test_thread_flag(TIF_SYSCALL_TRACE))
+ tracehook_report_syscall(regs, entryexit);
+
+ if (test_thread_flag(TIF_SINGLESTEP) && entryexit) {
+ send_sigtrap(current, regs, 0); /* XXX */
+ tracehook_report_syscall_step(regs);
-+ }
+ }
+
+ if (unlikely(current->audit_context) && !entryexit)
+ audit_syscall_entry(HOST_AUDIT_ARCH,
@@ -379,7 +118,7 @@
}
--- linux-2.6/arch/um/kernel/skas/syscall.c
+++ linux-2.6/arch/um/kernel/skas/syscall.c
-@@ -19,8 +19,6 @@ void handle_syscall(union uml_pt_regs *r
+@@ -15,8 +15,6 @@ void handle_syscall(struct uml_pt_regs *
long result;
int syscall;
@@ -388,24 +127,17 @@
current->thread.nsyscalls++;
nsyscalls++;
-@@ -38,6 +36,4 @@ void handle_syscall(union uml_pt_regs *r
- else result = EXECUTE_SYSCALL(syscall, regs);
-
- REGS_SET_SYSCALL_RETURN(r->skas.regs, result);
--
-- syscall_trace(r, 1);
- }
--- linux-2.6/arch/um/kernel/signal.c
+++ linux-2.6/arch/um/kernel/signal.c
-@@ -14,6 +14,7 @@
- #include "linux/tty.h"
- #include "linux/binfmts.h"
+@@ -5,6 +5,7 @@
+
+ #include "linux/module.h"
#include "linux/ptrace.h"
+#include "linux/tracehook.h"
+ #include "linux/sched.h"
+ #include "asm/siginfo.h"
#include "asm/signal.h"
- #include "asm/uaccess.h"
- #include "asm/unistd.h"
-@@ -92,6 +93,8 @@ static int handle_signal(struct pt_regs
+@@ -80,6 +81,8 @@ static int handle_signal(struct pt_regs
sigaddset(¤t->blocked, signr);
recalc_sigpending();
spin_unlock_irq(¤t->sighand->siglock);
@@ -414,45 +146,39 @@
}
return err;
-@@ -147,7 +150,7 @@ static int kern_do_signal(struct pt_regs
+@@ -138,7 +141,7 @@ static int kern_do_signal(struct pt_regs
* on the host. The tracing thread will check this flag and
* PTRACE_SYSCALL if necessary.
*/
-- if(current->ptrace & PT_DTRACE)
-+ if(test_thread_flag(TIF_SYSCALL_TRACE))
+- if (current->ptrace & PT_DTRACE)
++ if (test_thread_flag(TIF_SYSCALL_TRACE))
current->thread.singlestep_syscall =
is_syscall(PT_REGS_IP(¤t->thread.regs));
--- linux-2.6/arch/um/kernel/exec.c
+++ linux-2.6/arch/um/kernel/exec.c
-@@ -52,7 +52,6 @@ static long execve1(char *file, char __u
- error = do_execve(file, argv, env, ¤t->thread.regs);
- if (error == 0){
+@@ -61,7 +61,6 @@ static long execve1(char *file, char __u
+ error = do_execve(file, argv, env, ¤t->thread.regs);
+ if (error == 0) {
task_lock(current);
-- current->ptrace &= ~PT_DTRACE;
+- current->ptrace &= ~PT_DTRACE;
#ifdef SUBARCH_EXECVE1
SUBARCH_EXECVE1(¤t->thread.regs.regs);
#endif
--- linux-2.6/arch/um/kernel/process.c
+++ linux-2.6/arch/um/kernel/process.c
-@@ -387,11 +387,11 @@ int singlestepping(void * t)
+@@ -435,7 +435,7 @@ int singlestepping(void * t)
{
struct task_struct *task = t ? t : current;
- if ( ! (task->ptrace & PT_DTRACE) )
-- return(0);
+ if (!test_thread_flag(TIF_SINGLESTEP))
-+ return 0;
+ return 0;
if (task->thread.singlestep_syscall)
-- return(1);
-+ return 1;
-
- return 2;
- }
--- linux-2.6/arch/um/sys-i386/signal.c
+++ linux-2.6/arch/um/sys-i386/signal.c
-@@ -274,8 +274,6 @@ int setup_signal_stack_sc(unsigned long
+@@ -378,8 +378,6 @@ int setup_signal_stack_sc(unsigned long
PT_REGS_EDX(regs) = (unsigned long) 0;
PT_REGS_ECX(regs) = (unsigned long) 0;
@@ -461,7 +187,7 @@
return 0;
err:
-@@ -331,8 +329,6 @@ int setup_signal_stack_si(unsigned long
+@@ -435,8 +433,6 @@ int setup_signal_stack_si(unsigned long
PT_REGS_EDX(regs) = (unsigned long) &frame->info;
PT_REGS_ECX(regs) = (unsigned long) &frame->uc;
@@ -481,18 +207,6 @@
#define HOST_AUDIT_ARCH AUDIT_ARCH_X86_64
/* Also defined in sysdep/ptrace.h, so may already be defined. */
---- linux-2.6/include/asm-um/ptrace-generic.h
-+++ linux-2.6/include/asm-um/ptrace-generic.h
-@@ -44,9 +44,6 @@ extern int set_fpxregs(unsigned long buf
-
- extern void show_regs(struct pt_regs *regs);
-
--extern void send_sigtrap(struct task_struct *tsk, union uml_pt_regs *regs,
-- int error_code);
--
- extern int arch_copy_tls(struct task_struct *new);
- extern void clear_flushed_tls(struct task_struct *task);
-
--- linux-2.6/include/asm-um/ptrace-i386.h
+++ linux-2.6/include/asm-um/ptrace-i386.h
@@ -6,6 +6,8 @@
linux-2.6-utrace-tracehook.patch:
View full diff with command:
/usr/bin/cvs -f diff -kk -u -N -r 1.15 -r 1.16 linux-2.6-utrace-tracehook.patch
Index: linux-2.6-utrace-tracehook.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/linux-2.6-utrace-tracehook.patch,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- linux-2.6-utrace-tracehook.patch 17 Oct 2007 23:00:27 -0000 1.15
+++ linux-2.6-utrace-tracehook.patch 12 Nov 2007 08:19:34 -0000 1.16
@@ -36,7 +36,7 @@
fs/binfmt_flat.c | 3
fs/binfmt_som.c | 2
fs/proc/base.c | 17 +
- fs/proc/array.c | 12 +
+ fs/proc/array.c | 8 -
fs/binfmt_elf_fdpic.c | 7 -
fs/exec.c | 11 -
fs/binfmt_elf.c | 6 -
@@ -46,23 +46,6 @@
arch/s390/kernel/compat_linux.c | 3
arch/s390/kernel/process.c | 3
arch/frv/kernel/ptrace.c | 15 -
- arch/i386/math-emu/fpu_entry.c | 6 -
- arch/i386/kernel/ptrace.c | 103 ++-------
- arch/i386/kernel/signal.c | 37 +--
- arch/i386/kernel/process.c | 3
- arch/i386/kernel/vm86.c | 7 -
- arch/i386/kernel/entry.S | 7 -
- arch/x86_64/ia32/sys_ia32.c | 5
- arch/x86_64/ia32/ptrace32.c | 2
- arch/x86_64/ia32/ia32_aout.c | 6 -
- arch/x86_64/ia32/ia32_signal.c | 7 -
- arch/x86_64/ia32/ia32entry.S | 4
- arch/x86_64/kernel/traps.c | 8 -
- arch/x86_64/kernel/ptrace.c | 57 ++---
- arch/x86_64/kernel/signal.c | 28 +-
- arch/x86_64/kernel/process.c | 5
- arch/x86_64/kernel/entry.S | 8 -
- arch/x86_64/mm/fault.c | 2
arch/arm/kernel/ptrace.c | 17 -
arch/mips/kernel/sysirix.c | 2
arch/mips/kernel/ptrace.c | 23 --
@@ -72,6 +55,23 @@
arch/powerpc/kernel/signal.c | 3
arch/powerpc/kernel/asm-offsets.c | 2
arch/powerpc/kernel/process.c | 5
+ arch/x86/math-emu/fpu_entry.c | 6 -
+ arch/x86/ia32/sys_ia32.c | 5
+ arch/x86/ia32/ptrace32.c | 2
+ arch/x86/ia32/ia32_aout.c | 6 -
+ arch/x86/ia32/ia32_signal.c | 7 -
+ arch/x86/ia32/ia32entry.S | 4
+ arch/x86/kernel/vm86_32.c | 7 -
+ arch/x86/kernel/process_64.c | 5
+ arch/x86/kernel/process_32.c | 3
+ arch/x86/kernel/entry_32.S | 7 -
+ arch/x86/kernel/signal_64.c | 28 +-
+ arch/x86/kernel/entry_64.S | 8 -
+ arch/x86/kernel/ptrace_32.c | 103 ++-------
+ arch/x86/kernel/traps_64.c | 8 -
+ arch/x86/kernel/ptrace_64.c | 57 ++---
+ arch/x86/kernel/signal_32.c | 37 +--
+ arch/x86/mm/fault_64.c | 2
arch/alpha/kernel/asm-offsets.c | 2
arch/alpha/kernel/entry.S | 4
arch/sparc64/kernel/binfmt_aout32.c | 2
@@ -81,34 +81,32 @@
arch/ia64/kernel/mca.c | 2
arch/ia64/kernel/asm-offsets.c | 2
arch/ia64/kernel/fsys.S | 16 +
- kernel/exit.c | 250 ++++++---------------
- kernel/ptrace.c | 298 +------------------------
- kernel/timer.c | 6 -
+ kernel/exit.c | 240 ++++++--------------
+ kernel/ptrace.c | 307 +-------------------------
+ kernel/timer.c | 4
kernel/signal.c | 210 ++++--------------
kernel/tsacct.c | 2
kernel/sys.c | 2
- kernel/fork.c | 66 ++----
+ kernel/fork.c | 67 ++----
include/linux/ptrace.h | 18 --
- include/linux/sched.h | 16 -
+ include/linux/sched.h | 18 --
include/linux/init_task.h | 3
include/linux/tracehook.h | 414 +++++++++++++++++++++++++++++++++++
- include/asm-i386/tracehook.h | 52 ++++
- include/asm-i386/thread_info.h | 7 -
- include/asm-i386/signal.h | 4
include/asm-powerpc/tracehook.h | 49 ++++
- include/asm-x86_64/tracehook.h | 51 ++++
- include/asm-x86_64/thread_info.h | 3
+ include/asm-x86/thread_info_32.h | 7 -
+ include/asm-x86/thread_info_64.h | 3
+ include/asm-x86/tracehook.h | 63 +++++
+ include/asm-x86/signal.h | 4
drivers/connector/cn_proc.c | 4
mm/nommu.c | 4
- 67 files changed, 904 insertions(+), 1139 deletions(-)
+ 66 files changed, 857 insertions(+), 1142 deletions(-)
create include/linux/tracehook.h
- create include/asm-i386/tracehook.h
create include/asm-powerpc/tracehook.h
- create include/asm-x86_64/tracehook.h
+ create include/asm-x86/tracehook.h
--- linux-2.6/fs/binfmt_flat.c
+++ linux-2.6/fs/binfmt_flat.c
-@@ -918,9 +918,6 @@ static int load_flat_binary(struct linux
+@@ -920,9 +920,6 @@ static int load_flat_binary(struct linux
start_thread(regs, start_addr, current->mm->start_stack);
@@ -131,15 +129,15 @@
/* error cleanup */
--- linux-2.6/fs/proc/base.c
+++ linux-2.6/fs/proc/base.c
-@@ -67,6 +67,7 @@
+@@ -68,6 +68,7 @@
#include <linux/mount.h>
#include <linux/security.h>
#include <linux/ptrace.h>
+#include <linux/tracehook.h>
+ #include <linux/cgroup.h>
#include <linux/cpuset.h>
#include <linux/audit.h>
- #include <linux/poll.h>
-@@ -192,13 +193,6 @@ static int proc_root_link(struct inode *
+@@ -195,13 +196,6 @@ static int proc_root_link(struct inode *
return result;
}
@@ -150,10 +148,10 @@
- (task->state == TASK_STOPPED || task->state == TASK_TRACED) && \
- security_ptrace(current,task) == 0))
-
- static int proc_pid_environ(struct task_struct *task, char * buffer)
+ static int proc_pid_cmdline(struct task_struct *task, char * buffer)
{
int res = 0;
-@@ -528,7 +522,8 @@ static ssize_t mem_read(struct file * fi
+@@ -589,7 +583,8 @@ static ssize_t mem_read(struct file * fi
if (!task)
goto out_no_task;
@@ -163,7 +161,7 @@
goto out;
ret = -ENOMEM;
-@@ -554,7 +549,8 @@ static ssize_t mem_read(struct file * fi
+@@ -615,7 +610,8 @@ static ssize_t mem_read(struct file * fi
this_len = (count > PAGE_SIZE) ? PAGE_SIZE : count;
retval = access_process_vm(task, src, page, this_len, 0);
@@ -173,7 +171,7 @@
if (!ret)
ret = -EIO;
break;
-@@ -598,7 +594,8 @@ static ssize_t mem_write(struct file * f
+@@ -659,7 +655,8 @@ static ssize_t mem_write(struct file * f
if (!task)
goto out_no_task;
@@ -192,44 +190,28 @@
+#include <linux/tracehook.h>
#include <linux/rcupdate.h>
#include <linux/delayacct.h>
-
-@@ -158,11 +159,16 @@ static inline const char *get_task_state
+ #include <linux/pid_namespace.h>
+@@ -158,6 +159,7 @@ static inline const char *get_task_state
static inline char *task_state(struct task_struct *p, char *buffer)
{
+ struct task_struct *tracer;
-+ pid_t tracer_pid;
struct group_info *group_info;
int g;
struct fdtable *fdt = NULL;
-
+@@ -167,9 +169,9 @@ static inline char *task_state(struct ta
+ ns = current->nsproxy->pid_ns;
rcu_read_lock();
+ ppid = pid_alive(p) ?
+- task_tgid_nr_ns(rcu_dereference(p->real_parent), ns) : 0;
+- tpid = pid_alive(p) && p->ptrace ?
+- task_ppid_nr_ns(rcu_dereference(p->parent), ns) : 0;
++ task_tgid_nr_ns(rcu_dereference(p->parent), ns) : 0;
+ tracer = tracehook_tracer_task(p);
-+ tracer_pid = tracer == NULL ? 0 : tracer->pid;
-+
++ tpid = tracer == NULL ? 0 : tracer->pid;
buffer += sprintf(buffer,
"State:\t%s\n"
"Tgid:\t%d\n"
-@@ -173,8 +179,8 @@ static inline char *task_state(struct ta
- "Gid:\t%d\t%d\t%d\t%d\n",
- get_task_state(p),
- p->tgid, p->pid,
-- pid_alive(p) ? rcu_dereference(p->real_parent)->tgid : 0,
-- pid_alive(p) && p->ptrace ? rcu_dereference(p->parent)->pid : 0,
[...2635 lines suppressed...]
+#define ARCH_HAS_SINGLE_STEP (1)
+
-+/* These two are defined in arch/i386/kernel/ptrace.c. */
-+void tracehook_enable_single_step(struct task_struct *tsk);
-+void tracehook_disable_single_step(struct task_struct *tsk);
++void tracehook_enable_single_step(struct task_struct *task);
++void tracehook_disable_single_step(struct task_struct *task);
+
+static inline int tracehook_single_step_enabled(struct task_struct *tsk)
+{
@@ -3630,11 +3607,9 @@
+ clear_tsk_thread_flag(tsk, TIF_SYSCALL_TRACE);
+}
+
-+#define tracehook_syscall_callno(regs) (&(regs)->orig_eax)
-+#define tracehook_syscall_retval(regs) (&(regs)->eax)
+static inline void tracehook_abort_syscall(struct pt_regs *regs)
+{
-+ regs->orig_eax = -1;
++ regs->gpr[0] = -1L;
+}
+
+
@@ -3678,77 +3653,30 @@
/* work to do on any return to u-space */
#define _TIF_ALLWORK_MASK (0x0000FFFF & ~_TIF_SECCOMP)
---- linux-2.6/include/asm-x86/signal_32.h
-+++ linux-2.6/include/asm-x86/signal_32.h
-@@ -221,10 +221,8 @@ struct pt_regs;
-
- #define ptrace_signal_deliver(regs, cookie) \
- do { \
-- if (current->ptrace & PT_DTRACE) { \
-- current->ptrace &= ~PT_DTRACE; \
-+ if (test_and_clear_thread_flag(TIF_FORCED_TF)) \
- (regs)->eflags &= ~TF_MASK; \
-- } \
- } while (0)
-
- #endif /* __KERNEL__ */
---- linux-2.6/include/asm-powerpc/tracehook.h
-+++ linux-2.6/include/asm-powerpc/tracehook.h
-@@ -0,0 +1,49 @@
-+/*
-+ * Tracing hooks, PowerPC CPU support
-+ *
-+ * Copyright (C) 2006, 2007 Red Hat, Inc. All rights reserved.
-+ *
-+ * This copyrighted material is made available to anyone wishing to use,
-+ * modify, copy, or redistribute it subject to the terms and conditions
-+ * of the GNU General Public License v.2.
-+ *
-+ * Red Hat Author: Roland McGrath.
-+ */
-+
-+#ifndef _ASM_TRACEHOOK_H
-+#define _ASM_TRACEHOOK_H 1
-+
-+#include <linux/sched.h>
-+#include <asm/ptrace.h>
-+
-+/*
-+ * See linux/tracehook.h for the descriptions of what these need to do.
-+ */
-+
-+#define ARCH_HAS_SINGLE_STEP (1)
-+
-+void tracehook_enable_single_step(struct task_struct *task);
-+void tracehook_disable_single_step(struct task_struct *task);
-+
-+static inline int tracehook_single_step_enabled(struct task_struct *tsk)
-+{
-+ return test_tsk_thread_flag(tsk, TIF_SINGLESTEP);
-+}
-+
-+static inline void tracehook_enable_syscall_trace(struct task_struct *tsk)
-+{
-+ set_tsk_thread_flag(tsk, TIF_SYSCALL_TRACE);
-+}
-+
-+static inline void tracehook_disable_syscall_trace(struct task_struct *tsk)
-+{
-+ clear_tsk_thread_flag(tsk, TIF_SYSCALL_TRACE);
-+}
-+
-+static inline void tracehook_abort_syscall(struct pt_regs *regs)
-+{
-+ regs->gpr[0] = -1L;
-+}
-+
-+
-+#endif
+--- linux-2.6/include/asm-x86/thread_info_64.h
++++ linux-2.6/include/asm-x86/thread_info_64.h
+@@ -115,7 +115,7 @@ static inline struct thread_info *stack_
+ #define TIF_SECCOMP 8 /* secure computing */
+ #define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal */
+ #define TIF_MCE_NOTIFY 10 /* notify userspace of an MCE */
+-/* 16 free */
++#define TIF_FORCED_TF 16 /* true if TF in eflags artificially */
+ #define TIF_IA32 17 /* 32bit process */
+ #define TIF_FORK 18 /* ret_from_fork */
+ #define TIF_ABI_PENDING 19
+@@ -133,6 +133,7 @@ static inline struct thread_info *stack_
+ #define _TIF_SECCOMP (1<<TIF_SECCOMP)
+ #define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
+ #define _TIF_MCE_NOTIFY (1<<TIF_MCE_NOTIFY)
++#define _TIF_FORCED_TF (1<<TIF_FORCED_TF)
+ #define _TIF_IA32 (1<<TIF_IA32)
+ #define _TIF_FORK (1<<TIF_FORK)
+ #define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING)
--- linux-2.6/include/asm-x86/tracehook.h
+++ linux-2.6/include/asm-x86/tracehook.h
-@@ -0,0 +1,51 @@
+@@ -0,0 +1,63 @@
+/*
-+ * Tracing hooks, x86-64 CPU support
++ * Tracing hooks, x86 CPU support
+ *
+ * Copyright (C) 2006, 2007 Red Hat, Inc. All rights reserved.
+ *
@@ -3790,33 +3718,40 @@
+ clear_tsk_thread_flag(tsk, TIF_SYSCALL_TRACE);
+}
+
++#ifdef CONFIG_X86_64
++
+#define tracehook_syscall_callno(regs) (&(regs)->orig_rax)
+#define tracehook_syscall_retval(regs) (&(regs)->rax)
+static inline void tracehook_abort_syscall(struct pt_regs *regs)
+{
+ regs->orig_rax = -1L;
+}
++#else
++
++#define tracehook_syscall_callno(regs) (&(regs)->orig_eax)
++#define tracehook_syscall_retval(regs) (&(regs)->eax)
++static inline void tracehook_abort_syscall(struct pt_regs *regs)
++{
++ regs->orig_eax = -1;
++}
+
+#endif
---- linux-2.6/include/asm-x86/thread_info_64.h
-+++ linux-2.6/include/asm-x86/thread_info_64.h
-@@ -115,7 +115,7 @@ static inline struct thread_info *stack_
- #define TIF_SECCOMP 8 /* secure computing */
- #define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal */
- #define TIF_MCE_NOTIFY 10 /* notify userspace of an MCE */
--/* 16 free */
-+#define TIF_FORCED_TF 16 /* true if TF in eflags artificially */
- #define TIF_IA32 17 /* 32bit process */
- #define TIF_FORK 18 /* ret_from_fork */
- #define TIF_ABI_PENDING 19
-@@ -133,6 +133,7 @@ static inline struct thread_info *stack_
- #define _TIF_SECCOMP (1<<TIF_SECCOMP)
- #define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
- #define _TIF_MCE_NOTIFY (1<<TIF_MCE_NOTIFY)
-+#define _TIF_FORCED_TF (1<<TIF_FORCED_TF)
- #define _TIF_IA32 (1<<TIF_IA32)
- #define _TIF_FORK (1<<TIF_FORK)
- #define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING)
++
++#endif
+--- linux-2.6/include/asm-x86/signal.h
++++ linux-2.6/include/asm-x86/signal.h
+@@ -247,10 +247,8 @@ struct pt_regs;
+
+ #define ptrace_signal_deliver(regs, cookie) \
+ do { \
+- if (current->ptrace & PT_DTRACE) { \
+- current->ptrace &= ~PT_DTRACE; \
++ if (test_and_clear_thread_flag(TIF_FORCED_TF)) \
+ (regs)->eflags &= ~TF_MASK; \
+- } \
+ } while (0)
+
+ #else /* __i386__ */
--- linux-2.6/drivers/connector/cn_proc.c
+++ linux-2.6/drivers/connector/cn_proc.c
@@ -63,8 +63,8 @@ void proc_fork_connector(struct task_str
@@ -3832,7 +3767,7 @@
--- linux-2.6/mm/nommu.c
+++ linux-2.6/mm/nommu.c
-@@ -20,7 +20,7 @@
+@@ -21,7 +21,7 @@
#include <linux/pagemap.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
@@ -3841,7 +3776,7 @@
#include <linux/blkdev.h>
#include <linux/backing-dev.h>
#include <linux/mount.h>
-@@ -705,7 +705,7 @@ static unsigned long determine_vm_flags(
+@@ -706,7 +706,7 @@ static unsigned long determine_vm_flags(
* it's being traced - otherwise breakpoints set in it may interfere
* with another untraced process
*/
- Previous message (by thread): rpms/nginx/EL-5 .cvsignore, 1.7, 1.8 nginx.spec, 1.10, 1.11 sources, 1.8, 1.9
- Next message (by thread): rpms/python-biopython/F-7 .cvsignore, 1.2, 1.3 python-biopython.spec, 1.4, 1.5 sources, 1.2, 1.3 biopython-setup_test.patch, 1.1, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the fedora-extras-commits
mailing list