From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.41 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796233310; b=fnPD6gDlPvs5LxN4jtQAPrvlrZrxtl3gNsmePKjhnI5Gg7fbMj+bRJ4zJh8lj4fDQurY gurYZnOlknwDMzi6JjlnnyHZzF2ZfiAk0iR2Uz22rzaIq2iW+vJe6t4JGTuO884ljiZjh r6xXtXciWLsKHT6dA7V8O4uRschUjInVQaZML95VwznLWWWh42hp/3GmnKImeDu5w5+Vf vSdJnutCOyVGGFc41yW03B82YljpoMtEkSlGWxpaApBH7P8HqGLlyypA+8A2p9Kihwiyo Vj3JTOxgCCuIUeQns9wL4nsw3LuyCQLJZQdSEozbZXO2LmCQm0P+XN0spi+LsbRCmQw== 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=v3lS4Iq/pLXvGAEHS6p2XeqeOp5j/HRcLUEFRAnNM55+F4oIb8S4pSdbscNtzaghvCL6 3sKxd2BNj4w6twPccI23luhJ7RlZny04MUjLi5sqjzGqcSfEWBDttBprW5xQJikE+vbq8 un6+yCrREPUVHd6nBNfkZv95q3DfWN1ZUiHKKxC56KXvBSz0qb6WUwy89anVqqZGwpcw4 p9tdLwo75VJNKCF/wO6JDvyRlixXaqCUiwCbjuo6RJNCLTovd5KDKLks1+OcsJjow8VFu emesJlD6ETNVKxQQvjIPTSEIls51zPd21lOWBxxmrFMSMNxyjl3DYE+uSzGkhIIUj9Q== 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.41 Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) (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 D04B7606A696 for ; Wed, 2 Dec 2026 17:41:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D04B7606A696 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-f41.google.com with SMTP id ffacd0b85a97d-4a358881793so7168962f8f.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=aRqyGercE4J58e/7RQmukJjZguRZ1XTOMspUhfSJz/fpgMjNnjkMdiPiVNrQc7J8Bq Ah/Fmp1/anG6Ltmu4HVivJaMm8LGomoUiGpfdI5JWLSoisqv7dA1wTxMO6PqSgDOFxZM hPCWhpj2Q+q5vxblqrq5xexRznZP9iYB51tAMbNhrCLUHnqMBkA5zS1UxxLP7U5RD3NG JrqkcdDAvnnzC3knFSh5kP/oOIfOS8bThQ71PdcQYl8FVplKb3tWGj3DYyJApsmdkUtB 8SzAvnPyYnARoK2jp/7C6iw2iIJpkjRpvqbhau0JepiEPKM37C1OpIsntskpAXc56034 QLMA== X-Forwarded-Encrypted: i=1; AL+hErEFfTJS/Fa8VJlAy2P/1GK2YK+nYzUQp/3UMiIl0puFWSqiTxik7WA5tn9bwHembrJxmRBRf1eOXA==@vger.kernel.org X-Gm-Message-State: APuU4Z83+Y3bY7fEPiu8O0UBdP0BnDwSeeGQ5f/MLjryeJLTUs1F+5Gq j7swRMS1mr/M+9y970ZDuj5OqBgZvr9MixrVXXztjTaDec3jJOn66/nx X-Gm-Gg: AZFdTZc9aMEP7VrryWbwJ+C02eExxl7aSQOqV7l0Zhx6aSC0CuU6YxzxT+bht3FZ8pd ug1DZuce0zKXqdaFC+ksr0EPKmkspAbBlCrI023868TnMIKeJZcqSJwsSVeWDjIVBT/0jN5MChY cLDc6o2f4PYQaPVODQw4p5/P1D8QbJtW1vN+T6yfYZBOLKE/YXBjLPnP8TxUUrOWR5vVXmzQh0L PKAUqn4Eix1/w01Y7/mHooOAuDhiGCKUhG/NiCT0+ouJAwq0w7lnZMpBU5VLExSVQDYhDa0HFmf VMz0KEFT0UZ6BANVamQOyaxJVRCOhRRtsEMY0gb7xCRgbAw5ovYBUDlF25GPV8adfwkFYzEbIwc mybOCRHddJlEIGNj5Y5zR0L0G5wJ4MHmyN/KQnaJJmTd2zS8cNTEcp0P2uUO7bBNUUtwvS5NUao REKqRRN3dCg93BtB5JMJM/drUO7Lut5vYsDwZzY4Hs0QME9tWMw3UFrDHHxuMSoBLFHTM7I8CyC 074YqP7aAvJYx0nu34f2SASEqNKqXWf2ALY6tlWx5B2VUes5sn1F5v3IP2yUZRCB3iKfvArP0pz HJ7DkJHdZqhAgKV1xL4qrwPqYU2nVVwk8DKLOWIdwwKFnmhslkwwmR1yuI/OXnIx 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: io-uring@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. >