From 45f4d49a7c915a397013cd4b3fcdbb65e62b1417 Mon Sep 17 00:00:00 2001 From: David Mosberger Date: Tue, 30 Dec 2003 09:10:09 -0800 Subject: ia64: Fix a ptrace-bug that caused "strace -f" to crash the inferior process. The root-cause of the problem was that ptrace() tried to copy the portion of the register backing store that landed on the kernel stack back to users-space, but the resulting state was inconsistent if the inferior process was in the middle of a system-call (as would always be the case for strace). The solution is to avoid all needless copying and to instead ensure that when accessing a memory location that may belong to a thread's register-backing store, we attach to that particular thread, rather than the thread identified by the PID argument. If the thread happens to be unattachable, we fall back to using the thread identified by the PID argument. This should have the desired effect if the thread has terminated already and if the thread is running while ptrace() is trying to access its state, all bets are off anyhow and there are no coherency guarantees. In other words, this should be doing the right thing under all circumstances. The patch also fixes the case where PT_AR_BSP and/or PT_CFM are written while the inferior process is in the middle of a system call. This makes arguments passed to GDB inferior calls come out right. The patch was tested with strace -f and the GDB testsuite, which showed no regressions compared to the previous version of the kernel. --- include/asm-ia64/processor.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/asm-ia64/processor.h b/include/asm-ia64/processor.h index 5948902ae28b..91ca5ec53c9c 100644 --- a/include/asm-ia64/processor.h +++ b/include/asm-ia64/processor.h @@ -64,7 +64,7 @@ #define IA64_THREAD_PM_VALID (__IA64_UL(1) << 2) /* performance registers valid? */ #define IA64_THREAD_UAC_NOPRINT (__IA64_UL(1) << 3) /* don't log unaligned accesses */ #define IA64_THREAD_UAC_SIGBUS (__IA64_UL(1) << 4) /* generate SIGBUS on unaligned acc. */ -#define IA64_THREAD_KRBS_SYNCED (__IA64_UL(1) << 5) /* krbs synced with process vm? */ + /* bit 5 is currently unused */ #define IA64_THREAD_FPEMU_NOPRINT (__IA64_UL(1) << 6) /* don't log any fpswa faults */ #define IA64_THREAD_FPEMU_SIGFPE (__IA64_UL(1) << 7) /* send a SIGFPE for fpswa faults */ #define IA64_THREAD_XSTACK (__IA64_UL(1) << 8) /* stack executable by default? */ -- cgit v1.2.3