Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp127561imu; Mon, 26 Nov 2018 08:47:23 -0800 (PST) X-Google-Smtp-Source: AFSGD/X3eCL8LxnvRQQ5kkM1SppeZ6auEBATJikM2/Xe7W9f7di0BXAnb7ONHDOU3xVbOa6mVep3 X-Received: by 2002:a63:f844:: with SMTP id v4mr25382174pgj.82.1543250843770; Mon, 26 Nov 2018 08:47:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543250843; cv=none; d=google.com; s=arc-20160816; b=pyPsdPQDyXJTh//8/TwVVhopsJsNZJuK37KzZKHj2Y+tIntNsyhsiHoEB8O16YOwRG a7ykQuWxzdjI1QCgtvB25AtJcagHrvt2ZTBeOTdncnpP9sTPoUQNRupTHC+R1rp1tF3h VXpQnYRHtIs6HflZB7ObHG2JYQiUi5hAi12O6+Delfkexg9pbcKJ/CGrWk0mxX1IQgGs lujCFd9oiv530JPJLpngRXTIxwRLNjyrVetbzdHowtLq2WpF/XFR51cwt41z0kZwgx/i DpkV1tQakTNHFVyA3Wi+/bV31vqabyTZxaHrcaR8YVtb5t5ObLL5kLw7ZqM+hfkHAb5o BB6Q== 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; bh=PycduuFfmqpEJfM32CZpKXWJaKTOfI0Jp3UEpHp/9Ls=; b=z1pn0KsFWdLROpm0YJhjN+ypAcQ5etSBBwFWR3A/e9qeX5/ZSjk/P3YjxVqON9y82t ZymT+A57yfmqkRojNl27ee4hQeMtNMIEMUVDIlveWhrCUO1Mn1dzlyQ2AcJuzYH4wRss 0DT3RRibm1f6ez82VMy5O2/D+pXIGsEYFgVWL294pdErb6qTGDm0y6hJYBF0A8fwywnh qu9R86qPDl55yvVebY2L+bAbwu2ZARaAbmoji7O27lVko84BGsRmCtki3rc3Vn0N2DH/ Im6PUv1oeK/cLHtYYa65zr9V5PNgxHQKUdmRw4EGiEKx1DsQL2DELvp/OCXhDHYBlXzc gYTQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a6si739760pfo.90.2018.11.26.08.46.18; Mon, 26 Nov 2018 08:47:23 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726870AbeK0DjQ (ORCPT + 99 others); Mon, 26 Nov 2018 22:39:16 -0500 Received: from mx1.redhat.com ([209.132.183.28]:27520 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726462AbeK0DjQ (ORCPT ); Mon, 26 Nov 2018 22:39:16 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A53C6307DAA3; Mon, 26 Nov 2018 16:44:37 +0000 (UTC) Received: from treble (ovpn-121-105.rdu2.redhat.com [10.10.121.105]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C69985C229; Mon, 26 Nov 2018 16:44:33 +0000 (UTC) Date: Mon, 26 Nov 2018 10:44:31 -0600 From: Josh Poimboeuf To: Peter Zijlstra Cc: Ard Biesheuvel , 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" Subject: Re: [PATCH v2 4/4] x86/static_call: Add inline static call implementation for x86-64 Message-ID: <20181126164431.o2y65t3nbhyl2shn@treble> References: <62188c62f6dda49ca2e20629ee8e5a62a6c0b500.1543200841.git.jpoimboe@redhat.com> <20181126160837.GS2113@hirez.programming.kicks-ass.net> <20181126163923.GT2113@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20181126163923.GT2113@hirez.programming.kicks-ass.net> User-Agent: NeoMutt/20180716 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Mon, 26 Nov 2018 16:44:38 +0000 (UTC) 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 05:39:23PM +0100, Peter Zijlstra wrote: > On Mon, Nov 26, 2018 at 05:11:05PM +0100, Ard Biesheuvel wrote: > > 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? :-) > > I was leaning towards: "prime", but I'm not entirely sure that works > with your case. Maybe we should just go back to "poison", along with a comment that it will not necessarily be poisoned for all arches. I think "poison" at least describes the intent, if not always the implementation. -- Josh