public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] s390: Remove self ptrace IEEE_IP hack.
@ 2008-04-30  9:14 Martin Schwidefsky
  2008-04-30  9:19 ` Christoph Hellwig
  0 siblings, 1 reply; 6+ messages in thread
From: Martin Schwidefsky @ 2008-04-30  9:14 UTC (permalink / raw)
  To: linux-kernel, linux-s390; +Cc: Christoph Hellwig

From: Martin Schwidefsky <schwidefsky@de.ibm.com>

The self referential PT_IEEE_IP ptrace peek & poke calls have been
broken for that last 6 years. For peek the code always returns 0
instead of the last ieee fault and for poke the code does nothing.
Since nobody noticed the code seems to be superfluous. So lets
remove it.

Cc: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
---

 arch/s390/kernel/ptrace.c |   20 --------------------
 1 file changed, 20 deletions(-)

diff -urpN linux-2.6/arch/s390/kernel/ptrace.c linux-2.6-patched/arch/s390/kernel/ptrace.c
--- linux-2.6/arch/s390/kernel/ptrace.c	2008-04-30 11:10:46.000000000 +0200
+++ linux-2.6-patched/arch/s390/kernel/ptrace.c	2008-04-30 11:11:02.000000000 +0200
@@ -607,8 +607,6 @@ do_ptrace_emu31(struct task_struct *chil
 }
 #endif
 
-#define PT32_IEEE_IP 0x13c
-
 static int
 do_ptrace(struct task_struct *child, long request, long addr, long data)
 {
@@ -617,24 +615,6 @@ do_ptrace(struct task_struct *child, lon
 	if (request == PTRACE_ATTACH)
 		return ptrace_attach(child);
 
-	/*
-	 * Special cases to get/store the ieee instructions pointer.
-	 */
-	if (child == current) {
-		if (request == PTRACE_PEEKUSR && addr == PT_IEEE_IP)
-			return peek_user(child, addr, data);
-		if (request == PTRACE_POKEUSR && addr == PT_IEEE_IP)
-			return poke_user(child, addr, data);
-#ifdef CONFIG_COMPAT
-		if (request == PTRACE_PEEKUSR &&
-		    addr == PT32_IEEE_IP && test_thread_flag(TIF_31BIT))
-			return peek_user_emu31(child, addr, data);
-		if (request == PTRACE_POKEUSR &&
-		    addr == PT32_IEEE_IP && test_thread_flag(TIF_31BIT))
-			return poke_user_emu31(child, addr, data);
-#endif
-	}
-
 	ret = ptrace_check_attach(child, request == PTRACE_KILL);
 	if (ret < 0)
 		return ret;



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch] s390: Remove self ptrace IEEE_IP hack.
  2008-04-30  9:14 [patch] s390: Remove self ptrace IEEE_IP hack Martin Schwidefsky
@ 2008-04-30  9:19 ` Christoph Hellwig
  2008-04-30  9:33   ` Martin Schwidefsky
  2008-04-30 11:36   ` Martin Schwidefsky
  0 siblings, 2 replies; 6+ messages in thread
From: Christoph Hellwig @ 2008-04-30  9:19 UTC (permalink / raw)
  To: Martin Schwidefsky; +Cc: linux-kernel, linux-s390, Christoph Hellwig

On Wed, Apr 30, 2008 at 11:14:56AM +0200, Martin Schwidefsky wrote:
> From: Martin Schwidefsky <schwidefsky@de.ibm.com>
> 
> The self referential PT_IEEE_IP ptrace peek & poke calls have been
> broken for that last 6 years. For peek the code always returns 0
> instead of the last ieee fault and for poke the code does nothing.
> Since nobody noticed the code seems to be superfluous. So lets
> remove it.

After this the switch to the generic sys_ptrace is trivial.  Care to
submit a patch for that aswell?


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch] s390: Remove self ptrace IEEE_IP hack.
  2008-04-30  9:19 ` Christoph Hellwig
@ 2008-04-30  9:33   ` Martin Schwidefsky
  2008-04-30 11:36   ` Martin Schwidefsky
  1 sibling, 0 replies; 6+ messages in thread
From: Martin Schwidefsky @ 2008-04-30  9:33 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-kernel, linux-s390

On Wed, 2008-04-30 at 05:19 -0400, Christoph Hellwig wrote:
> On Wed, Apr 30, 2008 at 11:14:56AM +0200, Martin Schwidefsky wrote:
> > From: Martin Schwidefsky <schwidefsky@de.ibm.com>
> > 
> > The self referential PT_IEEE_IP ptrace peek & poke calls have been
> > broken for that last 6 years. For peek the code always returns 0
> > instead of the last ieee fault and for poke the code does nothing.
> > Since nobody noticed the code seems to be superfluous. So lets
> > remove it.
> 
> After this the switch to the generic sys_ptrace is trivial.  Care to
> submit a patch for that aswell?

True, that makes sense. I'll do that right after lunch.

-- 
blue skies,
  Martin.

"Reality continues to ruin my life." - Calvin.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch] s390: Remove self ptrace IEEE_IP hack.
  2008-04-30  9:19 ` Christoph Hellwig
  2008-04-30  9:33   ` Martin Schwidefsky
@ 2008-04-30 11:36   ` Martin Schwidefsky
  2008-04-30 12:04     ` Christoph Hellwig
  2008-04-30 12:15     ` Christoph Hellwig
  1 sibling, 2 replies; 6+ messages in thread
From: Martin Schwidefsky @ 2008-04-30 11:36 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-kernel, linux-s390

On Wed, 2008-04-30 at 05:19 -0400, Christoph Hellwig wrote:
> After this the switch to the generic sys_ptrace is trivial.  Care to
> submit a patch for that aswell?
> 

Here we go..

-- 
blue skies,
  Martin.

"Reality continues to ruin my life." - Calvin.

---
Subject: [PATCH] s390: use generic sys_ptrace

From: Martin Schwidefsky <schwidefsky@de.ibm.com>

After the PT_IEEE_IP hack has been removed s390 can now use
the common code sys_ptrace function.

Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
---

 arch/s390/kernel/ptrace.c |   37 +------------------------------------
 include/asm-s390/ptrace.h |    2 --
 2 files changed, 1 insertion(+), 38 deletions(-)

diff -urpN linux-2.6/arch/s390/kernel/ptrace.c linux-2.6-patched/arch/s390/kernel/ptrace.c
--- linux-2.6/arch/s390/kernel/ptrace.c	2008-04-30 13:33:14.000000000 +0200
+++ linux-2.6-patched/arch/s390/kernel/ptrace.c	2008-04-30 13:33:14.000000000 +0200
@@ -607,18 +607,8 @@ do_ptrace_emu31(struct task_struct *chil
 }
 #endif
 
-static int
-do_ptrace(struct task_struct *child, long request, long addr, long data)
+long arch_ptrace(struct task_struct *child, long request, long addr, long data)
 {
-	int ret;
-
-	if (request == PTRACE_ATTACH)
-		return ptrace_attach(child);
-
-	ret = ptrace_check_attach(child, request == PTRACE_KILL);
-	if (ret < 0)
-		return ret;
-
 	switch (request) {
 	case PTRACE_SYSCALL:
 		/* continue and stop at next (return from) syscall */
@@ -673,31 +663,6 @@ do_ptrace(struct task_struct *child, lon
 	return -EIO;
 }
 
-asmlinkage long
-sys_ptrace(long request, long pid, long addr, long data)
-{
-	struct task_struct *child;
-	int ret;
-
-	lock_kernel();
-	if (request == PTRACE_TRACEME) {
-		 ret = ptrace_traceme();
-		 goto out;
-	}
-
-	child = ptrace_get_task_struct(pid);
-	if (IS_ERR(child)) {
-		ret = PTR_ERR(child);
-		goto out;
-	}
-
-	ret = do_ptrace(child, request, addr, data);
-	put_task_struct(child);
-out:
-	unlock_kernel();
-	return ret;
-}
-
 asmlinkage void
 syscall_trace(struct pt_regs *regs, int entryexit)
 {
diff -urpN linux-2.6/include/asm-s390/ptrace.h linux-2.6-patched/include/asm-s390/ptrace.h
--- linux-2.6/include/asm-s390/ptrace.h	2008-04-17 04:49:44.000000000 +0200
+++ linux-2.6-patched/include/asm-s390/ptrace.h	2008-04-30 13:33:14.000000000 +0200
@@ -463,8 +463,6 @@ struct user_regs_struct
 };
 
 #ifdef __KERNEL__
-#define __ARCH_SYS_PTRACE	1
-
 /*
  * These are defined as per linux/ptrace.h, which see.
  */



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch] s390: Remove self ptrace IEEE_IP hack.
  2008-04-30 11:36   ` Martin Schwidefsky
@ 2008-04-30 12:04     ` Christoph Hellwig
  2008-04-30 12:15     ` Christoph Hellwig
  1 sibling, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2008-04-30 12:04 UTC (permalink / raw)
  To: Martin Schwidefsky; +Cc: Christoph Hellwig, linux-kernel, linux-s390

On Wed, Apr 30, 2008 at 01:36:33PM +0200, Martin Schwidefsky wrote:
> Here we go..

Looks good.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch] s390: Remove self ptrace IEEE_IP hack.
  2008-04-30 11:36   ` Martin Schwidefsky
  2008-04-30 12:04     ` Christoph Hellwig
@ 2008-04-30 12:15     ` Christoph Hellwig
  1 sibling, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2008-04-30 12:15 UTC (permalink / raw)
  To: linux-kernel, linux-s390; +Cc: Martin Schwidefsky, akpm

And now that the last architecture (s390) has been converted to the
generic ptrace code the __ARCH_SYS_PTRACE ifdef can go away.  Once we've
also converted all architectures to compat_sys_ptrace some more code can
be made private to kernel/ptrace.c.


Signed-off-by: Christoph Hellwig <hch@lst.de>

Index: linux-2.6/kernel/ptrace.c
===================================================================
--- linux-2.6.orig/kernel/ptrace.c	2008-04-30 14:04:33.000000000 +0200
+++ linux-2.6/kernel/ptrace.c	2008-04-30 14:10:46.000000000 +0200
@@ -543,7 +543,6 @@ 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)
 {
 	struct task_struct *child;
@@ -591,7 +590,6 @@ asmlinkage long sys_ptrace(long request,
 	unlock_kernel();
 	return ret;
 }
-#endif /* __ARCH_SYS_PTRACE */
 
 int generic_ptrace_peekdata(struct task_struct *tsk, long addr, long data)
 {

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-04-30 12:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-30  9:14 [patch] s390: Remove self ptrace IEEE_IP hack Martin Schwidefsky
2008-04-30  9:19 ` Christoph Hellwig
2008-04-30  9:33   ` Martin Schwidefsky
2008-04-30 11:36   ` Martin Schwidefsky
2008-04-30 12:04     ` Christoph Hellwig
2008-04-30 12:15     ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox