Re: [patch] i386: fix one case of stuck dwarf2 unwinder II

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>> So it would seem to me. Nevertheless, in my opinion the proper fix is
to annotate the call site
>> (in head.S) to specify a zero EIP as return address (which denotes
the bottom of a frame).
>
>Can you please send a patch to do that?
>
>That seems to be missing in some other places too, e.g. i386 sysenter
path, x86-64 kernel_thread,
>more?

Attaching both an i386 version (boot/idle thread only, you did
kernel_thread already)
and an x86-64 one (boot/idle and kernel_thread). The i386 sysenter path
is a different
thing, there we have an actual caller (though outside of the kernel),
which I'd like to
continue to reflect/catch through arch_unw_user_mode().

Jan
Add kernel thread stack frame termination for properly stopping stack
unwinds.

One open question: Should these added pushes perhaps be made
conditional upon CONFIG_STACK_UNWIND or CONFIG_UNWIND_INFO?

Signed-off-by: Jan Beulich <[email protected]>

--- linux-2.6.18-rc4/arch/x86_64/kernel/entry.S	2006-08-15 11:29:41.000000000 +0200
+++ 2.6.18-rc4-unwind-x86_64-term/arch/x86_64/kernel/entry.S	2006-08-15 10:15:40.000000000 +0200
@@ -973,6 +973,8 @@ ENTRY(kernel_thread)
 ENDPROC(kernel_thread)
 	
 child_rip:
+	pushq $0		# fake return address
+	CFI_STARTPROC
 	/*
 	 * Here we are in the child and the registers are set as they were
 	 * at kernel_thread() invocation in the parent.
@@ -983,6 +985,7 @@ child_rip:
 	# exit
 	xorl %edi, %edi
 	call do_exit
+	CFI_ENDPROC
 ENDPROC(child_rip)
 
 /*
--- linux-2.6.18-rc4/arch/x86_64/kernel/head.S	2006-06-18 03:49:35.000000000 +0200
+++ 2.6.18-rc4-unwind-x86_64-term/arch/x86_64/kernel/head.S	2006-08-15 11:05:13.000000000 +0200
@@ -191,6 +191,7 @@ startup_64:
 	 * jump
 	 */
 	movq	initial_code(%rip),%rax
+	pushq	$0		# fake return address
 	jmp	*%rax
 
 	/* SMP bootup changes these two */
Add boot/idle kernel thread stack frame termination for properly
stopping stack unwinds.

One open question: Should this added push perhaps be made conditional
upon CONFIG_STACK_UNWIND or CONFIG_UNWIND_INFO?

Signed-off-by: Jan Beulich <[email protected]>

--- linux-2.6.18-rc4/arch/i386/kernel/head.S	2006-08-15 11:32:08.000000000 +0200
+++ 2.6.18-rc4-unwind-i386-term/arch/i386/kernel/head.S	2006-08-15 11:06:03.000000000 +0200
@@ -317,20 +317,14 @@ is386:	movl $2,%ecx		# set MP
 	movl %eax,%gs
 	lldt %ax
 	cld			# gcc2 wants the direction flag cleared at all times
+	pushl %eax		# fake return address
 #ifdef CONFIG_SMP
 	movb ready, %cl
 	movb $1, ready
-	cmpb $0,%cl
-	je 1f			# the first CPU calls start_kernel
-				# all other CPUs call initialize_secondary
-	call initialize_secondary
-	jmp L6
-1:
+	cmpb $0,%cl		# the first CPU calls start_kernel
+	jne initialize_secondary # all other CPUs call initialize_secondary
 #endif /* CONFIG_SMP */
-	call start_kernel
-L6:
-	jmp L6			# main should never return here, but
-				# just in case, we know what happens.
+	jmp start_kernel
 
 /*
  * We depend on ET to be correct. This checks for 287/387.

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux