Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754045AbbHNJMH (ORCPT ); Fri, 14 Aug 2015 05:12:07 -0400 Received: from mail-wi0-f172.google.com ([209.85.212.172]:38214 "EHLO mail-wi0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752133AbbHNJME (ORCPT ); Fri, 14 Aug 2015 05:12:04 -0400 Date: Fri, 14 Aug 2015 10:11:59 +0100 From: Matt Fleming To: Josh Poimboeuf Cc: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, linux-kernel@vger.kernel.org, Michal Marek , Peter Zijlstra , Andy Lutomirski , Borislav Petkov , Linus Torvalds , Andi Kleen , Pedro Alves , Namhyung Kim , Bernd Petrovitsch , Chris J Arges , live-patching@vger.kernel.org, Matt Fleming Subject: Re: [PATCH v10 19/20] x86/asm/efi: Create a stack frame in efi_call() Message-ID: <20150814091159.GA2865@codeblueprint.co.uk> References: <89cbfadfe41061aeeacb56a4b384adf82f272e97.1439521412.git.jpoimboe@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <89cbfadfe41061aeeacb56a4b384adf82f272e97.1439521412.git.jpoimboe@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1846 Lines: 57 On Thu, 13 Aug, at 10:10:40PM, Josh Poimboeuf wrote: > efi_call() is a callable non-leaf function which doesn't honor > CONFIG_FRAME_POINTER, which can result in bad stack traces. > > Create a stack frame for it when CONFIG_FRAME_POINTER is enabled. > > Signed-off-by: Josh Poimboeuf > Cc: Matt Fleming > --- > arch/x86/platform/efi/efi_stub_64.S | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/arch/x86/platform/efi/efi_stub_64.S b/arch/x86/platform/efi/efi_stub_64.S > index 86d0f9e..0df2dcc 100644 > --- a/arch/x86/platform/efi/efi_stub_64.S > +++ b/arch/x86/platform/efi/efi_stub_64.S > @@ -11,6 +11,7 @@ > #include > #include > #include > +#include > > #define SAVE_XMM \ > mov %rsp, %rax; \ > @@ -74,6 +75,7 @@ > .endm > > ENTRY(efi_call) > + FRAME_BEGIN > SAVE_XMM > mov (%rsp), %rax > mov 8(%rax), %rax > @@ -88,6 +90,7 @@ ENTRY(efi_call) > RESTORE_PGT > addq $48, %rsp > RESTORE_XMM > + FRAME_END > ret > ENDPROC(efi_call) You mention that stackvalidate will recursively validate the frame pointers in all code paths. Since we're calling into firmware code from efi_call(), we don't need to do anything special here right? I'm guessing stackvalidate would just stop since it has no way of knowing the target address of the %call instruction, but I just wanted to check (especially since the firmware ABI is different). Reviewed-by: Matt Fleming -- Matt Fleming, Intel Open Source Technology Center -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/