From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755350AbcEQJq7 (ORCPT ); Tue, 17 May 2016 05:46:59 -0400 Received: from mail-wm0-f45.google.com ([74.125.82.45]:37454 "EHLO mail-wm0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751303AbcEQJq6 (ORCPT ); Tue, 17 May 2016 05:46:58 -0400 Date: Tue, 17 May 2016 10:46:55 +0100 From: Matt Fleming To: Linus Torvalds Cc: Ingo Molnar , Alex Thorlton , Linux Kernel Mailing List , Thomas Gleixner , "H. Peter Anvin" , Andrew Morton , Peter Zijlstra , Borislav Petkov , Josh Poimboeuf Subject: Re: [GIT PULL] EFI fix Message-ID: <20160517094655.GB21993@codeblueprint.co.uk> References: <20160516144648.GA22999@gmail.com> <20160517090434.GA21993@codeblueprint.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160517090434.GA21993@codeblueprint.co.uk> User-Agent: Mutt/1.5.24+41 (02bc14ed1569) (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 17 May, at 10:04:34AM, Matt Fleming wrote: > > Now I'm wondering whether other users of FRAME_BEGIN/FRAME_END make > this same mistake. Coccinelle might be able to detect it perhaps. A quick bit of sed turned up the code in arch/x86/entry/entry_64.S, which looks to suffer from the same bug, /* rdi: arg1 ... normal C conventions. rax is saved/restored. */ .macro THUNK name, func, put_ret_addr_in_rdi=0 .globl \name .type \name, @function \name: FRAME_BEGIN /* this one pushes 9 elems, the next one would be %rIP */ pushq %rdi pushq %rsi pushq %rdx pushq %rcx pushq %rax pushq %r8 pushq %r9 pushq %r10 pushq %r11 .if \put_ret_addr_in_rdi /* 9*8(%rsp) is return addr on stack */ movq 9*8(%rsp), %rdi .endif With CONFIG_FRAME_POINTER=y 9*8(%rsp) is actually the value of %rbp on entry, not the return address.