Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp367400imu; Mon, 26 Nov 2018 12:03:36 -0800 (PST) X-Google-Smtp-Source: AFSGD/WsPE0bCe2uehdkm0Gb9RuSBgGJ/gpufdbQwW/fuDOr/7nsqHh4fKJVbJj8trE5XNRPTmsx X-Received: by 2002:a63:a112:: with SMTP id b18mr26423166pgf.440.1543262616738; Mon, 26 Nov 2018 12:03:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543262616; cv=none; d=google.com; s=arc-20160816; b=06qgDZYxbG0YrNhMGlkKdICICfIKiyENvKsrxBU6zM3+Dxasey3SeFSTW+/vDVhpA4 uo4cHiX4m2K2oLhaEYzdczmiWx77F/ct86qZBVKDPE6FJMbVbIQZXGUwn9mLBfhc+4XL M/PM+8gsnZVvuRZYUHyFcCxZ0n9mzlPMaznh12DlBFg48r1bEsWjDAfv+IcieG2V/i9U rIKUbq4flpif9TAzmVutT+cHMgqEf1RDMmMKht21JIqVag+FC0XRQBKV1BvFhf5xiVZU 6z37/vTjsqLA1BOX/e1LzuuLq4pelTyqPfhRt26xtTomC8lWZKvNDNO38JZefcBazuI7 KNpg== 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=hw554VldoyK5bRBi8Tr1Wot585O+P5V5cizP6fB/5b4=; b=gShrVWonhySZm88tRQo0+AlHjybWbkIaIlXSyWHrgxiMHR3ZDCYsNwPtqnm6uChZ2l vmBUQTjSvJ5o1YDFLXH2Gy4Jx/JkgcPShPwc2dG88QS/x5duUCHy9fATHpV0/EyjUAko O0qwW60awEAejD5YDhnIiLq6ZnDS52/xKELPFL0r031Voa0K7I4VMDyiYWzBwt592P/y NrxiunR+s7cTN5EQdgr3jcP6l2XfAYYIkrqJ2WNLIYztl/MsdKs9+AniOxDT2zHXl/s2 uq9IeYiysVLjxt8Zm3entTOhccZlMXjPh+LPxRVj7mqpnV7ws9Z9RhMaLGRxtgoAT4CP /eeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=HbjTCqUQ; 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 j7si1350904plb.91.2018.11.26.12.03.16; Mon, 26 Nov 2018 12:03:36 -0800 (PST) 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=merlin.20170209 header.b=HbjTCqUQ; 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 S1726985AbeK0G4e (ORCPT + 99 others); Tue, 27 Nov 2018 01:56:34 -0500 Received: from merlin.infradead.org ([205.233.59.134]:42760 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726253AbeK0G4e (ORCPT ); Tue, 27 Nov 2018 01:56:34 -0500 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=hw554VldoyK5bRBi8Tr1Wot585O+P5V5cizP6fB/5b4=; b=HbjTCqUQsk4raET+6eOsfo9ve cfcU29DeGfvAVR9salMqvkzv6XaLcnzBXtJ9UR9JKAYt4kixUaVEqDn/JUkvtowKn+qbHfS6cfLMp k5II2jlGb2OiAMUoiQ7OzqdRfvbNVlyDPY88EjzPleNIN/xQ8F0mdYALQlzwNXI515iZa8MxAQtgi WHa/Ix+ZYwkzFAzYChPUZ//t/4DX6Z2EZiRj8oE2vrbvhBHnaYJVB5Bma+Xgry+Ra2VIE/rymM6my GGpn5au2LnBkHYpqi7cynW1h52Zct1B8Z35SlpN5ON+3N0qpLBnWmaBEl10gnjdzdZQxgQjwPnhNu pjHoi2cEA==; 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 1gRN3w-0003OY-GV; Mon, 26 Nov 2018 20:00:56 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id CA71D2029FD58; Mon, 26 Nov 2018 21:00:53 +0100 (CET) Date: Mon, 26 Nov 2018 21:00:53 +0100 From: Peter Zijlstra To: Josh Poimboeuf Cc: x86@kernel.org, linux-kernel@vger.kernel.org, Ard Biesheuvel , Andy Lutomirski , Steven Rostedt , Ingo Molnar , Thomas Gleixner , Linus Torvalds , Masami Hiramatsu , Jason Baron , Jiri Kosina , David Laight , Borislav Petkov , Julia Cartwright , Jessica Yu , "H. Peter Anvin" Subject: Re: [PATCH v2 4/4] x86/static_call: Add inline static call implementation for x86-64 Message-ID: <20181126200053.GV2113@hirez.programming.kicks-ass.net> References: <62188c62f6dda49ca2e20629ee8e5a62a6c0b500.1543200841.git.jpoimboe@redhat.com> <20181126160217.GR2113@hirez.programming.kicks-ass.net> <20181126171036.chcbmb35ygpxziub@treble> <20181126175624.bruqfbkngbucpvxr@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181126175624.bruqfbkngbucpvxr@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 Mon, Nov 26, 2018 at 11:56:24AM -0600, Josh Poimboeuf wrote: > Peter suggested updating the text_poke_bp() interface to add a handler > which is called from int3 context. This seems to work. > @@ -760,8 +761,10 @@ int poke_int3_handler(struct pt_regs *regs) > if (user_mode(regs) || regs->ip != (unsigned long)bp_int3_addr) > return 0; > > - /* set up the specified breakpoint handler */ > - regs->ip = (unsigned long) bp_int3_handler; > + if (bp_int3_handler) > + bp_int3_handler(regs); > + > + regs->ip = (unsigned long)bp_int3_resume; > > return 1; > Peter also suggested you write that like: if (bp_int3_handler) bp_int3_handler(regs, resume); else regs->ip = resume; That allows 'abusing' @resume as 'data' pointer for @handler. Which allows for more complicated handlers.