aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBodo Stroesser <bstroesser@fujitsu-siemens.com>2005-06-04 18:43:32 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-04 20:13:00 -0400
commitc5c3a6d8fe923b8780b9cd10e72344b8cf8518b5 (patch)
tree7b6b663ae1668befa18f8ff0b95f0cc2e254471d
parent778959db97c7ed8eed4025916916b17a4629ce3d (diff)
[PATCH] s390: uml ptrace fixes
To make UML build and run on s390, I needed to do these two little changes: 1) UML includes some of the subarch's (s390) headers. I had to change one of them with the following one-liner, to make this compile. AFAICS, this change doesn't break compilation of s390 itself. 2) UML needs to intercept syscalls via ptrace to invalidate the syscall, read syscall's parameters and write the result with the result of UML's syscall processing. Also, UML needs to make sure, that the host does no syscall restart processing. On i386 for example, this can be done by writing -1 to orig_eax on the 2nd syscall interception (orig_eax is the syscall number, which after the interception is used as a "interrupt was a syscall" flag only. Unfortunately, s390 holds syscall number and syscall result in gpr2 and its "interrupt was a syscall" flag (trap) is unreachable via ptrace. So I changed the host to set trap to -1, if the syscall number is changed to an invalid value on the first syscall interception. Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--arch/s390/kernel/ptrace.c7
-rw-r--r--include/asm-s390/user.h2
2 files changed, 8 insertions, 1 deletions
diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c
index 329d9391c83d..06afa3103ace 100644
--- a/arch/s390/kernel/ptrace.c
+++ b/arch/s390/kernel/ptrace.c
@@ -761,6 +761,13 @@ syscall_trace(struct pt_regs *regs, int entryexit)
761 ? 0x80 : 0)); 761 ? 0x80 : 0));
762 762
763 /* 763 /*
764 * If the debuffer has set an invalid system call number,
765 * we prepare to skip the system call restart handling.
766 */
767 if (!entryexit && regs->gprs[2] >= NR_syscalls)
768 regs->trap = -1;
769
770 /*
764 * this isn't the same as continuing with a signal, but it will do 771 * this isn't the same as continuing with a signal, but it will do
765 * for normal use. strace only continues with a signal if the 772 * for normal use. strace only continues with a signal if the
766 * stopping signal is not SIGTRAP. -brl 773 * stopping signal is not SIGTRAP. -brl
diff --git a/include/asm-s390/user.h b/include/asm-s390/user.h
index c64f8c181df3..1dc74baf03c4 100644
--- a/include/asm-s390/user.h
+++ b/include/asm-s390/user.h
@@ -10,7 +10,7 @@
10#define _S390_USER_H 10#define _S390_USER_H
11 11
12#include <asm/page.h> 12#include <asm/page.h>
13#include <linux/ptrace.h> 13#include <asm/ptrace.h>
14/* Core file format: The core file is written in such a way that gdb 14/* Core file format: The core file is written in such a way that gdb
15 can understand it and provide useful information to the user (under 15 can understand it and provide useful information to the user (under
16 linux we use the 'trad-core' bfd). There are quite a number of 16 linux we use the 'trad-core' bfd). There are quite a number of