From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS,URIBL_BLOCKED, USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C31B3C04A6B for ; Fri, 10 May 2019 12:32:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 952292173B for ; Fri, 10 May 2019 12:32:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="u0ZEekF/" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727459AbfEJMcJ (ORCPT ); Fri, 10 May 2019 08:32:09 -0400 Received: from merlin.infradead.org ([205.233.59.134]:38244 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727276AbfEJMcJ (ORCPT ); Fri, 10 May 2019 08:32:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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=CJ/RgzG6/23EoFY4Hg/6HnLzf+zlaDTQsjadNt+mqsc=; b=u0ZEekF/39iPW4i1B4OoREnhB LveLsEtgqTkR9onnpN5dQph4/uGjda6xOD3siFjtuQ0ZUfcu5UfEY2Q0HXj9HR4LpDNBk/BX3CJDA VJPgJy6qpCwNNmS2gLm8FF9EK6/OS/pcMyp8BFP88usSnY95qgJAsig6MAXoKkW3dJE+HYn9GsZwI 48fuuMh+m7gCMgD8pCO2shRAhQsW0eG2uNQ+8VC+4di2fbbIGXsVpwemHS/YVwv1jR+jswrFG9+D7 NT7mPNgSsHRy4C3MG3nsUoeAsfxunqeetUYvtJiBPNUr08JsKhhGjOFq6s7377MT4uvyPFWrPfOVc /eoDUpefg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hP4gW-0005dv-Uw; Fri, 10 May 2019 12:31:33 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 94E2D2029F1F3; Fri, 10 May 2019 14:31:31 +0200 (CEST) Date: Fri, 10 May 2019 14:31:31 +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: <20190510123131.GU2589@hirez.programming.kicks-ass.net> References: <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> <20190509230106.3551b08553440d125e437f66@kernel.org> <20190509171416.GY2623@hirez.programming.kicks-ass.net> <20190510135831.c4ad309c68fc254f819194fc@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190510135831.c4ad309c68fc254f819194fc@kernel.org> 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 Fri, May 10, 2019 at 01:58:31PM +0900, Masami Hiramatsu wrote: > On Thu, 9 May 2019 19:14:16 +0200 > Peter Zijlstra wrote: > > Ideally also the optimized kprobe trampoline, but I've not managed to > > fully comprehend that one. > > As you pointed in other reply, save/restore can be a macro, but > each trampoline code is slightly different. Optprobe template has > below parts > > (jumped from probed address) > [store regs] > [setup function arguments (pt_regs and probed address)] > [handler call] > [restore regs] > [execute copied instruction] instruction_s_ ? The JMP to this trampoline is likely 5 bytes and could have clobbered multiple instructions, we'd then have to place them all here, and > [jump back to probed address] jump to after whatever instructions were clobbered by the JMP. > Note that there is a limitation that if it is optiomized probe, user > handler can not change regs->ip. (we can not use "ret" after executed > a copied instruction, which must run on same stack) Changing regs->ip in this case is going to be massively dodgy indeed :-) But so would changing much else; changing stack layout would also be somewhat tricky.