Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp88970imu; Mon, 26 Nov 2018 08:17:21 -0800 (PST) X-Google-Smtp-Source: AFSGD/UgpDO4gw8deX8covfhb8YdyaxXBReBVOhT1mG7qkVPlkPXUNBezLCo2RvQuAcrflvI/BsM X-Received: by 2002:a17:902:8a8a:: with SMTP id p10mr19038913plo.50.1543249041006; Mon, 26 Nov 2018 08:17:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543249040; cv=none; d=google.com; s=arc-20160816; b=wCWdoS7UvzdNxxxdasbea02TpfDyxzMPtLtT1epdHRwBt2ZKFgJJ4SkEd5NkSLWm7c xp8jbC9XA5zIcNL7AlaTy14V4svIDJqH73dg6PqdIo+iPtXju6XxWfHyObPjAh8IZBx1 06g7TxU/aJAjpo2E9bpLVtnwYbhrdAALVIlqKcMU9Dp9MWp/GGW+Slwrt0kHCXf+eAJ0 dlr1NktJu1gWrVSoS6DGwZd7j53o7pCFAl+0YSdnsKSHzb1S9wQqzDesHJq2uSvIBubU n4XgtzefvLen7Ryl2253UkE9SeUecs7xpVN959pro+aS4tyuHSyuIO7XyZQr0jVRepig 8W4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=LFa602G6GtEH4ohV2+bgcsHqu0THqSdL/T4lwbW+8YA=; b=JScNB+LmRkoNlfgXQLOLbXL1pYdBpFWkAbGlVnvudmC9qu0M0IPneNGWCKf+uIdQsR Pt6HEYh5n6Vvwy+CRKOp5f/bB84l1ygGtXfXOZr/OnG5oBW8gC20o4nC75RqjTknnkIA bVF4pN+ah7pp+APfctVTg4pAStU5qEjQF2gycSQHCVID7EHe/XF+N53Yo24Dm4SDVQoa cLPvxjlnDIxJNhTG6+UCcNWGDvkPBF9nKD1HSpp6i22FOkvLHVL/skGf0l1q2DlW1Zlt ItQCluNx2aMXYe+f8lL+GjPe83lK6VM2KYLgh5EurQ3ZlVk3HuAdK/DQaKoaVR/FNEu2 hFzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OOh5R36n; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o1si609597plk.257.2018.11.26.08.15.37; Mon, 26 Nov 2018 08:17:20 -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=pass header.i=@linaro.org header.s=google header.b=OOh5R36n; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726410AbeK0DFu (ORCPT + 99 others); Mon, 26 Nov 2018 22:05:50 -0500 Received: from mail-io1-f68.google.com ([209.85.166.68]:34854 "EHLO mail-io1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726224AbeK0DFu (ORCPT ); Mon, 26 Nov 2018 22:05:50 -0500 Received: by mail-io1-f68.google.com with SMTP id u19so14366462ioc.2 for ; Mon, 26 Nov 2018 08:11:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=LFa602G6GtEH4ohV2+bgcsHqu0THqSdL/T4lwbW+8YA=; b=OOh5R36natz+r1vpNaaaIjSEWLHgK9vALa2K8zy7k2ytYnMsuOuoZXElx7zwyXvl4g BRQWceGR0V9sqftdiHqB6MDHhOQkAGKQbF4/FVNl7Ts57wrl29AtchAuUYqxws5B8x6K kuvcUQ7yvTOedBcRBoeu0GEosBGztQ+bHarzo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=LFa602G6GtEH4ohV2+bgcsHqu0THqSdL/T4lwbW+8YA=; b=gSx0mX8NCtlKmkKa8wlNh+5Ys1IAor+KBZLAlxQa9OgtRiA5YpVP+NHLard7ylUX0r F5xtphZXdzzbt61I0NlOC8UtQ697DoTXjDRYF9cqIkw7VNDCbUTF7xBQyCoW0iQUIb8+ Or4SXvfCWRXtWRtfNdV+HQJwGzGKwWS8XIiYAxxMG7o2TynZ6aGuDUJOXnm2770W7Vps vxh6v+agLEOUXpfe0oGapa+cjPNBW0Iq304SYclnmgTA13IqGptfPuMw7Z5R6HxLdG+N 0N1xAERyV1HcnpmKA86MZyDQUJo1++up/vX92iK7lVJBbaLHFdSMpCrIVmZB4RSwAKLM p5Zg== X-Gm-Message-State: AA+aEWaR/aAkLuTCQCD9QW0MzL1kJ9FZQ9yAqZu9wcMEdgeLs936Z5MX PwUFWNKg94vfXs0axpBjFhtKDPGX0Eoi1EgaQ2lrNw== X-Received: by 2002:a5d:8402:: with SMTP id i2mr12688974ion.173.1543248677044; Mon, 26 Nov 2018 08:11:17 -0800 (PST) MIME-Version: 1.0 References: <62188c62f6dda49ca2e20629ee8e5a62a6c0b500.1543200841.git.jpoimboe@redhat.com> <20181126160837.GS2113@hirez.programming.kicks-ass.net> In-Reply-To: <20181126160837.GS2113@hirez.programming.kicks-ass.net> From: Ard Biesheuvel Date: Mon, 26 Nov 2018 17:11:05 +0100 Message-ID: Subject: Re: [PATCH v2 4/4] x86/static_call: Add inline static call implementation for x86-64 To: Peter Zijlstra Cc: Josh Poimboeuf , "the arch/x86 maintainers" , Linux Kernel Mailing List , Andy Lutomirski , Steven Rostedt , Ingo Molnar , Thomas Gleixner , Linus Torvalds , Masami Hiramatsu , Jason Baron , Jiri Kosina , David Laight , Borislav Petkov , julia@ni.com, Jessica Yu , "H. Peter Anvin" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 26 Nov 2018 at 17:08, Peter Zijlstra wrote: > > On Mon, Nov 26, 2018 at 07:55:00AM -0600, Josh Poimboeuf wrote: > > +#ifdef CONFIG_HAVE_STATIC_CALL_INLINE > > +void arch_static_call_defuse_tramp(void *site, void *tramp) > > +{ > > + unsigned short opcode = INSN_UD2; > > + > > + mutex_lock(&text_mutex); > > + text_poke((void *)tramp, &opcode, 2); > > + mutex_unlock(&text_mutex); > > +} > > +#endif > > I would rather think that makes the trampoline _more_ dangerous, rather > than less so. > > My dictionary sayeth: > > defuse: verb > > - remove the fuse from (an explosive device) in order to prevent it > from exploding. > > - make (a situation) less tense or dangerous > > patching in an UD2 seems to do the exact opposite. That is my fault. The original name was 'poison' iirc, but on arm64, we need to retain the trampoline for cases where the direct branch is out of range, and so poisoning is semantically inaccurate. But since you opened your dictionary anyway, any better suggestions? :-)