public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] s390: ptrace: don't abuse PT_PTRACED
@ 2009-12-09 19:46 Oleg Nesterov
  2009-12-09 20:51 ` Heiko Carstens
  0 siblings, 1 reply; 3+ messages in thread
From: Oleg Nesterov @ 2009-12-09 19:46 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Heiko Carstens, Martin Schwidefsky, Roland McGrath, linux-s390,
	linux-kernel

Untested, but hopefully trivial enough and should't change the
compiled code.

Nobody except ptrace itself should use task->ptrace or PT_PTRACED
directly, change arch/s390/kernel/traps.c to use the helper.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Roland McGrath <roland@redhat.com>
---

 arch/s390/kernel/traps.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- V1/arch/s390/kernel/traps.c~S390_DONT_ABUSE_PT_PTRACED	2009-04-06 00:03:36.000000000 +0200
+++ V1/arch/s390/kernel/traps.c	2009-12-09 20:31:49.000000000 +0100
@@ -18,7 +18,7 @@
 #include <linux/kernel.h>
 #include <linux/string.h>
 #include <linux/errno.h>
-#include <linux/ptrace.h>
+#include <linux/tracehook.h>
 #include <linux/timer.h>
 #include <linux/mm.h>
 #include <linux/smp.h>
@@ -382,7 +382,7 @@ void __kprobes do_single_step(struct pt_
 					SIGTRAP) == NOTIFY_STOP){
 		return;
 	}
-	if ((current->ptrace & PT_PTRACED) != 0)
+	if (tracehook_consider_fatal_signal(current, SIGTRAP))
 		force_sig(SIGTRAP, current);
 }
 
@@ -483,7 +483,7 @@ static void illegal_op(struct pt_regs * 
 		if (get_user(*((__u16 *) opcode), (__u16 __user *) location))
 			return;
 		if (*((__u16 *) opcode) == S390_BREAKPOINT_U16) {
-			if (current->ptrace & PT_PTRACED)
+			if (tracehook_consider_fatal_signal(current, SIGTRAP))
 				force_sig(SIGTRAP, current);
 			else
 				signal = SIGILL;


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

* Re: [PATCH] s390: ptrace: don't abuse PT_PTRACED
  2009-12-09 19:46 [PATCH] s390: ptrace: don't abuse PT_PTRACED Oleg Nesterov
@ 2009-12-09 20:51 ` Heiko Carstens
  2009-12-09 20:54   ` Roland McGrath
  0 siblings, 1 reply; 3+ messages in thread
From: Heiko Carstens @ 2009-12-09 20:51 UTC (permalink / raw)
  To: Oleg Nesterov
  Cc: Andrew Morton, Martin Schwidefsky, Roland McGrath, linux-s390,
	linux-kernel

On Wed, Dec 09, 2009 at 08:46:51PM +0100, Oleg Nesterov wrote:
> Untested, but hopefully trivial enough and should't change the
> compiled code.
> 
> Nobody except ptrace itself should use task->ptrace or PT_PTRACED
> directly, change arch/s390/kernel/traps.c to use the helper.
> 
> Signed-off-by: Oleg Nesterov <oleg@redhat.com>
> Acked-by: Roland McGrath <roland@redhat.com>

> -	if ((current->ptrace & PT_PTRACED) != 0)
> +	if (tracehook_consider_fatal_signal(current, SIGTRAP))
>  		force_sig(SIGTRAP, current);

Thanks, applied. Even though I'm wondering why tracehook_consider_fatal_signal
has a signal parameter and doesn't do anything with it.
Is that something that will change with utrace?

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

* Re: [PATCH] s390: ptrace: don't abuse PT_PTRACED
  2009-12-09 20:51 ` Heiko Carstens
@ 2009-12-09 20:54   ` Roland McGrath
  0 siblings, 0 replies; 3+ messages in thread
From: Roland McGrath @ 2009-12-09 20:54 UTC (permalink / raw)
  To: Heiko Carstens
  Cc: Oleg Nesterov, Andrew Morton, Martin Schwidefsky, linux-s390,
	linux-kernel

> Thanks, applied. Even though I'm wondering why tracehook_consider_fatal_signal
> has a signal parameter and doesn't do anything with it.
> Is that something that will change with utrace?

It doesn't change with utrace of today.  But it gives enough information
for future tracing implementations to change that logic without rejiggering
all the arch code.


Thanks,
Roland

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

end of thread, other threads:[~2009-12-09 20:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-09 19:46 [PATCH] s390: ptrace: don't abuse PT_PTRACED Oleg Nesterov
2009-12-09 20:51 ` Heiko Carstens
2009-12-09 20:54   ` Roland McGrath

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