Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4902962yba; Wed, 8 May 2019 04:56:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqzmBmberFD0+tdO6IrUvvpCVpxYWan7OheS7qV1NVw4TZYHlGwbmJvF5KbfhrYHybCUP4Bb X-Received: by 2002:a17:902:e28a:: with SMTP id cf10mr6051107plb.77.1557316603026; Wed, 08 May 2019 04:56:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557316603; cv=none; d=google.com; s=arc-20160816; b=tPnLUtK07sgiBBYhb5WoYogbCRmLi5cTUCwNBKEoBbZX3HZWbiaYpO0LBL8SPJvqXP jRekyB5AG53ThqYd5Ono4uADx7elw8epjl8WfEkKvdJAJMWLPtwCb49y32ljk9wteH4d pPEMYlWf+ax4qHSdhvqG2wWahKmCZveTF2aGaffkpw+HTYycdjMYcSkQJZWTKJ6zIpCP eGJwKX0n6+Buqb3p06unssG18xkU5Fp0CvPvcZYLzbCJhB7iLs9uhAwybcN6JiPV27gi utZLK8IMpCWJH5E+V4UF1o7bICVJFUx08pvk1ZwcwVjj+2ied+1Qv4YzB8RbgQjyTUan mI+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=F53TDIAdK6kbXItzZpMgwchr6ZaTrZFw/x9tn/uANKM=; b=fVVlC0zNRH6F4vRV258cVhnw5PhBxXaDRzd9K+nnj7lREIFc7dy4ywK3LIgeaiQbIR 7Zmu8zdhTjJZlZ5z8KAcFI2ka/J4fXu5xTd2amxqV5jEazycdbwhZuwtBGlt5fVhV77v mAlrKM8gNwCGsbN8/s9mkSUtOoiKXqn4wZfAqXRQDJayF2YJLIov4/D2n2kIQX8qbjIk jx3XwA7LtykbJWrZAggym773XiLW387uMdIndmhHaj28c6VEXrAegz62weZwTCPPzo5o oxpxYP74dYLO2ldHKxxJTgICXGL082zRE8Y6xUW91fLPxUZCwQgirQNQGPV/wFXVzKuq HFWw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m13si7798774pgh.67.2019.05.08.04.56.27; Wed, 08 May 2019 04:56:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728350AbfEHLyZ (ORCPT + 99 others); Wed, 8 May 2019 07:54:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58632 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727909AbfEHLyZ (ORCPT ); Wed, 8 May 2019 07:54:25 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DC2C4307E04C; Wed, 8 May 2019 11:54:24 +0000 (UTC) Received: from treble (ovpn-123-166.rdu2.redhat.com [10.10.123.166]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7D89E5D9C8; Wed, 8 May 2019 11:54:18 +0000 (UTC) Date: Wed, 8 May 2019 06:54:16 -0500 From: Josh Poimboeuf To: Peter Zijlstra Cc: linux-kernel@vger.kernel.org, Linus Torvalds , Ingo Molnar , Andrew Morton , Andy Lutomirski , Nicolai Stange , Thomas Gleixner , Borislav Petkov , "H. Peter Anvin" , x86@kernel.org, Jiri Kosina , Miroslav Benes , Petr Mladek , Joe Lawrence , Shuah Khan , Konrad Rzeszutek Wilk , Tim Chen , Sebastian Andrzej Siewior , Mimi Zohar , Juergen Gross , Nick Desaulniers , Nayna Jain , Masahiro Yamada , Joerg Roedel , linux-kselftest@vger.kernel.org, Masami Hiramatsu Subject: Re: [PATCH 2/4] x86/kprobes: Fix frame pointer annotations Message-ID: <20190508115416.nblx7c2kocidpytm@treble> References: <20190508074901.982470324@infradead.org> <20190508080612.721269814@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20190508080612.721269814@infradead.org> User-Agent: NeoMutt/20180716 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Wed, 08 May 2019 11:54:25 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 08, 2019 at 09:49:03AM +0200, Peter Zijlstra wrote: > The kprobe trampolines have a FRAME_POINTER annotation that makes no > sense. It marks the frame in the middle of pt_regs, at the place of > saving BP. > > Change it to mark the pt_regs frame as per the ENCODE_FRAME_POINTER > from the respective entry_*.S. > > Signed-off-by: Peter Zijlstra (Intel) > --- > arch/x86/kernel/kprobes/common.h | 32 +++++++++++++++++++++++--------- > 1 file changed, 23 insertions(+), 9 deletions(-) > > --- a/arch/x86/kernel/kprobes/common.h > +++ b/arch/x86/kernel/kprobes/common.h > @@ -6,14 +6,15 @@ > > #include > > +#ifdef CONFIG_X86_64 > + > #ifdef CONFIG_FRAME_POINTER > -# define SAVE_RBP_STRING " push %" _ASM_BP "\n" \ > - " mov %" _ASM_SP ", %" _ASM_BP "\n" > +#define ENCODE_FRAME_POINTER \ > + " leaq 1(%rsp), %rbp\n" > #else > -# define SAVE_RBP_STRING " push %" _ASM_BP "\n" > +#define ENCODE_FRAME_POINTER > #endif > +#ifdef CONFIG_FRAME_POINTER > +#define ENCODE_FRAME_POINTER \ > + " movl %esp, %ebp\n" \ > + " andl $0x7fffffff, %ebp\n" > +#else > +#define ENCODE_FRAME_POINTER > +#endif We should put these macros in a header file somewhere (including stringified versions). -- Josh