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

x86/asm/xen: Create stack frames in xen-asm.S

xen_irq_enable_direct(), xen_restore_fl_direct(), and check_events() are
callable non-leaf functions which don't honor CONFIG_FRAME_POINTER,
which can result in bad stack traces.

Create stack frames for them when CONFIG_FRAME_POINTER is enabled.

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.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: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Chris J Arges <chris.j.arges@canonical.com>
Cc: David Vrabel <david.vrabel@citrix.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Jiri Slaby <jslaby@suse.cz>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
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/a8340ad3fc72ba9ed34da9b3af9cdd6f1a896e17.1453405861.git.jpoimboe@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>

authored by

Josh Poimboeuf and committed by
Ingo Molnar
8be0eb7e 9fd21606

+9 -1
+9 -1
arch/x86/xen/xen-asm.S
··· 14 14 #include <asm/asm-offsets.h> 15 15 #include <asm/percpu.h> 16 16 #include <asm/processor-flags.h> 17 + #include <asm/frame.h> 17 18 18 19 #include "xen-asm.h" 19 20 ··· 24 23 * then enter the hypervisor to get them handled. 25 24 */ 26 25 ENTRY(xen_irq_enable_direct) 26 + FRAME_BEGIN 27 27 /* Unmask events */ 28 28 movb $0, PER_CPU_VAR(xen_vcpu_info) + XEN_vcpu_info_mask 29 29 ··· 41 39 2: call check_events 42 40 1: 43 41 ENDPATCH(xen_irq_enable_direct) 42 + FRAME_END 44 43 ret 45 44 ENDPROC(xen_irq_enable_direct) 46 45 RELOC(xen_irq_enable_direct, 2b+1) ··· 85 82 * enters the hypervisor to get them delivered if so. 86 83 */ 87 84 ENTRY(xen_restore_fl_direct) 85 + FRAME_BEGIN 88 86 #ifdef CONFIG_X86_64 89 87 testw $X86_EFLAGS_IF, %di 90 88 #else ··· 104 100 2: call check_events 105 101 1: 106 102 ENDPATCH(xen_restore_fl_direct) 103 + FRAME_END 107 104 ret 108 105 ENDPROC(xen_restore_fl_direct) 109 106 RELOC(xen_restore_fl_direct, 2b+1) ··· 114 109 * Force an event check by making a hypercall, but preserve regs 115 110 * before making the call. 116 111 */ 117 - check_events: 112 + ENTRY(check_events) 113 + FRAME_BEGIN 118 114 #ifdef CONFIG_X86_32 119 115 push %eax 120 116 push %ecx ··· 145 139 pop %rcx 146 140 pop %rax 147 141 #endif 142 + FRAME_END 148 143 ret 144 + ENDPROC(check_events)