mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Jan Beulich" <jbeulich@novell.com>
To: "Andi Kleen" <ak@suse.de>
Cc: "Chuck Ebbert" <76306.1226@compuserve.com>,
	"Jesper Juhl" <jesper.juhl@gmail.com>,
	"Andrew Morton" <akpm@osdl.org>, "Dave Jones" <davej@redhat.com>,
	"linux-kernel" <linux-kernel@vger.kernel.org>
Subject: Re: [patch] i386: fix one case of stuck dwarf2 unwinder II
Date: Tue, 15 Aug 2006 12:33:59 +0200	[thread overview]
Message-ID: <44E1BF37.76E4.0078.0@novell.com> (raw)
In-Reply-To: <200608071004.37849.ak@suse.de>

[-- Attachment #1: Type: text/plain, Size: 667 bytes --]

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

[-- Attachment #2: linux-2.6.18-rc4-unwind-x86_64-term.patch --]
[-- Type: text/plain, Size: 1143 bytes --]

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 <jbeulich@novell.com>

--- 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 */

[-- Attachment #3: linux-2.6.18-rc4-unwind-i386-term.patch --]
[-- Type: text/plain, Size: 1156 bytes --]

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 <jbeulich@novell.com>

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

  reply	other threads:[~2006-08-15 10:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-06 16:09 Chuck Ebbert
2006-08-07  8:00 ` Jan Beulich
2006-08-07  8:04   ` Andi Kleen
2006-08-15 10:33     ` Jan Beulich [this message]
2006-08-15 10:47       ` Andi Kleen
2006-08-15 10:54         ` Jan Beulich
  -- strict thread matches above, loose matches on Subject: below --
2006-08-06  7:11 Chuck Ebbert
2006-08-06 14:04 ` Andi Kleen
2006-08-06  5:00 [patch] i386: fix one case of stuck dwarf2 unwinder Chuck Ebbert
2006-08-06  6:05 ` [patch] i386: fix one case of stuck dwarf2 unwinder II Andi Kleen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=44E1BF37.76E4.0078.0@novell.com \
    --to=jbeulich@novell.com \
    --cc=76306.1226@compuserve.com \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=davej@redhat.com \
    --cc=jesper.juhl@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome