From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.53 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796233310; b=GjWc98Y7y3kQdmI+ib9hk/1GXvByxd16E2TS0NhgvEzXwJ8hHw+VasxhyXWikur8n+ph BBNQirbd8lHHsrJUCMgwLPJB89QRKyRGljusit6eSBJrREIS9aG5k/KfJnbN7zoi51I/W eJZoEf6yehj2cGCm0iYU/+DBTxk4QBnI3csw2Volka4ydelDfCLmC+tLXLcfMS0Ts5p2J Zhd4K3I8yfqNiWb+9NNoPF4N4actwBqv/TeFu2KhPEgBO1laA6wMlx+0xRTSI5LYF3Cr7 nLJ9ffzY96hv9r1tWAOSY5e8aIERFSyxKZIrWO9b4FqdgIiiMxRH3iBPuxs/Q/UHOTA== 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=RCT/JiBi9jmXmna/gpwbEMLtjhxwhQYMXypzonVs7Xfv8aYiyyA/sUcXOrfZ0euKHxPA JCT19JFM5rERO40GdPVRaUG5IbesHh9j/LKuqDKogz9HMG7TpcS0I7fJyU1VK/6bmT1PR ZsBsAvCvlVb6hb6fNllZNt9m+G9jva0ePiO80dSlpl4tw93YZAacsCPwxt1YsN8+wA3Ep EwrVo+YANYLtBCA2GPYLW054BKxmgIqccSPmz7Q/yhtlXE6WsA2lxk5309OFDzy3fG43T Vzv7f5IWZjVSeGLIUv1C1MgkSl6hKCQW+XlE4esXfTPgd1v7hPXNyrlgJn+zLB0PaOw== 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.53 Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (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 B2CCE606A322 for ; Wed, 2 Dec 2026 17:41:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B2CCE606A322 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-f53.google.com with SMTP id ffacd0b85a97d-4a358881793so7168958f8f.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=WCFQm8WU4qM7Hz4hPToL+9AtASE5HDyH9cqd7bocS/vX4pQNFZg3bfQS0DbAO/XK1X hFk2VZB+O2aPfMpEUvsuPt3jw4wZsHYrfNRx5PsSIcS6OjPW4WIcN3Yvtp5CuyhhdSua S3a/SPITu1xozZMH6g4XghweeOLScpyy4LeWl3KZsbKXJE6ktj9JUDXoT2BfEdfrAEkz zRMXNbB6XsKzzxZ90ZLa+zCGxjeq0DAGbNtycOFUUaxKf9+zPhNPCGQanut+GXUwCPc3 jCF/v23+rIdm398xiAbHejPU7MM7UOi7++hoYxKpk5u6GWTLcbCF2ba7iGCFYUyvtonx zDJw== X-Forwarded-Encrypted: i=1; AL+hErEAYjRSUZIcaaSXPPX5obIK4TDeFGOSGphvVox2C1PrxfB6QCT3lFt153FVMO2p6GjnmYzcDK5NxjfklpsH4gv4rn0=@vger.kernel.org X-Gm-Message-State: APuU4Z9zGnjwPznwrbbxYT5+es/kOQOQyRig0obIJk5xUsJhtpRVnH+7 ZAHb7vhAexg/nG8JqxUUW75Z8Yr/zU9s9RYbfTcG3/jjzjhShzMvoyWJ X-Gm-Gg: AZFdTZc29ZmXNXhCnwmsaq5LMObf3vzccuMkgCd2X1sWlrlC1v6PdVL0sf0iwIiL3tG co9e7OSP7LiUiJwwLDVV7gx7Qw6BoExe+84uaBbZH4/6T9/erJYIFBWqPHV8XpwAqcjTgOouzsS 2AtR0z6C1DpbbTz/839wn+VBMheqVDwvGUGqXwt2K9zU2gHIJycpJ4NvEb/AUxP7b9wR+vei9hD CBk3OxEeDfoaImYl2o1BsD85EuZirrKSHIUI8EvI+EZCg9+RGE/eTsESwwH1cQiKEZOjjtBwaGi KLZxUBUv5I75SSMlxnnWcDtmAiilYmVnCQ/sDjXcd/a9MoAj+JJuLZJouTLhzwRpD5kAqr/KOqS IlcyeTdn3F5H935LiFS9Q63VctFcs/S67Zxr7I6Wq5WzgYko9RHiNwkqMXqdvwF4JFS2rAFkFts 3KNjB7jwJsATnwb6Lxd4HD8UY6ykLgRLC77wUWi6wwU5bwSSuqi53eXH0jnJZ4mM1vIj9arE7nn 3JmCC6HGrvXwjb9F34ZAJwMg1dDrPvtBm6Id2Csbvh3SwmpJDUf6znwOaKVr8iV3DkAVo3jHiB1 7cCYoj/qcOvjHr2vJHIFmfWnaSMzUQSknIWuQilteiX27CLd/SaENelYLHbhBntC 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-trace-kernel@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. >