Received: by 10.223.148.5 with SMTP id 5csp6306074wrq; Wed, 17 Jan 2018 12:02:28 -0800 (PST) X-Google-Smtp-Source: ACJfBosnRYmJIHAqG2xJMSS/aWcPqnRocEqmwD24cGbcdlylUaP5LBAbUJVG5Na1jbsxwYmaN3jr X-Received: by 10.99.49.200 with SMTP id x191mr17311068pgx.394.1516219348675; Wed, 17 Jan 2018 12:02:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516219348; cv=none; d=google.com; s=arc-20160816; b=V2+jHul1eBwc3lFxbv40uB9+GvI3eTub0Da551CmVDcvzm5GquLvz5PcdK26u5VSmR raU6vssM/FrOaDRMwfleeiv150FKPZjlZP+PV0nYz7V22SKs1z0MBaQ/EPU3BqHqjfOr ffrEqQTIs4FwbCw0UIh8G+NHiahwLE6DrmfijJn/DhGi2DoUd4ioKE3LpuIR25tvLm27 GvUpNCaIh7TOcIAPeUl6CMqQsmB/JIeDiRRxq31RPu5ouyYGffzisBJDtrf+3PyZzWD7 43G8ji8QvIxJf+Ndbq6spT146FJw83xUeS6en2pmpuHH8NG4+7p5ew6HjNsrzJE9mLFL AGiA== 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 :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=1gLpw5uUavjyB/t9eQ5E6wEZVP8hxoRdrHxHqHIBhMQ=; b=DQUyNxGSH2PTCTHv+2mPXFL1LpAUtrvH/wkUstcBMkrWUegauvk6s22TJlXgdNjQoV 0BKJ3ENFf4k4WvO+SW7UVayOvMsTt2rwa9YDtglOVlvoF43uF6JkMJxvZtw8tvi5/2IB zcmCoaTwGYDM0iBGOn2c++h6aEkRs/TDLip0ATEL90rTc8M8ossRb+7Z/JsM1lzxklZi Y3eJYN62BhLM0vdiVQQ9Up0+KkmEtjbOUMfRa0pcSjk1Elbfut+WNmI4J4sapBz2Ldzd ruw5VAwFSZLB56tMA5gyoJGMLncV1NGJQvL58Wr/NZIzkO0738aqhbJpX8R+C+wkFDWh m0Ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=r7ESB7wO; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a33si4955492plc.187.2018.01.17.12.02.13; Wed, 17 Jan 2018 12:02:28 -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=@google.com header.s=20161025 header.b=r7ESB7wO; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752306AbeAQUBj (ORCPT + 99 others); Wed, 17 Jan 2018 15:01:39 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:40325 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750830AbeAQUBh (ORCPT ); Wed, 17 Jan 2018 15:01:37 -0500 Received: by mail-wm0-f65.google.com with SMTP id v123so18243844wmd.5 for ; Wed, 17 Jan 2018 12:01:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=1gLpw5uUavjyB/t9eQ5E6wEZVP8hxoRdrHxHqHIBhMQ=; b=r7ESB7wOMeAnLDj1I1YbnaIcedb8rCyOsK9UPgvJCTjhA1XNp3RI6R/9lbJfMnPHsS 5a5RUADPLX73AZ3dCI7A0i4aKYRZvAAJ6J652UD91QONU8cjb11/fv7ljtjzOrVBdDaq qkQiq9q/1bkcg+L0QIdFuBi06FYYG1UM926N+ChbelrjchDOeGdexW5rprd5niYY3nNz LIoF/CzHecNGP/G2oqHrPFHOIca0JntJNlIoxieoit8m58ecDW6jHayQo2t2LhuNXtt/ rM4wkQJp4m5fUULpHw6CnwC1Gm7lA0M9k2j7qFdszLIm8OwEsT89oddet5uBJad+J3FC NJ7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=1gLpw5uUavjyB/t9eQ5E6wEZVP8hxoRdrHxHqHIBhMQ=; b=PQ/UVLRS4rCgxlXlFN0z+gjOPjyLYNhG0ChltmbvN+sZEAGt5zM0aGi5J/olaQrMKM ZibCzP+fEtxihkw2NfIO+PcbA0jYKiNvu/kS37h8zQDvuHcvJDVD4DBdRTZSnB+YpBgd mdo0q+yTr2KXrOvducEpI0r1wguxbzEVBRMF7tQTjWkU+9cHa2IuXfnFaPLU5Drl+4t/ tFqWIKnFpPG5exrvTmoX+ropsZH1F2dRsc5QPfgDlg+VjREhoQ35oQEYAIomaK8Ytw36 yvxoO8vlnLMAoKKL6GLRSKkNZ6zyfSwR0TnPW2CqpNjJ8pf2Bw6JQLHa0Ab4Eb5Qg2bK YJcA== X-Gm-Message-State: AKwxyteIuW/KZkgwSd1T0LAEw6vJ+RhQOmh2nW9sKlK6ckv6OCH6Hy4B /6ac0jPRZlc71GRzxD6v3RRAJ0Uu/ePzzyvjcm00Eg== X-Received: by 10.28.154.67 with SMTP id c64mr3327963wme.125.1516219296099; Wed, 17 Jan 2018 12:01:36 -0800 (PST) MIME-Version: 1.0 Received: by 10.28.147.15 with HTTP; Wed, 17 Jan 2018 12:01:35 -0800 (PST) In-Reply-To: References: <151586744180.5820.13215059696964205856.stgit@dwillia2-desk3.amr.corp.intel.com> <151586748981.5820.14559543798744763404.stgit@dwillia2-desk3.amr.corp.intel.com> <1516198646.4184.13.camel@linux.intel.com> From: Eric Dumazet Date: Wed, 17 Jan 2018 12:01:35 -0800 Message-ID: Subject: Re: [PATCH v3 8/9] x86: use __uaccess_begin_nospec and ASM_IFENCE in get_user paths To: Linus Torvalds Cc: Alan Cox , Dan Williams , Linux Kernel Mailing List , linux-arch@vger.kernel.org, Andi Kleen , Kees Cook , kernel-hardening@lists.openwall.com, Greg Kroah-Hartman , "the arch/x86 maintainers" , Ingo Molnar , Al Viro , "H. Peter Anvin" , Thomas Gleixner , Andrew Morton 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 Wed, Jan 17, 2018 at 11:26 AM, Linus Torvalds wrote: > On Wed, Jan 17, 2018 at 6:17 AM, Alan Cox wrote: >> >> Can we kill off the remaining users of set_fs() ? > > I would love to, but it's not going to happen short-term. If ever. > > Some could be removed today: the code in arch/x86/net/bpf_jit_comp.c > seems to be literally the ramblings of a diseased mind. There's no > reason for the set_fs(), there's no reason for the > flush_icache_range() (it's a no-op on x86 anyway), and the smp_wmb() > looks bogus too. > > I have no idea how that braindamage happened, but I assume it got > copied from some broken source. At the time commit 0a14842f5a3c0e88a1e59fac5c3025db39721f74 went in, this was the first JIT implementation for BPF, so maybe I wanted to avoid other arches to forget to flush icache : You bet that my implementation served as a reference for other JIT. At that time, various calls to flush_icache_range() were definitely in arch/x86 or kernel/module.c (I believe I must have copied the code from kernel/module.c, but that I am not sure) > > But there are about ~100 set_fs() calls in generic code, and some of > those really are pretty fundamental. Doing things like "kernel_read()" > without set_fs() is basically impossible. > > We've had set_fs() since the beginning. The naming is obviously very > historical. We have it for a very good reason, and I don't really see > that reason going away. > > So realistically, we want to _minimize_ set_fs(), and we might want to > make sure that it's done only in limited settings (it might, for > example, be a good idea and a realistic goal to make sure that drivers > and modules can't do it, and use proper helper functions like that > "read_kernel()"). > > But getting rid of the concept entirely? Doesn't seem likely. > > Linus