From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759474AbcBYFtX (ORCPT ); Thu, 25 Feb 2016 00:49:23 -0500 Received: from torg.zytor.com ([198.137.202.12]:53726 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756493AbcBYFtT (ORCPT ); Thu, 25 Feb 2016 00:49:19 -0500 Date: Wed, 24 Feb 2016 21:46:36 -0800 From: tip-bot for Josh Poimboeuf Message-ID: Cc: rusty@rustcorp.com.au, chrisw@sous-sol.org, bp@alien8.de, akataria@vmware.com, palves@redhat.com, tglx@linutronix.de, hpa@zytor.com, jpoimboe@redhat.com, bernd@petrovitsch.priv.at, acme@kernel.org, mmarek@suse.cz, dvlasenk@redhat.com, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, namhyung@gmail.com, jslaby@suse.cz, torvalds@linux-foundation.org, luto@kernel.org, brgerst@gmail.com, bp@suse.de, jeremy@goop.org, chris.j.arges@canonical.com, luto@amacapital.net, mingo@kernel.org, peterz@infradead.org Reply-To: peterz@infradead.org, luto@amacapital.net, mingo@kernel.org, jeremy@goop.org, chris.j.arges@canonical.com, luto@kernel.org, bp@suse.de, brgerst@gmail.com, jslaby@suse.cz, torvalds@linux-foundation.org, namhyung@gmail.com, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, dvlasenk@redhat.com, mmarek@suse.cz, acme@kernel.org, bernd@petrovitsch.priv.at, jpoimboe@redhat.com, hpa@zytor.com, tglx@linutronix.de, palves@redhat.com, akataria@vmware.com, bp@alien8.de, chrisw@sous-sol.org, rusty@rustcorp.com.au In-Reply-To: References: To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/debug] x86/paravirt: Create a stack frame in PV_CALLEE_SAVE_REGS_THUNK Git-Commit-ID: 87b240cbe3e51bf070fe2839fecb6450323aaef4 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 87b240cbe3e51bf070fe2839fecb6450323aaef4 Gitweb: http://git.kernel.org/tip/87b240cbe3e51bf070fe2839fecb6450323aaef4 Author: Josh Poimboeuf AuthorDate: Thu, 21 Jan 2016 16:49:13 -0600 Committer: Ingo Molnar CommitDate: Wed, 24 Feb 2016 08:35:42 +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")