Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1873769ybb; Sun, 29 Mar 2020 15:54:25 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtZ52lBj1VkYuwhLuEeARyKi7JS8DjkgrYk7X/Yt6T8JNrgW7G0IaLnkeaP/lQJxPoAX0xL X-Received: by 2002:a05:6830:1495:: with SMTP id s21mr7531391otq.35.1585522465603; Sun, 29 Mar 2020 15:54:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585522465; cv=none; d=google.com; s=arc-20160816; b=oLk+MVXddanjW4YFugGiCkZOZtRTvAdO1X5XsGii493HEIeKNCEAKsrZ7T0XXKoSuh mr0BG2BrKDS6K/pty+p3TxzvDlc3JQr4JLJKZGsvU5cfdWL6HbH54HF/YWJ1snHII7ry yB8DDSl5Ow2rDZV8+wDgtaUNbteufsNK7+/jTb9DV77n6o4JnXwzJgE8KuObBRQsO7I2 1o+fHZv9grnEeO5CqLg+v4ifv6Li/5iw4vGDXj3TOZdb1WetAKSIZfcCHoKazvii2MbY DX80UsE72flVYVHwjA4zvCNn9h5+qAf4QDJXtboTufxlqHaQBb7y6apz3XLK2RRS5doV gn2g== 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=BUl8UKYc4nsp/6S1OBKZwco0VpM6yIv4J8yu81qNB9A=; b=oBHBMshYXxHBJMds891/NH2VMwP0/skNkK61u9oC6wPQYUtmqwe8fDPNs3aNOhE1RO 2rn4Jdnm7NYAAtgV5xz3leXygJ0j7veZEqpbHFh8G/EDqRnlKVoacUoNubX6qgYAMwlx vjl4CYOEQ/mVoNkfgoTO0EXw+mmY2M5s9rsvCpNqnN7bWUwmoPXKICzaXbAlspcvwvGD Ii4RM3JGqQGYwL3v5DNyMp82Pci7c7KeDBp1z9dskPgeRxuWjIOymKVeR60VXnKeYpa1 u7gYWrDft7TJ8POYlF29ysx0xF8jXzUry0rhpj55Knql13ARSzJwrtACoWh4UQjIK3tM sjpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b="A/w2aA+r"; 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 j184si5164903oih.216.2020.03.29.15.54.13; Sun, 29 Mar 2020 15:54:25 -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=pass header.i=@linux-foundation.org header.s=google header.b="A/w2aA+r"; 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 S1729042AbgC2WGo (ORCPT + 99 others); Sun, 29 Mar 2020 18:06:44 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:41282 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728986AbgC2WGo (ORCPT ); Sun, 29 Mar 2020 18:06:44 -0400 Received: by mail-lj1-f193.google.com with SMTP id n17so15992304lji.8 for ; Sun, 29 Mar 2020 15:06:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=BUl8UKYc4nsp/6S1OBKZwco0VpM6yIv4J8yu81qNB9A=; b=A/w2aA+rhJy5+8BagvXzUdEgfGJblH6oT8mRimw3+/aa2XIygwSU1ob1Xm2IMyqjMK bcvA3Tso2LVEUs+qNOgkfaOqk5IRQev6CQ7o4rbKN8TJlh9WDRztDYnYpkiJBKGPNu+h FiPiWhUbQfwH/Ar2QB38jSTNjkKTr58j6ASis= 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=BUl8UKYc4nsp/6S1OBKZwco0VpM6yIv4J8yu81qNB9A=; b=uM483kiJZXldDvvMHDH78a5MR+mMXjN2qA8Ep+HDVXVOZ7WS+6oBcT4IEFt3LRuaa9 lZ3PsDWEyEYdUlFPFmEtnRxbYMILbCQVZpWUz660QkMy7heGANAgrgKz6HMIEiwI56Ln A7SRPFfeMv3GUyNxCkj8iCpJknZfWhvHL0sOEpIBY+ilz+qF0htDuK3jVgTsTw5ZIZ5l DGSnptlRPPh1AAWsVEWvI9W+hiXIKsSENLNqkaX6/31x8mlJyfAADroZ6GcmAGNjfPEW Ff3U8LnIh8to0eM9zpT7BvDs8Z2PWyO1AKqomo97JNUMHoUaXD35Mwc2FyHyy4Ejb0ka YK0g== X-Gm-Message-State: AGi0PuaJkY9COxgHEu4TWTWtxVtX82znh0eAdEYLRnu2VdwPIS6XGyCI w71HONIg3TqChAhd/H9YIWO/Jgg+9mo= X-Received: by 2002:a2e:8290:: with SMTP id y16mr5448911ljg.186.1585519597736; Sun, 29 Mar 2020 15:06:37 -0700 (PDT) Received: from mail-lj1-f177.google.com (mail-lj1-f177.google.com. [209.85.208.177]) by smtp.gmail.com with ESMTPSA id 22sm6006762ljq.69.2020.03.29.15.06.35 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 29 Mar 2020 15:06:35 -0700 (PDT) Received: by mail-lj1-f177.google.com with SMTP id q19so15933003ljp.9 for ; Sun, 29 Mar 2020 15:06:35 -0700 (PDT) X-Received: by 2002:a05:651c:50e:: with SMTP id o14mr5288434ljp.241.1585519595292; Sun, 29 Mar 2020 15:06:35 -0700 (PDT) MIME-Version: 1.0 References: <20200323183620.GD23230@ZenIV.linux.org.uk> <20200323183819.250124-1-viro@ZenIV.linux.org.uk> <20200328104857.GA93574@gmail.com> <20200328115936.GA23230@ZenIV.linux.org.uk> <20200329092602.GB93574@gmail.com> <489c9af889954649b3453e350bab6464@AcuMS.aculab.com> <9352bc55302d4589aaf2461c7b85fb6b@AcuMS.aculab.com> In-Reply-To: From: Linus Torvalds Date: Sun, 29 Mar 2020 15:06:18 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC][PATCH 01/22] x86 user stack frame reads: switch to explicit __get_user() To: Andy Lutomirski Cc: David Laight , Ingo Molnar , Al Viro , Thomas Gleixner , X86 ML , LKML , Borislav Petkov Content-Type: multipart/mixed; boundary="00000000000043f50705a2058c9c" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --00000000000043f50705a2058c9c Content-Type: text/plain; charset="UTF-8" On Sun, Mar 29, 2020 at 2:22 PM Andy Lutomirski wrote: > > On Sun, Mar 29, 2020 at 11:16 AM Linus Torvalds > wrote: > > But that magical asm-goto-with-outputs patch probably won't land > > upstream for a couple of years. > > I'm not that familiar with gcc politics, but what's the delay? No, I mean that _my_ magical patch for the kernel won't land upstream, simply because even if both gcc and clang supported it today, nobody would effectively have those compilers for a couple of years.. > ISTM > having an actual upstream Linux asm-goto-with-outputs that works on > clang might help light a fire under some butts and/or convince someone > to pay a gcc developer to implement it on gcc. Yes, but even for clang, it needs a version that isn't even released yet. And right now my patch is unconditional. It started out that way because the whole x86 uaccess.h files were such a mess, and I couldn't be bothered to fix all the small cases to then have *two* cases (one for asm goto with outputs, one without). These days my patch is much simpler (thanks to Al's simplifications), and I think making it handle both cases would likely not be too painful. And in that case I might just commit it, even if effectively nobody has the clang version installed to make use of it. Anyway, just in case people want to see it, I'm attaching my current unconditional patch. Note that it requires Al's uaccess cleanups, but I do want to point out how it actually makes for simpler code: arch/x86/include/asm/uaccess.h | 72 +++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 40 deletions(-) and not only does it delete more lines than it adds, the lines it adds are shorter and simpler than the ones it deletes. But that "deletes more lines than it adds" is only because it doesn't even try to build without that "asm goto with outputs" support.. Linus --00000000000043f50705a2058c9c Content-Type: text/x-patch; charset="US-ASCII"; name="patch.diff" Content-Disposition: attachment; filename="patch.diff" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_k8dld53k0 CiAgICBVc2UgImFzbSBnb3RvIiB3aXRoIG91dHB1dHMgZm9yIGNsYW5nIHRlc3RpbmcKLS0tCiBh cmNoL3g4Ni9pbmNsdWRlL2FzbS91YWNjZXNzLmggfCA3MiArKysrKysrKysrKysrKysrKysrLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0KIDEgZmlsZSBjaGFuZ2VkLCAzMiBpbnNlcnRpb25zKCspLCA0 MCBkZWxldGlvbnMoLSkKCmRpZmYgLS1naXQgYS9hcmNoL3g4Ni9pbmNsdWRlL2FzbS91YWNjZXNz LmggYi9hcmNoL3g4Ni9pbmNsdWRlL2FzbS91YWNjZXNzLmgKaW5kZXggYzgyNDdhODQyNDRiLi45 ZThiMDRkNDU2MGEgMTAwNjQ0Ci0tLSBhL2FyY2gveDg2L2luY2x1ZGUvYXNtL3VhY2Nlc3MuaAor KysgYi9hcmNoL3g4Ni9pbmNsdWRlL2FzbS91YWNjZXNzLmgKQEAgLTI3OSw2NSArMjc5LDUyIEBA IGRvIHsJCQkJCQkJCQlcCiB9IHdoaWxlICgwKQogCiAjaWZkZWYgQ09ORklHX1g4Nl8zMgotI2Rl ZmluZSBfX2dldF91c2VyX2FzbV91NjQoeCwgcHRyLCByZXR2YWwsIGVycnJldCkJCQlcCisjZGVm aW5lIF9fZ2V0X3VzZXJfYXNtX3U2NCh4LCBwdHIsIGxhYmVsKQkJCQlcCiAoewkJCQkJCQkJCVwK IAlfX3R5cGVvZl9fKHB0cikgX19wdHIgPSAocHRyKTsJCQkJCVwKLQlhc20gdm9sYXRpbGUoIlxu IgkJCQkJXA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