Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4913147yba; Wed, 8 May 2019 05:06:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqzFIpOnCSsi1YQMSrkthYikijyn4V4zi5G2cVJFyxCA8ORxNpsMyr4SjQUgsQME+VvvXIld X-Received: by 2002:a63:5b58:: with SMTP id l24mr44918785pgm.139.1557317183130; Wed, 08 May 2019 05:06:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557317183; cv=none; d=google.com; s=arc-20160816; b=tnGpfZ4oX/Efqli6YvOS/yGKqyu1VtrGTJR3BSaRWBf9BMyqpNdPsyuWPGCTNUWJ4T pGbYDW65EP0HiGPlLY57qi47NhXN2hwg8sZIJc89fNgXhkMLBo6UxZffcJ6DWQvZPMYF yin3/j3le0HvacfJWmCvhDuGcVWrg1poaGj+K/fpik+XXZcAIJs1d9zgCnFw12huHUj+ +QdriyKd+hiTgmJftfGEPUbylyc72XTdIrNztLRS9c4gIA4+Mi96imF7n2ISCouKfOV5 2D8LT5Ve1PzfPut1i2DmlvsrcVp8H2ZWJkvNMVf6tjbbEMFiWEINhrhN2Z77vlx+dZDD nMVQ== 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:dkim-signature; bh=a4N5d3+J61zEDzUpaHhBlkj2KG/wlTG6nB4CxBf7TaY=; b=Nbge55/GvIbZMvDqBcyo4ZZrEc1pM8DQeraVJ8fwLGRK6cnhqZCokrWC+Ii70qPV48 CL8gJzqKMEJ4RnHoAgvBVQdF8S1JmqEJpyJkmiKDoBcImRmK6blZe6bRC6eFvqDL92jU pXUbPVry9LzxTAnoCSQEmnekXyl8abOxC3kj5VGs79Rhjx9ZOx5WwIZWZF5ReJsDoHkd XCjwxeHUWvEsn/cwQmkYq5i6W5AbS7qLSQKxZc1zX+oDvG6NTLp5Ptl0O10EWPFbgEj4 wTL5NdzEDeZbsC3W+UjzelT4gttiT4QhLo5xW9DJOhMvHSJEAAb7jYZvEcf+VaEJ7rZ/ 3tSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=BbdHQHOT; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h5si20538219pgq.224.2019.05.08.05.06.05; Wed, 08 May 2019 05:06:23 -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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=BbdHQHOT; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728383AbfEHMEk (ORCPT + 99 others); Wed, 8 May 2019 08:04:40 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:53426 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727614AbfEHMEk (ORCPT ); Wed, 8 May 2019 08:04:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=a4N5d3+J61zEDzUpaHhBlkj2KG/wlTG6nB4CxBf7TaY=; b=BbdHQHOTPB6xFc6bCqoYQED5j rtNPCDjTaX0yyk9wuTFPSvTjzz7MMpdmMzq3d8bucAspIGuxMNBAdR2jDrhFMA8WA60yVWSh5u2yE AG8B9ucMoe14oAsSs+AJk6Ptc4vE+m6lbnRUagcxJQuyP3j1Qu9o8SacF4syS6//WvKXvYXtcBUpS Nz3aSiiohUvJCvFQO+4FeGUO+9rEANKIiMPfTvQIWFgskSAb+sgUgoqeIz34t+zHZV2NfdaXfcEhv swkGxNjqsYLb0rnlrl9PVGyxIUj88H5MkGMBGMQ6Vz8ExQA/X0xVsYPoHh4553aEcV9CxZikaaX5r 8E5SZGohw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hOLJ4-0004TC-BS; Wed, 08 May 2019 12:04:18 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id D0BE92029F882; Wed, 8 May 2019 14:04:16 +0200 (CEST) Date: Wed, 8 May 2019 14:04:16 +0200 From: Peter Zijlstra To: Josh Poimboeuf 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: <20190508120416.GL2589@hirez.programming.kicks-ass.net> References: <20190508074901.982470324@infradead.org> <20190508080612.721269814@infradead.org> <20190508115416.nblx7c2kocidpytm@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190508115416.nblx7c2kocidpytm@treble> User-Agent: Mutt/1.10.1 (2018-07-13) 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 06:54:16AM -0500, Josh Poimboeuf wrote: > 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). Probably a good idea. I'll frob them into asm/frame.h. Do the x86_64 variants also want some ORC annotation?