From: Benjamin Herrenschmidt <benh@kernel.crashing.org> Date: 2007-05-29 06:45:24
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
===================================================================
@@ -41,10 +41,15 @@ static inline int put_reg(struct task_stif(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+*whichareusedinternallybythekernel+*/+if(regno==PT_TRAP)+data&=0xff00;((unsignedlong*)task->thread.regs)[regno]=data;return0;}
Benjamin Herrenschmidt [off-list ref] 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
From: Benjamin Herrenschmidt <benh@kernel.crashing.org> Date: 2007-05-29 21:41:49
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.
From: Benjamin Herrenschmidt <benh@kernel.crashing.org> Date: 2007-05-30 04:33:41
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.
Benjamin Herrenschmidt [off-list ref] wrote on 05/29/2007
11:41:40 PM:
On Tue, 2007-05-29 at 17:41 +0200, Ulrich Weigand wrote:
quoted
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