From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754253AbcBWI6n (ORCPT ); Tue, 23 Feb 2016 03:58:43 -0500 Received: from terminus.zytor.com ([198.137.202.10]:56640 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753961AbcBWI6k (ORCPT ); Tue, 23 Feb 2016 03:58:40 -0500 Date: Tue, 23 Feb 2016 00:57:19 -0800 From: =?UTF-8?B?dGlwLWJvdCBmb3IgSm9zaCBQb2ltYm9ldWYgPHRpcGJvdEB6eXRvci5jb20+?=@zytor.com Message-ID: Cc: luto@amacapital.net, chris.j.arges@canonical.com, mingo@kernel.org, torvalds@linux-foundation.org, namhyung@gmail.com, akpm@linux-foundation.org, chrisw@sous-sol.org, mmarek@suse.cz, jslaby@suse.cz, brgerst@gmail.com, bp@alien8.de, akataria@vmware.com, jeremy@goop.org, linux-kernel@vger.kernel.org, hpa@zytor.com, luto@kernel.org, peterz@infradead.org, palves@redhat.com, jpoimboe@redhat.com, rusty@rustcorp.com.au, acme@kernel.org, tglx@linutronix.de, dvlasenk@redhat.com, bp@suse.de, bernd@petrovitsch.priv.at Reply-To: bp@alien8.de, akataria@vmware.com, jslaby@suse.cz, brgerst@gmail.com, jeremy@goop.org, peterz@infradead.org, jpoimboe@redhat.com, palves@redhat.com, rusty@rustcorp.com.au, hpa@zytor.com, linux-kernel@vger.kernel.org, luto@kernel.org, dvlasenk@redhat.com, bp@suse.de, bernd@petrovitsch.priv.at, acme@kernel.org, tglx@linutronix.de, chris.j.arges@canonical.com, mingo@kernel.org, luto@amacapital.net, torvalds@linux-foundation.org, namhyung@gmail.com, akpm@linux-foundation.org, mmarek@suse.cz, chrisw@sous-sol.org In-Reply-To: References: To: =?UTF-8?B?bGludXgtdGlwLWNvbW1pdHNAdmdlci5rZXJuZWwub3Jn?=@zytor.com Subject: =?UTF-8?B?W3RpcDp4ODYvZGVidWddIHg4Ni9wYXJhdmlydDogQ3JlYXRlIGEgc3RhY2sgZnI=?= =?UTF-8?B?YW1lIGluIFBWX0NBTExFRV9TQVZFX1JFR1NfVEhVTks=?= Git-Commit-ID: =?UTF-8?B?YzljYzFkNzJiYjBiNjU3ZGUwNmI4ZDRiZTM2ZDk0YmVhMDQ1NGVlOA==?= X-Mailer: =?UTF-8?B?dGlwLWdpdC1sb2ctZGFlbW9u?= Robot-ID: =?UTF-8?B?PHRpcC1ib3QuZ2l0Lmtlcm5lbC5vcmc+?= Robot-Unsubscribe: =?UTF-8?B?Q29udGFjdCA8bWFpbHRvOmhwYUBrZXJuZWwub3JnPiB0byBnZXQgYmxhY2tsaXM=?= =?UTF-8?B?dGVkIGZyb20gdGhlc2UgZW1haWxz?= MIME-Version: =?UTF-8?B?MS4w?= Content-Transfer-Encoding: =?UTF-8?B?OGJpdA==?= Content-Type: =?UTF-8?B?dGV4dC9wbGFpbjsgY2hhcnNldD1VVEYtOA==?= Content-Disposition: =?UTF-8?B?aW5saW5l?= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: c9cc1d72bb0b657de06b8d4be36d94bea0454ee8 Gitweb: http://git.kernel.org/tip/c9cc1d72bb0b657de06b8d4be36d94bea0454ee8 Author: Josh Poimboeuf AuthorDate: Thu, 21 Jan 2016 16:49:13 -0600 Committer: Ingo Molnar CommitDate: Tue, 23 Feb 2016 09:03:55 +0100 x86/paravirt: Create a stack frame in PV_CALLEE_SAVE_REGS_THUNK A function created with the PV_CALLEE_SAVE_REGS_THUNK macro doesn't set up a new stack frame before the call instruction, which breaks frame pointer convention if CONFIG_FRAME_POINTER is enabled and can result in a bad stack trace. Also, the thunk functions aren't annotated as ELF callable functions. Create a stack frame when CONFIG_FRAME_POINTER is enabled and add the ELF function type. Signed-off-by: Josh Poimboeuf Reviewed-by: Borislav Petkov Cc: Alok Kataria Cc: Andrew Morton Cc: Andy Lutomirski Cc: Andy Lutomirski Cc: Arnaldo Carvalho de Melo Cc: Bernd Petrovitsch Cc: Borislav Petkov Cc: Brian Gerst Cc: Chris J Arges Cc: Chris Wright Cc: Denys Vlasenko Cc: H. Peter Anvin Cc: Jeremy Fitzhardinge Cc: Jiri Slaby Cc: Linus Torvalds Cc: Michal Marek Cc: Namhyung Kim Cc: Pedro Alves Cc: Peter Zijlstra Cc: Rusty Russell Cc: Thomas Gleixner Cc: live-patching@vger.kernel.org Link: http://lkml.kernel.org/r/a2cad74e87c4aba7fd0f54a1af312e66a824a575.1453405861.git.jpoimboe@redhat.com Signed-off-by: Ingo Molnar --- arch/x86/include/asm/paravirt.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h index f619250..601f1b8 100644 --- a/arch/x86/include/asm/paravirt.h +++ b/arch/x86/include/asm/paravirt.h @@ -13,6 +13,7 @@ #include #include #include +#include static inline int paravirt_enabled(void) { @@ -756,15 +757,19 @@ static __always_inline void __ticket_unlock_kick(struct arch_spinlock *lock, * call. The return value in rax/eax will not be saved, even for void * functions. */ +#define PV_THUNK_NAME(func) "__raw_callee_save_" #func #define PV_CALLEE_SAVE_REGS_THUNK(func) \ extern typeof(func) __raw_callee_save_##func; \ \ asm(".pushsection .text;" \ - ".globl __raw_callee_save_" #func " ; " \ - "__raw_callee_save_" #func ": " \ + ".globl " PV_THUNK_NAME(func) ";" \ + ".type " PV_THUNK_NAME(func) ", @function;" \ + PV_THUNK_NAME(func) ":" \ + FRAME_BEGIN \ PV_SAVE_ALL_CALLER_REGS \ "call " #func ";" \ PV_RESTORE_ALL_CALLER_REGS \ + FRAME_END \ "ret;" \ ".popsection")