瀏覽代碼

x86, debug: remove the confusing entry in call trace

Impact: improve backtrace quality

avoid the confusion in call trace because of the lack of padding at the
tail of function.

When do_exit gets called, the return address behind call instruction is
pushed into stack. If something get wrong in do_exit, for x86_64, the
entry "kernel_execve +0x00/0xXX" rather than "child_rip +0xYY/0xZZ" is
in the call trace.

That looks confusing, so add a u2d to make the return address still part
of the original call site. (This also catches any instances of us returning
from that function somehow.)

Signed-off-by: jia zhang <jia.zhang2008@gmail.com>
Acked-by: Alexander van Heukelum <heukelum@fastmail.fm>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
jia zhang 16 年之前
父節點
當前提交
5f5db59132
共有 2 個文件被更改,包括 2 次插入0 次删除
  1. 1 0
      arch/x86/kernel/entry_32.S
  2. 1 0
      arch/x86/kernel/entry_64.S

+ 1 - 0
arch/x86/kernel/entry_32.S

@@ -1051,6 +1051,7 @@ ENTRY(kernel_thread_helper)
 	push %eax
 	push %eax
 	CFI_ADJUST_CFA_OFFSET 4
 	CFI_ADJUST_CFA_OFFSET 4
 	call do_exit
 	call do_exit
+	ud2			# padding for call trace
 	CFI_ENDPROC
 	CFI_ENDPROC
 ENDPROC(kernel_thread_helper)
 ENDPROC(kernel_thread_helper)
 
 

+ 1 - 0
arch/x86/kernel/entry_64.S

@@ -1172,6 +1172,7 @@ child_rip:
 	# exit
 	# exit
 	mov %eax, %edi
 	mov %eax, %edi
 	call do_exit
 	call do_exit
+	ud2			# padding for call trace
 	CFI_ENDPROC
 	CFI_ENDPROC
 ENDPROC(child_rip)
 ENDPROC(child_rip)