Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1665095ybb; Sun, 29 Mar 2020 10:18:39 -0700 (PDT) X-Google-Smtp-Source: ADFU+vujsf3wzjKckYxuNoHrwY96M1r3CurN8YS366syyh0q4t82uSdL38g1TIskROok3//VAAbr X-Received: by 2002:a4a:a60a:: with SMTP id e10mr7046493oom.34.1585502319741; Sun, 29 Mar 2020 10:18:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585502319; cv=none; d=google.com; s=arc-20160816; b=oIKTUMB8dGG/Lw6HhCb5rW6Wsvzeak4VbaQS0p4XAAQVnGIJikFNz5BPhWH7p+x1CF /nFWP8mXu6c92QQkmFlOjfO8PsxnoXqbcbV+luprMlBzbs23GNj0rLg2fbO+R3KgH2XO jdVUmaQDfYLyE1+Wwz8E3L9d2uBtU/eOjpdWYslBMQ130qPaXlWmiLwHAFbZlUw/UQp6 erD8/nLurWi0r5pfEFGpoP8xFsslE21WT9n/NaYxk3hS7EIsXWwmXaE3wDugb5dxJ9Eh I+A1YasWHqcd0pNol/9th7qbTtzmG9JypJnnH61ZG6x7Ml2fF/KwORSWH7W7+Mdgn0Gs xykg== 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=+buOghIefXoqJ85J3krkeYSFnepTic0YgGtBasPJ4hg=; b=Lj8JyoXsj4YcoRc6f13GbY0NCSz1+bvW/dr2IWRfZ3AsMz2b+fV0jFXacdnQSOXedD f/4dEPx1OdZuj4TdCc+U0ahpCyzcYbSiGr3r3fkIWgCddNun12rnxne6YNEEcSvi8Wl1 DlcvKqcYxhhctql32hKTvliP6XkbGYp6hmJg55ey3Jo+YX7ME1ahh0EM2Smq8xkfrkd/ KIDtR0xGY746Eh0PkvkZ550OsuPvzSRSHbtB3HFd7fvBb2eY4ZD0IBeEqTjcWBbQmWgw s/0aEtpOML0Wp1mzz8aixLK41f81tVNQCyWOnnLR07WZzJ6bCachkTs1uD7UkTmetgsS CFTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=LjygP6dq; 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 u135si4924364oif.248.2020.03.29.10.18.26; Sun, 29 Mar 2020 10:18:39 -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=LjygP6dq; 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 S1728310AbgC2RF7 (ORCPT + 99 others); Sun, 29 Mar 2020 13:05:59 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:45773 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727323AbgC2RF6 (ORCPT ); Sun, 29 Mar 2020 13:05:58 -0400 Received: by mail-lf1-f66.google.com with SMTP id v4so11976895lfo.12 for ; Sun, 29 Mar 2020 10:05:57 -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=+buOghIefXoqJ85J3krkeYSFnepTic0YgGtBasPJ4hg=; b=LjygP6dqGb9+8GT2FzA/bAmugtC8lI7rpMSe87n4u40me9GHIY1Gngbtl+B8U5IaYj TVLWwFkFymQmOoCJUk394dJZnQn8gIaSz4H5gVxCy/LWjm1gpN1tnYa2P/eSbDNtZ2tU ZRh9KaElQGki4n/HoiuryLjA4wCqaW1dhiWgY= 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=+buOghIefXoqJ85J3krkeYSFnepTic0YgGtBasPJ4hg=; b=M4GZzCywPN8/x0P1+0AMTRtdR6UchAwZplTA5dHZQYkWDRlxJ9ek3ZmQJqiGLh//io 1tm8KYmzeZCGwaGxoA0cLDuuPP9CM4TyTQLbiliuB9cmarE/WTFL3BK/Kvhmd6DzKrIf n8yS9VecE+p1ml2MZDHhLgfhvwm3K7FXRImvqfzdxoixBdtiBqFZnA6GWAAknytXa+7o YVYYfGAbw77WeNNF/Hy68ZlFEEJwxmTuD/J4kAgTnJlpGQ8mM8jA4IAVVwgkTP6E5gvZ 5QfJp2OZpRCa3b4CXDBuf+w7fDPicYyOxulVYLH8LcNtXxyA1E6b/oEJh+kyg3hAzWAh 0Ivw== X-Gm-Message-State: AGi0PubGCYXRUlduoERdgUpxzPjT/hZhzXEaeGt38otVk2hj1SLMBP/e p2fhI+R/QHx2lEaQl5pmuGwgJzaI1gM= X-Received: by 2002:a19:7e01:: with SMTP id z1mr5638776lfc.196.1585501556038; Sun, 29 Mar 2020 10:05:56 -0700 (PDT) Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com. [209.85.167.48]) by smtp.gmail.com with ESMTPSA id u25sm1372873lfo.71.2020.03.29.10.05.54 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 29 Mar 2020 10:05:55 -0700 (PDT) Received: by mail-lf1-f48.google.com with SMTP id h6so6245865lfp.6 for ; Sun, 29 Mar 2020 10:05:54 -0700 (PDT) X-Received: by 2002:ac2:4a72:: with SMTP id q18mr5795353lfp.10.1585501554562; Sun, 29 Mar 2020 10:05:54 -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> In-Reply-To: From: Linus Torvalds Date: Sun, 29 Mar 2020 10:05:38 -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: Ingo Molnar , Al Viro , Thomas Gleixner , X86 ML , LKML , Borislav Petkov 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 Sun, Mar 29, 2020 at 9:50 AM Andy Lutomirski wrote: > > My incliniation is to just get rid of the __get_user()-style APIs. That's definitely the direction we're going in, and Al has already been moving that way. There is basically zero advantage of __get_user() over get_user() these days. Historically the advantage used to be quite noticeable (one could be inlined and generated nice dense code for repeated single accesses), but with CLAC/STAC that simply isn't the case any more. > (It's possible that some arch code somewhere uses __get_user as a way > to say "access user or kernel memory -- I know what I'm doing". Not just possible - it was what was literally happening in tracing. Except for the "I know what I'm doing" part, where tracing code used a pointer that could be user pointer or kernel pointer interchangeably. Which isn't even possible on some architectures (it just happens to work on the common ones), because the same pointer bit pattern can be either or. But that got fixed, and hopefully there aren't other cases around any more. But slowly converting away from __get_user() and friends should end up fixing them all, since objtool will then verify that you do the right user_access_begin() etc. Linus