Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2724247imu; Thu, 29 Nov 2018 09:14:43 -0800 (PST) X-Google-Smtp-Source: AFSGD/Xpb7HhgImQjymd+3n1FXNyv6fOWqlUw8Mc6IhgaI69uK5P1cgFIso8spnXm/mLcnBOs1yl X-Received: by 2002:a17:902:d03:: with SMTP id 3-v6mr2330021plu.66.1543511683156; Thu, 29 Nov 2018 09:14:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543511683; cv=none; d=google.com; s=arc-20160816; b=loByixCU0ydW05FTyKBlFZwamFg8YTkZ8VImc6dN5LpfT8HsZeH7ZIFzKCG7PpT8sM 7fgQzf1PS6ab3MxbkwhKsuzoucLg7byR9mz6BNRr4NBCMj4V3mH6X1jOpfg2z7eDLw6i MJoX+MVs22AwIEZOybGndTsqc5PeLhVYQBGzuof6l+shvpUaHFg9ROwkFW6CqIeqHwzb g4WtuL+ErZIkqgTw/pies7PpSmM+hsGO9IxIktl1E7eIO4ujrAhHT1QnvUW1P1lrola1 4y+TjBlltb/gk5cFELgm+l5gtwbudg9c5p5YrYMDiKf+MzoOLE0ZIo/+PrapMptaW/Zm jZDg== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=29Kg+KvH4wUA02mtK4n49p0R30CA2bPy+vdVJ7IfiNI=; b=0YSbZbeyDqF55OGymuLgzkz4PA7p+HhfPnBssMEZQtKp+WmuTVkQv9eWk7FRABHPtg 1onC+Cl0PBbPpAloyOaLHkNGmTHJ66MeTzRp48snlqYWwnWcWWQ8R0MNs/Gyd7r0rS1+ y1oF2n4R+B19uHyqYJgEC8dZcCVnt02OwEykgMmGfNU8TD4ulZGEPFoYrSolsqROdnEg 4lC85WX+TelnN+owEMhxRBBZk+gF2V8Ak3/n3s63xh/L/qxzQ71yarKBCu8jQQKQI/CH PpOwW7y1XMBf/9nfMCfw4p06UtHNBfkW8hcpz5yPeuwy3cLZTo00YpBIM8vuOxvfBnKy rODw== 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 p16si2620394plr.31.2018.11.29.09.13.26; Thu, 29 Nov 2018 09:14:43 -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 S1730289AbeK3ERB (ORCPT + 99 others); Thu, 29 Nov 2018 23:17:01 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44066 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726736AbeK3ERB (ORCPT ); Thu, 29 Nov 2018 23:17:01 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 37CCBC05000A; Thu, 29 Nov 2018 17:10:57 +0000 (UTC) Received: from treble (ovpn-123-4.rdu2.redhat.com [10.10.123.4]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 27314620C8; Thu, 29 Nov 2018 17:10:52 +0000 (UTC) Date: Thu, 29 Nov 2018 11:10:50 -0600 From: Josh Poimboeuf To: Andy Lutomirski Cc: Peter Zijlstra , Andy Lutomirski , X86 ML , LKML , Ard Biesheuvel , Steven Rostedt , Ingo Molnar , Thomas Gleixner , Linus Torvalds , Masami Hiramatsu , Jason Baron , Jiri Kosina , David Laight , Borislav Petkov , julia@ni.com, jeyu@kernel.org, "H. Peter Anvin" Subject: Re: [PATCH v2 4/4] x86/static_call: Add inline static call implementation for x86-64 Message-ID: <20181129171050.iio53bw67fbiwzud@treble> References: <20181126200801.GW2113@hirez.programming.kicks-ass.net> <20181126212628.4apztfazichxnt7r@treble> <20181127084330.GX2113@hirez.programming.kicks-ass.net> <20181129094210.GC2131@hirez.programming.kicks-ass.net> <20181129143853.GO2131@hirez.programming.kicks-ass.net> <20181129163342.tp5wlfcyiazwwyoh@treble> <20181129164914.GA9027@hirez.programming.kicks-ass.net> <0FDA053D-7ADC-4F42-AEA5-99DA155FCED0@amacapital.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <0FDA053D-7ADC-4F42-AEA5-99DA155FCED0@amacapital.net> User-Agent: NeoMutt/20180716 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 29 Nov 2018 17:10:57 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 29, 2018 at 08:59:31AM -0800, Andy Lutomirski wrote: > > > > On Nov 29, 2018, at 8:49 AM, Peter Zijlstra wrote: > > > > On Thu, Nov 29, 2018 at 10:33:42AM -0600, Josh Poimboeuf wrote: > >>> can't we 'fix' that again? The alternative is moving that IRET-frame and > >>> fixing everything up, which is going to be fragile, ugly and such > >>> things more. > > > >> This seems to work... > > > > That's almost too easy... nice! > > It is indeed too easy: you’re putting pt_regs in the wrong place for > int3 from user mode, which is probably a root hole if you arrange for > a ptraced process to do int3 and try to write to whatever register > aliases CS. > > If you make it conditional on CPL, do it for 32-bit as well, add > comments convince yourself that there isn’t a better solution I could do that - but why subject 32-bit to it? I was going to make it conditional on CONFIG_HAVE_STATIC_CALL_INLINE which is 64-bit only. > (like pointing IP at a stub that retpolines to the target by reading > the function pointer, a la the unoptimizable version), then okay, I > guess, with only a small amount of grumbling. I tried that in v2, but Peter pointed out it's racy: https://lkml.kernel.org/r/20181126160217.GR2113@hirez.programming.kicks-ass.net -- Josh