]> git.hungrycats.org Git - linux/commitdiff
sparc64: Fix hardirq tracing in trap return path.
authorDavid S. Miller <davem@davemloft.net>
Tue, 20 Apr 2010 07:48:37 +0000 (00:48 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 12 May 2010 22:03:03 +0000 (15:03 -0700)
[ Upstream commit 28a1f533ae8606020238b840b82ae70a3f87609e ]

We can overflow the hardirq stack if we set the %pil here
so early, just let the normal control flow do it.

This is fine as we are allowed to do the actual IRQ enable
at any point after we call trace_hardirqs_on.

Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
arch/sparc/kernel/rtrap_64.S

index fd3cee4d117c66ddc0fce0c3ef89bd923cd4f3b2..c720f0ccea1b36e6bbf9b7e16b61d2ed9e02922e 100644 (file)
@@ -172,7 +172,17 @@ rtrap_xcall:
                 nop
                call                    trace_hardirqs_on
                 nop
-               wrpr                    %l4, %pil
+               /* Do not actually set the %pil here.  We will do that
+                * below after we clear PSTATE_IE in the %pstate register.
+                * If we re-enable interrupts here, we can recurse down
+                * the hardirq stack potentially endlessly, causing a
+                * stack overflow.
+                *
+                * It is tempting to put this test and trace_hardirqs_on
+                * call at the 'rt_continue' label, but that will not work
+                * as that path hits unconditionally and we do not want to
+                * execute this in NMI return paths, for example.
+                */
 #endif
 rtrap_no_irq_enable:
                andcc                   %l1, TSTATE_PRIV, %l3