Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1488402

[PATCH v2 4/9] x86/head/32: fix the end of the stack for idle tasks

From Josh Poimboeuf <jpoimboe@redhat.com>
Newsgroups linux.kernel
Subject [PATCH v2 4/9] x86/head/32: fix the end of the stack for idle tasks
Date 2016-09-21 23:10 +0200
Message-ID <sjWWd-5EH-17@gated-at.bofh.it> (permalink)
References <sjWWd-5EH-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


The frame at the end of each idle task stack is inconsistent with real
task stacks, which have a stack frame header and a real return address
before the pt_regs area.  This inconsistency can be confusing for stack
unwinders.  It also hides useful information about what asm code was
involved in calling into C.

Fix that by changing the initial code jumps to calls.  Also add infinite
loops after the calls to make it clear that the calls don't return, and
to hang if they do.

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
---
 arch/x86/kernel/head_32.S | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S
index 617fba2..7aac1b9 100644
--- a/arch/x86/kernel/head_32.S
+++ b/arch/x86/kernel/head_32.S
@@ -288,7 +288,8 @@ num_subarch_entries = (. - subarch_entries) / 4
 ENTRY(start_cpu0)
 	movl initial_stack, %ecx
 	movl %ecx, %esp
-	jmp  *(initial_code)
+	call *(initial_code)
+1:	jmp 1b
 ENDPROC(start_cpu0)
 #endif
 
@@ -469,8 +470,9 @@ ENTRY(startup_32_smp)
 	xorl %eax,%eax			# Clear LDT
 	lldt %ax
 
-	pushl $0		# fake return address for unwinder
-	jmp *(initial_code)
+	call *(initial_code)
+1:	jmp 1b
+ENDPROC(startup_32_smp)
 
 #include "verify_cpu.S"
 
-- 
2.7.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/9] x86/entry/head: standardize the end of the stack Josh Poimboeuf <jpoimboe@redhat.com> - 2016-09-21 23:10 +0200
  [PATCH v2 1/9] x86/entry/head/32: use local labels Josh Poimboeuf <jpoimboe@redhat.com> - 2016-09-21 23:10 +0200
  [PATCH v2 2/9] x86/entry/32: rename 'error_code' to 'common_exception' Josh Poimboeuf <jpoimboe@redhat.com> - 2016-09-21 23:10 +0200
  [PATCH v2 4/9] x86/head/32: fix the end of the stack for idle tasks Josh Poimboeuf <jpoimboe@redhat.com> - 2016-09-21 23:10 +0200
  [PATCH v2 6/9] x86/asm/head: use a common function for starting CPUs Josh Poimboeuf <jpoimboe@redhat.com> - 2016-09-21 23:10 +0200
  [PATCH v2 7/9] x86/head: put real return address on idle task stack Josh Poimboeuf <jpoimboe@redhat.com> - 2016-09-21 23:10 +0200
  [PATCH v2 3/9] x86/entry/32: fix the end of the stack for newly forked tasks Josh Poimboeuf <jpoimboe@redhat.com> - 2016-09-21 23:10 +0200
  [PATCH v2 8/9] x86/head: fix the end of the stack for idle tasks Josh Poimboeuf <jpoimboe@redhat.com> - 2016-09-21 23:10 +0200

csiph-web