Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86/asm/power: Create stack frames in hibernate_asm_64.S

swsusp_arch_suspend() and restore_registers() are callable non-leaf
functions which don't honor CONFIG_FRAME_POINTER, which can result in
bad stack traces. Also they aren't annotated as ELF callable functions
which can confuse tooling.

Create a stack frame for them when CONFIG_FRAME_POINTER is enabled and
give them proper ELF function annotations.

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Reviewed-by: Borislav Petkov <bp@suse.de>
Acked-by: Pavel Machek <pavel@ucw.cz>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Bernd Petrovitsch <bernd@petrovitsch.priv.at>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Chris J Arges <chris.j.arges@canonical.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Jiri Slaby <jslaby@suse.cz>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Michal Marek <mmarek@suse.cz>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Pedro Alves <palves@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: live-patching@vger.kernel.org
Link: http://lkml.kernel.org/r/bdad00205897dc707aebe9e9e39757085e2bf999.1453405861.git.jpoimboe@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>

authored by

Josh Poimboeuf and committed by
Ingo Molnar
ef0f3ed5 779c433b

+7
+7
arch/x86/power/hibernate_asm_64.S
··· 21 21 #include <asm/page_types.h> 22 22 #include <asm/asm-offsets.h> 23 23 #include <asm/processor-flags.h> 24 + #include <asm/frame.h> 24 25 25 26 ENTRY(swsusp_arch_suspend) 27 + FRAME_BEGIN 26 28 movq $saved_context, %rax 27 29 movq %rsp, pt_regs_sp(%rax) 28 30 movq %rbp, pt_regs_bp(%rax) ··· 52 50 movq %rax, restore_cr3(%rip) 53 51 54 52 call swsusp_save 53 + FRAME_END 55 54 ret 55 + ENDPROC(swsusp_arch_suspend) 56 56 57 57 ENTRY(restore_image) 58 58 /* switch to temporary page tables */ ··· 111 107 */ 112 108 113 109 ENTRY(restore_registers) 110 + FRAME_BEGIN 114 111 /* go back to the original page tables */ 115 112 movq %rbx, %cr3 116 113 ··· 152 147 /* tell the hibernation core that we've just restored the memory */ 153 148 movq %rax, in_suspend(%rip) 154 149 150 + FRAME_END 155 151 ret 152 + ENDPROC(restore_registers)