Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp569709yba; Thu, 9 May 2019 02:30:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqwnGtFD1JyrVhRXmiU5C9g0s8rgT95daScWR8ETET9yJ0dnzW1tyBokMPOaA+i5/+FJcxtO X-Received: by 2002:a17:902:7689:: with SMTP id m9mr3593471pll.274.1557394236031; Thu, 09 May 2019 02:30:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557394236; cv=none; d=google.com; s=arc-20160816; b=QuzxhmKOYB0zNZyHymcDxflcvGl4CNweEYwL6Ta+qxp2c/UWXp1TeaoLkWFX9LILJq y4qyRPcmMF7DwUoI4oVhz3eWsuQ9z8q647OVW0VOpO8UGBhNKCbeIM15/c5s7PU3fI+8 xcAf5nXXN2z3FpNag4m1cqu17A42uTiqzaX4QspCn9FHOw1mG6TaFVq2ycpRUlqk0LmT itffyoZ1Jo2CBF/BJsuAoHpyVTvDfvhsMJMcmAjPx5cae6J3BJlL5u8Pz383QPLsY4bU xUn7OzGZuSyDVntOGXLb6tkWbAtAJXDAqxebRwtb1qbIda0hozyFQDl/A8p9tfxF3b7y e14w== 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=mh9wv/1YPcHFRafECtG9vJbg2xftnq1zTlCLnERm8MU=; b=qI7H2LBQnjEHHLAyChnwunCC8GhjH72fyHSGH6wk/3SpT9yrMM1SW7AKQ0Wb/TiG8s ESGqMZWI37MFrZrpr4zjEsq/SZpc+Do+quDw+OKtziK/Yx9L2MzpBnh42mDex4mrOZXg Oqfc+tAQ1mjQ1bIlj2xqsgEFueCIMu3QU7esJelh3OFTgja8LnzyG0R79ISdzyUXSC6m /l1/og3x+QjludEA7evt8UxxvjRKxxdLLq5TxJ1YZYU2cbP9BkyMMuq2kCN3G2pyFZnI /+bxRaNqvq2r8cdyEF3v2M6/yuoZdG2DihlV0wL1Vqh8M+E1/EdJx3njIkcHwIOG4neJ hAxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=WcNQDklE; 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 b21si2195495pff.35.2019.05.09.02.30.19; Thu, 09 May 2019 02:30:36 -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=WcNQDklE; 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 S1726546AbfEIJ1z (ORCPT + 99 others); Thu, 9 May 2019 05:27:55 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:53116 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725826AbfEIJ1y (ORCPT ); Thu, 9 May 2019 05:27:54 -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=mh9wv/1YPcHFRafECtG9vJbg2xftnq1zTlCLnERm8MU=; b=WcNQDklEwzguV0Z8pENKDWZGy q0ZhOFX23ffs/Z0ITznG7dFVyKrFXBU1mzR0rEH9ph2nFYgCZgEoCJ8NYQ8PiM/HXqGsgzPAN/t2N hOf8xuAdOAgu3dZ/mA1bKacT3QmaI64yJcgDYx5eKV17UA8zIVQ2/DraLKQGFyAC2SYX3GzBp5L5P B/25wkTsE2uUU6lYGClvMLTLCup3Jp7aN28XJ1dnTFAC+LMBIe6SRJ78XHXCppfLNkn32F2FEJbh1 72aI8gkU0C2UZxwH7dZ9qVXTFo6XheLrzDxnH03Wv3NafxemGD8/KGKZ2+JNxgaFYSZ9/2w15WaPk /8Im51tRw==; 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 1hOfL2-0004y6-SB; Thu, 09 May 2019 09:27:41 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id C2EF029CD4D51; Thu, 9 May 2019 11:27:38 +0200 (CEST) Date: Thu, 9 May 2019 11:27:38 +0200 From: Peter Zijlstra To: Masami Hiramatsu Cc: Josh Poimboeuf , 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 Subject: Re: [PATCH 2/4] x86/kprobes: Fix frame pointer annotations Message-ID: <20190509092738.GK2650@hirez.programming.kicks-ass.net> References: <20190508074901.982470324@infradead.org> <20190508080612.721269814@infradead.org> <20190508115416.nblx7c2kocidpytm@treble> <20190508120416.GL2589@hirez.programming.kicks-ass.net> <20190508124248.u5ukpbhnh4wpiccq@treble> <20190508153907.GM2589@hirez.programming.kicks-ass.net> <20190508184848.qerg3flv3ej3xsev@treble> <20190509102030.dfa62e058f09d0d8cbdd6053@kernel.org> <20190509081431.GO2589@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190509081431.GO2589@hirez.programming.kicks-ass.net> 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 Thu, May 09, 2019 at 10:14:31AM +0200, Peter Zijlstra wrote: > struct ftrace_regs_stack { > ftrace_func_t func; > unsigned long parent_ip; > }; > > void ftrace_regs_handler(struct pr_regs *regs) > { > struct ftrace_regs_stack *st = (void *)regs->sp; > ftrace_func_t func = st->func; > > regs->sp += sizeof(long); /* pop func */ > > func(regs->ip, st->parent_ip, function_trace_op, regs); > } Alternatively we can add things like: static inline unsigned long int3_emulate_pop(struct pt_regs *regs) { unsigned long val = *(unsigned long *)regs->sp; regs->sp += sizeof(unsigned long); return val; } And do: ftrace_func_t func = (void *)int3_emulate_pop(regs);