Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1618682yba; Sat, 27 Apr 2019 03:30:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqzGCSta9bUHOq4zR/LJQ5RhXuDYkckTJZz/h7U6I1smzays59zEPiNOTiwVyCZC8m3ueRWO X-Received: by 2002:a62:b411:: with SMTP id h17mr16866707pfn.61.1556361008442; Sat, 27 Apr 2019 03:30:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556361008; cv=none; d=google.com; s=arc-20160816; b=F1pqhQ6VDKq8YDuiLKBYZXO/b3rMVtelO6SDxDWcA2y+EhMN/SfnmumqTjmEyoSRpQ OMbCNh+feWGgHAOHtTdPEEzf/u0yZLdHr15Tcdq2ybWI4BALAwUsaudyR2rL6K9xIWrU k3CsyeHW0EZBEvFlKfjTb/LK6xQ8doYFrOTL76YA6rwdKwpS8Nz6O4CKExIBiYtoT+TW GISunzpfE3VTWO8+OIaL7GY0ZsqDZtxe51hPb7q7n6QlW6sSJvafO+M1eau4gH6Q+8kR Y7h1TEJdiUlrpyfkYC4wWKgf+fpRlS2ctUmhgT5vewAEOL/Xw9n8GJOezxnkXBVrYQGa UdOA== 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=e/QQuLy0GymXijIDKvEURPIf1XYN89dwF9MEo0vwOts=; b=a7+xan2wgwIgEar10nhGTWx8bY1qe4jGAZ0r+D7IS7ooxOdXmlHQ79APCDeQNGYZ1g 52jPZ//RazRSCUpDA0S8k3o00TNzRTTsV9BszGfZU4uNrOqomZbO6xs1odQ/R9cYzAzJ +ssgSCQU9Lo1iBeWYNBYxvoW4/pDEtq+gcG1UoaaxjpXaZI9VWXS2gli3z48bHYdxqJI fDuDnQaXzDXB3fbGTd/jWnIf8Z44LWW3acCobB5n2XNrT01PU3MPZvStJSmTyCImtn5K YjHdmB6NvkC287tIkfKlc7iHaclub1oyNRnK2E3CaHUdOjUtEYLt63yujdLCS8jVmjAH xPvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=HviJb4ae; 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 f1si28920298pff.158.2019.04.27.03.29.52; Sat, 27 Apr 2019 03:30:08 -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=HviJb4ae; 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 S1726071AbfD0K1t (ORCPT + 99 others); Sat, 27 Apr 2019 06:27:49 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:43816 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725871AbfD0K1t (ORCPT ); Sat, 27 Apr 2019 06:27:49 -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=e/QQuLy0GymXijIDKvEURPIf1XYN89dwF9MEo0vwOts=; b=HviJb4aePK+o7aNHbssZBSoYs 3Y7fomHk2VgqEhypKzge0QazqbQ0BjOrHh2APtMwaw/H3V5MyWqH3HFYUi3wqyxqYQHuKs9QZmy8q dVYT3RcYHjf2XSitar03r9kddwVuUzyj4qIL+e6zg3ZzFlLddI+8EkM8aJY1AtY7xdF8EM0UOxgBC CHriXRCiB6g0SKx1pPnlPcCv3IrpeeYdq5BZ3mC334RlXw4IASSgjhFPyziXm2K/C6I0Fo+rnL0k9 ocUsnSDMw5Tv+Cjoys4Ls1DrHN2obfnp74/aytaROF+W9XLipqjvkKpZchtqpAuMcxvopym7KXMuY 4Kad4xDxg==; 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 1hKKXr-0000CF-Lt; Sat, 27 Apr 2019 10:26:59 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id A370029D22407; Sat, 27 Apr 2019 12:26:57 +0200 (CEST) Date: Sat, 27 Apr 2019 12:26:57 +0200 From: Peter Zijlstra To: Nicolai Stange Cc: Steven Rostedt , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , x86@kernel.org, Josh Poimboeuf , 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 , Andy Lutomirski , Joerg Roedel , linux-kernel@vger.kernel.org, live-patching@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH 3/4] x86/ftrace: make ftrace_int3_handler() not to skip fops invocation Message-ID: <20190427102657.GF2623@hirez.programming.kicks-ass.net> References: <20190427100639.15074-1-nstange@suse.de> <20190427100639.15074-4-nstange@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190427100639.15074-4-nstange@suse.de> 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 Sat, Apr 27, 2019 at 12:06:38PM +0200, Nicolai Stange wrote: > ftrace_int3_handler()'s context is different from the interrupted call > instruction's one, obviously. In order to be able to emulate the call > within the original context, make ftrace_int3_handler() set its iret > frame's ->ip to some helper stub. Upon return from the trap, this stub will > then mimic the call by pushing the the return address onto the stack and > issuing a jmp to the target address. As describe above, the jmp target > will be either of ftrace_ops_list_func() or ftrace_regs_caller(). Provide > one such stub implementation for each of the two cases. Yuck; I'd much rather we get that static_call() stuff sorted such that text_poke() and poke_int3_handler() can do CALL emulation. Given all the back and forth, I think the solution where we shift pt_regs a bit to allow the emulated PUSH is a viable solution; eg. I think we collectively hated it least.