From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.46 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796233310; b=EV9vM/+tPSW0P7mnfTEcyZlWgzE5DpeEHv7iaWCQPmjRwbpbEeyAZAoFaV1hrvBUFHHC +5f/Fw+RUSig5ro6DgvSjQ8XsNY1lsGPYwTvBax/TkyyNfiooFzrxvdEhVPOZ7eVDxxKy /xhBSkDOSGfgvbCnj2CbTe9kG/iTxPehQgZo6soInYgiLGrQdsFeKThJyVe6qsH1aH/2V gVW7MiMX3canNFAueIcLpSLlq2LknCg7cUsa/zdJ7azGKhJhLwngb2Cbwg4dQNvnT8vej N3rqjfkx5yopSmT9qetDXNRNv1dxAVzrsq325qxjD51xV93gmuwmTnXmgKg9ELd8O6Q== 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=5mNpXJuJJ6U9Z2fXqYxEXcAQGqOPVn7tPw6UMyoQRQ+lUwrgtOTfRDw4xT5UMePSwW4v OwuYoXCfl6I4ivDQJDfkCzKScIkZSSeLxZW4UXMWmqCFO3fjTH9EdLEprrTr6mAadY+rT 1bDjSyazjm+XQvMEB6QnAj8fZgJqY7kx8Umn0RszjVLxE8ClxcfHGL8cY/uG/i+JmU6sh BDRaKnbj4X5mqGtyQf11vCP/LBpD7xQY8IdszI8udrmk/1re91+jOwXi9HMkulaUIZnh7 /e+DuPXxdQzq2QYQnKmP2vwI940ChKAaTOVd0c+Mu5p+e22KDboph+SkJ4nexpvTK9Q== 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.46 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (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 B2E0B606A33E for ; Wed, 2 Dec 2026 17:41:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B2E0B606A33E 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-f46.google.com with SMTP id ffacd0b85a97d-490d59c3f0aso6213297f8f.1 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=SI6YPBMkCggNlbJwGkBpLRmsq0rvH7IqcJ24IGHTs6krqb4Apmq+JYyu5b6d+L24lc ZMd7qDF/M8W5P3A5Of9JNs2FLMww2o6iTJqedVB8zt0t18GQjLR+fjs5mU+HgvRFaz59 pqXUtLu3W9L0N16Y1lBWZDEWqQlgxxwREFu96Y+SUWSeyf1JQKfoaLjlDl0mI262Q9xM reCzV3WFDOQ49TOp/gYsXmQbv2FDKSbXE2/ss2jNUP3sstaPlgHrzEcvRBBjWKSsUhno e3/4ypDUdXJAIxoAdcBEfVRU/naKcYMQohBlvVfRy4C+o5A0z8Zm3Iong0t+hUuQxBXC UsNA== X-Forwarded-Encrypted: i=1; AL+hErFz/fQ1tB7OhEWyztdYEW3KMsMDgyK/f16QOiXeMjmKkc0YQTqPBCgDlS3LqjwW8FKOaw4=@vger.kernel.org X-Gm-Message-State: APuU4Z+8ZKN2sZvgq9RhzCQOsYHJigmwjcBw8QUF5jJmx9vHv7eRRZla spEoHL2fOTfmHmy9R3mzYYWwa2Znp84VRFg9t/0kMzg3Qhnjgo4W65do X-Gm-Gg: AZFdTZfPzy+HLxZif49cT+KO3dwOvGvkOhxO7rsxTxOj4ptU4vWfxpJBTwyLLwEeevG zIwkmJ8aKRPJIbHkLuW4C+c/Uo5WFPwCAJd9XxM415BN7CMuXN4uMeEfBAkSbCTSA1UXi0PI7CE Z3y3oYQlx3q9QpB0JDiwJn5XsIXCsNxuu9Wm/2Ch5ywxMT611fegIknrjYnXG2eG9NupQCwdKJi Zz8I+wUGBM4W87GY7rMThEvk7ZRUKVg8OVgK0yLDzbEYh0t2qzHiQvZcL2MxCi7pOiFfOfeXYoq X/WfAn7tFqlWWXo9D7wnnuvPkGsOcMc0B0LeEkMr1QmdtOznQALSphxEeWwnBAE93l8AnSBmMUZ D9V7wQ96DUvlhmwwrKCqcpgE9keLyD5tTIjLa8Cf1/3nxG/f+pKy5FIYXAA7hsqt+SJv3Itpt5p FX1IX9kELjmCX7HLyX5txErBt02dv8RZitf/VEZ6+eXzNERrjli+D48j13VeKIZ671dqFfSSjxS BJwZT98s5e6MIEagwgJFd3zjRbl8EDwpmj36caiMc/nWkEz0tsiBlh+RYhYpy6Bb18zpo6fBSP9 twxmqsuID/y2lly+ht+UkCSUB/EWeJTGAl+EuNyZNtEc+TwbtqVcXkgGerUuWvcg 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: kvm@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. >