LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] x86-64 only: ia32entry.S reg changes dropped during debugging
@ 2004-05-26 22:50 Chris Gottbrath
  2004-05-26 23:33 ` Andi Kleen
  0 siblings, 1 reply; 2+ messages in thread
From: Chris Gottbrath @ 2004-05-26 22:50 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Marcelo Tosatti, discuss, linux-kernel, John DelSignore


Andi, 

We develop a debugger for linux x86-64 called TotalView. We have 
recently tracked down a problem to the fact that some register changes
made by the debugger in the target are getting discarded. This is only 
happening with the 2.4.x kernels on x86-64. It appears that the 
bug may have been fixed as a side effect of some other change in 2.6.x.

The scenario is that the debugger uses ptrace(PTRACE_SYSCALL,) and 
changes some registers in the process while it is stopped in a
system call. We are finding that the system call entry code discards 
changes to R15, R14, R13, R12, RBP, and RBX.

The following patch is against arch/x86_64/ia32/ia32entry.S in 2.4.26.

--- ia32entry.S.orig	2004-02-18 08:36:31.000000000 -0500
+++ ia32entry.S	2004-05-19 17:39:22.000000000 -0400
@@ -71,7 +71,7 @@
 	movq %rsp,%rdi        /* &pt_regs -> arg1 */
 	call syscall_trace
 	LOAD_ARGS ARGOFFSET  /* reload args from stack in case ptrace changed it */
-	addq $ARGOFFSET,%rsp	
+	RESTORE_REST
 	cmpl $(IA32_NR_syscalls),%eax
 	jae  1f
 	IA32_ARG_FIXUP
@@ -81,7 +81,7 @@
 1:	SAVE_REST
 	movq %rsp,%rdi		/* &pt_regs -> arg1 */ 
 	call syscall_trace
-	addq $ARGOFFSET,%rsp
+	RESTORE_REST
 	jmp int_ret_from_sys_call
 		
 ia32_badsys:


Please CC me with any feedback. 

Cheers,
Chris


--
Chris Gottbrath
Partner Technologies Engineer    Etnus, LLC
Chris.Gottbrath@etnus.com        http://www.etnus.com/
Voice: 508-652-7700 x7735        Fax: 508-652-7787

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

* Re: [PATCH] x86-64 only: ia32entry.S reg changes dropped during debugging
  2004-05-26 22:50 [PATCH] x86-64 only: ia32entry.S reg changes dropped during debugging Chris Gottbrath
@ 2004-05-26 23:33 ` Andi Kleen
  0 siblings, 0 replies; 2+ messages in thread
From: Andi Kleen @ 2004-05-26 23:33 UTC (permalink / raw)
  To: Chris.Gottbrath; +Cc: chrisg, marcelo, discuss, linux-kernel, jdelsign

On Wed, 26 May 2004 18:50:11 -0400 (EDT)
Chris Gottbrath <chrisg@etnus.com> wrote:

> 
> Andi, 
> 
> We develop a debugger for linux x86-64 called TotalView. We have 
> recently tracked down a problem to the fact that some register changes
> made by the debugger in the target are getting discarded. This is only 
> happening with the 2.4.x kernels on x86-64. It appears that the 
> bug may have been fixed as a side effect of some other change in 2.6.x.
> 
> The scenario is that the debugger uses ptrace(PTRACE_SYSCALL,) and 
> changes some registers in the process while it is stopped in a
> system call. We are finding that the system call entry code discards 
> changes to R15, R14, R13, R12, RBP, and RBX.
> 
> The following patch is against arch/x86_64/ia32/ia32entry.S in 2.4.26.

Looks good. Thanks.

-Andi


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

end of thread, other threads:[~2004-05-26 23:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-26 22:50 [PATCH] x86-64 only: ia32entry.S reg changes dropped during debugging Chris Gottbrath
2004-05-26 23:33 ` Andi Kleen

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).