[PATCH] x86_64: Fix backtracing for interrupt stacks
authorAndi Kleen <ak@suse.de>
Wed, 2 Aug 2006 20:37:28 +0000 (22:37 +0200)
committerLinus Torvalds <torvalds@g5.osdl.org>
Thu, 3 Aug 2006 03:19:54 +0000 (20:19 -0700)
Re-add backlink for old style unwinder to stack switching.  Add proper
stack frame and CFI annotations to call_softirq

This prevents a oops when backtracing with fallback through the
interrupt stack top.

Suggested by Jan Beulich and Herbert Xu wanted it in 2.6.18.

Cc: jbeulich@novell.com
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/x86_64/kernel/entry.S

index d464dded68c0eb363e1ca848cb5563d34a74b724..6f810424df44ba4aeb5fcd6abb1aea960b07d50b 100644 (file)
@@ -513,6 +513,7 @@ END(stub_rt_sigreturn)
        swapgs  
 1:     incl    %gs:pda_irqcount        # RED-PEN should check preempt count
        cmoveq %gs:pda_irqstackptr,%rsp
+       push    %rbp                    # backlink for old unwinder
        /*
         * We entered an interrupt context - irqs are off:
         */
@@ -1139,18 +1140,21 @@ ENTRY(machine_check)
 END(machine_check)
 #endif
 
+/* Call softirq on interrupt stack. Interrupts are off. */
 ENTRY(call_softirq)
        CFI_STARTPROC
-       movq %gs:pda_irqstackptr,%rax
-       movq %rsp,%rdx
-       CFI_DEF_CFA_REGISTER    rdx
+       push %rbp
+       CFI_ADJUST_CFA_OFFSET   8
+       CFI_REL_OFFSET rbp,0
+       mov  %rsp,%rbp
+       CFI_DEF_CFA_REGISTER rbp
        incl %gs:pda_irqcount
-       cmove %rax,%rsp
-       pushq %rdx
-       /*todo CFI_DEF_CFA_EXPRESSION ...*/
+       cmove %gs:pda_irqstackptr,%rsp
+       push  %rbp                      # backlink for old unwinder
        call __do_softirq
-       popq %rsp
+       leaveq
        CFI_DEF_CFA_REGISTER    rsp
+       CFI_ADJUST_CFA_OFFSET   -8
        decl %gs:pda_irqcount
        ret
        CFI_ENDPROC