diff mbox

random dumb (or maybe not) question about sparc64

Message ID 20081216.214100.07002773.davem@davemloft.net
State Accepted
Delegated to: David Miller
Headers show

Commit Message

David Miller Dec. 17, 2008, 5:41 a.m. UTC
From: David Miller <davem@davemloft.net>
Date: Tue, 09 Dec 2008 04:12:15 -0800 (PST)

> From: Chris Torek <chris.torek@windriver.com>
> Date: Tue, 09 Dec 2008 04:46:52 -0700
> 
> > The ptrace code uses flushw_user() to push user windows ... good
> > enough, except, a bunch of other code then also does
> > synchronize_user_stack(), but ptrace does not.
 ...
> Perhaps the best place would be in the arch_ptrace_stop() hook.
> I believe IA64 uses this for the register backing store on that
> cpu.  It seems to be created exactly for the case we are discussing
> here. :)
> 
> What do you think?

I guess Chris is not excited enough about this issue to
reply :-)

Anyways, here is the fix I'll probably push upstream.
32-bit sparc will need something similar and I'll implement
that too.

Thanks for the report:

--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

David Miller Dec. 17, 2008, 11:06 a.m. UTC | #1
From: Chris Torek <chris.torek@windriver.com>
Date: Wed, 17 Dec 2008 02:17:59 -0700

> >I guess Chris is not excited enough about this issue to
> >reply :-)
> 
> Heh, more like, back-burnered, and not sufficiently knowledgeable
> about the ptrace code to have commented earlier.
> 
> I do now have some (sparc64) code for doing oprofile stack traces
> on interrupts I can send in now, though.  There's one possibly-a-bug
> issue I'm not at all sure about, and various possible style items,
> and of course for those using sparc32, someone would have to make
> appropriate adjustments.
> 
> Is there any interest in the oprofile code?

Sure.

I added NMI oprofile support in the sparc-next-2.6 tree so
you probably want to submit your changes relative to
that:

	git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-next-2.6.git
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/sparc/include/asm/ptrace_64.h b/arch/sparc/include/asm/ptrace_64.h
index 84e969f..cd6fbfc 100644
--- a/arch/sparc/include/asm/ptrace_64.h
+++ b/arch/sparc/include/asm/ptrace_64.h
@@ -114,6 +114,7 @@  struct sparc_trapf {
 #ifdef __KERNEL__
 
 #include <linux/threads.h>
+#include <asm/system.h>
 
 static inline int pt_regs_trap_type(struct pt_regs *regs)
 {
@@ -130,6 +131,14 @@  static inline bool pt_regs_clear_syscall(struct pt_regs *regs)
 	return (regs->tstate &= ~TSTATE_SYSCALL);
 }
 
+#define arch_ptrace_stop_needed(exit_code, info) \
+({	flush_user_windows(); \
+	get_thread_wsaved() != 0; \
+})
+
+#define arch_ptrace_stop(exit_code, info) \
+	synchronize_user_stack()
+
 struct global_reg_snapshot {
 	unsigned long		tstate;
 	unsigned long		tpc;