* [RFC/PATCH 5/5] powerpc: Allow ptrace write to pt_regs trap
@ 2007-05-29 6:45 Benjamin Herrenschmidt
2007-05-29 15:41 ` Ulrich Weigand
0 siblings, 1 reply; 5+ messages in thread
From: Benjamin Herrenschmidt @ 2007-05-29 6:45 UTC (permalink / raw)
To: linuxppc-dev; +Cc: ulrich.weigand, Paul Mackerras, Anton Blanchard
This patch allows a ptracer to write to the "trap" word of the
pt_regs. This, along with the previous patch, should enable gdb
to properly handle syscall restarting after executing a separate
function (at least when there's no restart block).
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/kernel/ptrace-common.h | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
Index: linux-cell/arch/powerpc/kernel/ptrace-common.h
===================================================================
--- linux-cell.orig/arch/powerpc/kernel/ptrace-common.h 2007-05-29 16:22:07.000000000 +1000
+++ linux-cell/arch/powerpc/kernel/ptrace-common.h 2007-05-29 16:42:04.000000000 +1000
@@ -41,10 +41,15 @@ static inline int put_reg(struct task_st
if (task->thread.regs == NULL)
return -EIO;
- if (regno <= PT_MAX_PUT_REG) {
+ if (regno <= PT_MAX_PUT_REG || regno == PT_TRAP) {
if (regno == PT_MSR)
data = (data & MSR_DEBUGCHANGE)
| (task->thread.regs->msr & ~MSR_DEBUGCHANGE);
+ /* We prevent mucking around with the reserved area of trap
+ * which are used internally by the kernel
+ */
+ if (regno == PT_TRAP)
+ data &= 0xff00;
((unsigned long *)task->thread.regs)[regno] = data;
return 0;
}
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFC/PATCH 5/5] powerpc: Allow ptrace write to pt_regs trap
2007-05-29 6:45 [RFC/PATCH 5/5] powerpc: Allow ptrace write to pt_regs trap Benjamin Herrenschmidt
@ 2007-05-29 15:41 ` Ulrich Weigand
2007-05-29 21:41 ` Benjamin Herrenschmidt
2007-05-30 4:33 ` Benjamin Herrenschmidt
0 siblings, 2 replies; 5+ messages in thread
From: Ulrich Weigand @ 2007-05-29 15:41 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, Paul Mackerras, Anton Blanchard
[-- Attachment #1: Type: text/plain, Size: 1021 bytes --]
Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote on 05/29/2007
08:45:24 AM:
> This patch allows a ptracer to write to the "trap" word of the
> pt_regs. This, along with the previous patch, should enable gdb
> to properly handle syscall restarting after executing a separate
> function (at least when there's no restart block).
This doesn't look sufficient. If you want GDB to use the save/
restore style means of handling interrupted calls (like i386),
at the very least we also need the capability to *write* the
orig_gpr3 field, which is currently prohibited. (I don't know
why this is case, though.)
Mit freundlichen Gruessen / Best Regards
Ulrich Weigand
--
Dr. Ulrich Weigand | Phone: +49-7031/16-3727
GNU compiler/toolchain for Linux on System z and Cell BE
IBM Deutschland Entwicklung GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter | Geschäftsführung:
Herbert Kircher
Sitz der Gesellschaft: Böblingen | Registergericht: Amtsgericht
Stuttgart, HRB 243294
[-- Attachment #2: Type: text/html, Size: 1400 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFC/PATCH 5/5] powerpc: Allow ptrace write to pt_regs trap
2007-05-29 15:41 ` Ulrich Weigand
@ 2007-05-29 21:41 ` Benjamin Herrenschmidt
2007-05-30 13:08 ` Ulrich Weigand
2007-05-30 4:33 ` Benjamin Herrenschmidt
1 sibling, 1 reply; 5+ messages in thread
From: Benjamin Herrenschmidt @ 2007-05-29 21:41 UTC (permalink / raw)
To: Ulrich Weigand; +Cc: linuxppc-dev, Paul Mackerras, Anton Blanchard
On Tue, 2007-05-29 at 17:41 +0200, Ulrich Weigand wrote:
> This doesn't look sufficient. If you want GDB to use the save/
> restore style means of handling interrupted calls (like i386),
> at the very least we also need the capability to *write* the
> orig_gpr3 field, which is currently prohibited. (I don't know
> why this is case, though.)
It's not prohibited afaik ... we allow writing to everything <= MQ (39)
on 32 bits and <= CCR (38) on 64 bits and ORIG_R3 qualifies (34)
Ben.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFC/PATCH 5/5] powerpc: Allow ptrace write to pt_regs trap
2007-05-29 15:41 ` Ulrich Weigand
2007-05-29 21:41 ` Benjamin Herrenschmidt
@ 2007-05-30 4:33 ` Benjamin Herrenschmidt
1 sibling, 0 replies; 5+ messages in thread
From: Benjamin Herrenschmidt @ 2007-05-30 4:33 UTC (permalink / raw)
To: Ulrich Weigand; +Cc: linuxppc-dev, Paul Mackerras, Anton Blanchard
> This doesn't look sufficient. If you want GDB to use the save/
> restore style means of handling interrupted calls (like i386),
> at the very least we also need the capability to *write* the
> orig_gpr3 field, which is currently prohibited. (I don't know
> why this is case, though.)
Ok, I found it... put_reg doesn't filter it out but the caller does.
Fixing that too.
Ben.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFC/PATCH 5/5] powerpc: Allow ptrace write to pt_regs trap
2007-05-29 21:41 ` Benjamin Herrenschmidt
@ 2007-05-30 13:08 ` Ulrich Weigand
0 siblings, 0 replies; 5+ messages in thread
From: Ulrich Weigand @ 2007-05-30 13:08 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, Paul Mackerras, Anton Blanchard
[-- Attachment #1: Type: text/plain, Size: 1136 bytes --]
Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote on 05/29/2007
11:41:40 PM:
> On Tue, 2007-05-29 at 17:41 +0200, Ulrich Weigand wrote:
> > This doesn't look sufficient. If you want GDB to use the save/
> > restore style means of handling interrupted calls (like i386),
> > at the very least we also need the capability to *write* the
> > orig_gpr3 field, which is currently prohibited. (I don't know
> > why this is case, though.)
>
> It's not prohibited afaik ... we allow writing to everything <= MQ (39)
> on 32 bits and <= CCR (38) on 64 bits and ORIG_R3 qualifies (34)
Um? I see this in the PTRACE_POKEUSR case in arch_ptrace:
if (index == PT_ORIG_R3)
break;
Mit freundlichen Gruessen / Best Regards
Ulrich Weigand
--
Dr. Ulrich Weigand | Phone: +49-7031/16-3727
GNU compiler/toolchain for Linux on System z and Cell BE
IBM Deutschland Entwicklung GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter | Geschäftsführung:
Herbert Kircher
Sitz der Gesellschaft: Böblingen | Registergericht: Amtsgericht
Stuttgart, HRB 243294
[-- Attachment #2: Type: text/html, Size: 1611 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-05-30 13:08 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-29 6:45 [RFC/PATCH 5/5] powerpc: Allow ptrace write to pt_regs trap Benjamin Herrenschmidt
2007-05-29 15:41 ` Ulrich Weigand
2007-05-29 21:41 ` Benjamin Herrenschmidt
2007-05-30 13:08 ` Ulrich Weigand
2007-05-30 4:33 ` Benjamin Herrenschmidt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).