From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.54 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796233310; b=ebEE46e6kziZ/Ei+vz7psNY7UpcIDx5Uon2B1xNKSaH8tpznSCA4MtB5XrpL9mRpElH9 PX6JCE33kNlcPmrZaiC+E5WDuolyh674WZJkdbYXYbT6TkczhZ6XUd3WVM//TjNHiVPwN iXTkHN9698By9kRTEh7TN6xxpaxLTAboucxxMbnvmFrHooP6SKQF8K9vGOGGzUqRYUm3Y ksBxcOBhlOLFJkHtd/8bZkBzPciR2wHyQzipHSPMhLuqrjpZp58j7IYrFkqyo4LMi6vPM NjzMQZSEfopwvrop6NxXu/AwHlsjxcceGU+SFFQS3sCpI5Pl2O/6bGaFZsbw3aU8YVQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796233310; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References:X-Mailer: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=pM28KMoe8Q0tPhUdyP4mXyIlBNFtRGaB+TycHkrIdF4=; b=pXoI1CpLc//s/y8Q0EBWevHamLwwBTny68JeJD8xwOsOLPHIK/ooT/IRq43zww1H4Zaw UTvwX/n9c44B0bBfqcar7EERmUZO2q5kztYA8PyNLF89lavAoSiBqdOKFq6EUSeICOKtr DROBM3EFP2yIPWZ02DtRh+t6h98yYxnXd/qM4nDXIdVtb1Bb86unn6CE44s2vzQX+Qopu 8wDdvzJCbNU7xzFSH3THBftfzAzht4WbGAckRlkxoeSFpLo1z1gPoxHCEJCbTrYIX6G1e DBH/pk12TkaiUsLSYy0MgrrFzx3k91Xy155BO/GJCYOZhEo6XbX2cMLmvZVipOVDfrA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=pouGG28L; arc=none smtp.remote-ip=209.85.221.54 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BCDB6606A691 for ; Wed, 2 Dec 2026 17:41:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org BCDB6606A691 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=pouGG28L Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-4a358881793so7168959f8f.0 for ; Wed, 02 Dec 2026 09:41:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796233308; x=1796838108; darn=vger.kernel.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=pM28KMoe8Q0tPhUdyP4mXyIlBNFtRGaB+TycHkrIdF4=; b=pouGG28L4llvZhZpZFwbwAnKCVGvhAS9ealHSHVtZlXhbZONQ8cEZuxEqnQvBCP/8D /c04xjiho7d8XiUBsXmq0cYwPinr7IXjdDY7shazKRsFi2eaFpY2ggKmfE6HGbPWWsTR m0TMBeRg2Vo167MsW+7f37srM0ur1P+A65exiXVyyA0RUD2ONqZJuSc17f+58idfP4dm diXDcMgemMlPafTwGBsDwmI0F/6q5Qxs5F0ddvGAGc9773AThP3lL7ptyAbl4tgOMa8D TIpxOPF1Vx5UwDffoKLQOaZnu5UIuyv/jD4WZ6ijwdc39bEKSeX6skplvrmqZM+Hx1Nj eQUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796233308; x=1796838108; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=pM28KMoe8Q0tPhUdyP4mXyIlBNFtRGaB+TycHkrIdF4=; b=wqKR3Ci97nAJu9WcMO0h8wVpw72z4bqITVv5ao6XlUfrVvMe/hDdVDroxrdTXNPACO MPNNvP75BV5OEXdbYjOPW3SaZCV5HEeaUV1upSRUMs7aHw8yNLaYC0dlwHNVDypBm19i /P8p7RHJyoFXQyZwID/MbLeX677nB72PK9y4eQNBljamsVo8+EOWvp8hO5NWfo06UmpP NYey16mQZT891XE0pJStdreDBK+vwY4/90/pugsVymkyTQgjj9tqedp40ZpzIR5Xi24P LdD/OH6KfhwK/g+zXC0X8pcPO3vkoagIw4GsQgt9QR0Ms3643stdk45N8lTOFHs/ROe7 mcoQ== X-Forwarded-Encrypted: i=1; AL+hErFc8ux8cNpfKMRR5GoaeXJ6lRv+b3c1F4xEWJ426YSh86j9/R33GxpL02BHGBFddZZK4TSo4tjZJD0GrEhH@vger.kernel.org X-Gm-Message-State: APuU4Z9Q8NlbbVaw4qVOUBZ+smo+JRciA0sihIZs9/uzGjMyeap6MHi+ ykUa4/Ri6FWL35MVzAeuVe67A1kT2tttLg8YVcAOeiWk7oQwstciDT6t X-Gm-Gg: AZFdTZdjUGF8HYaUnnB78+S/qPA15rmGJonoBnBeT05Hm2BMXT+OCls/SHxGUafcUHQ RgxnFyRWZDvt3ZRhuE3fcOZfNh89VJR6k0Gw15ZSoPoOTILLtLFiAHgmKu3UtVj7MWTj1I92996 59c/pvhtgE4aeYC1YOatmHihGUjWDEp69n5Tyv+YN9WGYkF2XwNyhIsD2QumtBSwsQ3UOE9fnu7 11UJgmLL4PUHMmtcX7YtOILeMrMQiNEsEjoK9HZ4cowNnsvRE3ktZYeCpHWHrOIUPe3Egzra0iy i4zySJ2MuYwQUmgZUjnH13OewWXQWmy9itkymjt56JG0aVblizJT7ekvy1nXCAR/GpIRfdkLgqe F6+JxKpvuy94aM1RmADD29t4su1W99p5Gg3UljzkJxSh4J2uevi6eH7icKi0xyerr1umXlYfPue XLDEqmAcu+dWb1Q7P8f+hqAJ0ZhYIOM5GNamAsM/xi2vTXXHuQW1HlewEj3jppI9H3sMuaFmw8+ Jph9oRRtVQG+Cmt+uf5uacYITQP8WicU09UIn8xUQU1s263c04rRr7tgZbwaBkfqf0TGzCSREP4 HIxLwYOPc4SzXPawuo/pxsTAvj3K63vdtgMmIKdEG6CUX7cDe+3L7rL0qUhsA/Pd X-Received: by 2002:a5d:64ef:0:b0:4b3:e605:15d6 with SMTP id ffacd0b85a97d-4b3e60516a7mr66762343f8f.55.1796233308128; Wed, 02 Dec 2026 09:41:48 -0800 (PST) Received: from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4b70c05b9desm54842436f8f.54.2026.12.02.09.41.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2026 09:41:47 -0800 (PST) Date: Wed, 2 Dec 2026 17:41:46 +0000 From: David Laight To: Dave Hansen Cc: "Christophe Leroy (CS GROUP)" , James Houghton , Andrew Morton , Alexander Viro , Arnd Bergmann , Sean Christopherson , Paolo Bonzini , Jim Mattson , Jens Axboe , David Hildenbrand , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, Catalin Marinas , Will Deacon , Paul Walmsley , Palmer Dabbelt , Albert Ou , Madhavan Srinivasan , Chris Zankel , Max Filippov , Dinh Nguyen , Simon Schuster , David Sterba , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Eduard Zingerman , Kumar Kartikeya Dwivedi , KP Singh , Matt Bobrowski , Peter Zijlstra , Arnaldo Carvalho de Melo , Namhyung Kim , Steven Rostedt , Masami Hiramatsu , linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, linux-btrfs@vger.kernel.org, bpf@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, io-uring@vger.kernel.org Subject: Re: [PATCH v2 00/12] uaccess: Refuse and warn on user accesses when current->mm is NULL Message-ID: <20261202174146.2a41aabb@pumpkin> In-Reply-To: References: <20261202023920.595207-1-jthoughton@google.com> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf) X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Wed, 2 Dec 2026 07:24:13 -0800 Dave Hansen wrote: > On 12/2/26 07:04, Christophe Leroy (CS GROUP) wrote: > > Also about the masked user access path, the principle of that path is to > > be branch-less, the whole purpose was the remove the test/branch from > > access_ok(). With your new check it is not anymore branch-less > > Branches themselves are OK. Sort of - unless they get mispredicted. They then cost ~40 cycles on my zen-5, and I suspect that is typical. Even without the spectre v1 issues the 'masked' variants are so much better. Oh, and then there is the cost of reading current->mm to consider. That might be a cache-line miss. > The problem branches are around access > checks because they potentially allow transient execution paths to skip > the checking. > > In this case, the new check forces a return before any accesses happen > or any bounds checks are done. If the new check was incorrectly > speculated, we'd just have transient execution doing what the > *architectural* path is allowed to do today. > > I _think_ that's OK, at least from a spectre v1 perspective. But it > could definitely use some more eyeballs on it. I think you'd need a user-controllable address that passes the access_ok() check but then reads from somewhere the user isn't allowed to access. Unlikely to be possible. David > > I do agree with you about the code size concerns. >