From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.45 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796238030; b=lKwb2U8rfN8S3W6MDfD5wYK9SgPxgOzlM1C8Z9iarzvbRKaIWGtjrG1DcZOvtK+MamGJ ABfRTOScBPNfrwahFjUI1GjrKHtFUi08Yjl6kjeKlKcWqYsl7dW6Nr8+xktkZFyOGzaZa Ke7UWMDggR205Opiewb1RMm+2TO3bZJ9nl0L0wAIIlSkE4auhdEHrzFi3lZ7D3sSHj63h WQVGm8fYumXxjUzMIa874vRnciujEh4LAFWJBZ4j5hlb4yp4UkB+lIyHyDBc6kVSdOHN+ Kn7dk8wTrn2KtnstkAl4fmaqwLAaf7030V9aPpIbjUObUXnAPm9wRaXnZhf2d3OahtA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796238030; 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=UoQdeQvFK/CQKA1FerFY8qfpk6Dol2UHcLr9pp66/0U=; b=S/oGjVY/uEjUQRs0X5P4j5zR6vNjSRAXltJ2NTUts7c0EqwyKAhAS+gdn6tKBZybxzwx SpFjEsKGCt4erhvRaCGbDAesykh0xYfvxDKcqhiZwKjb1DAELRKjfNxGs0puhaBin75As Y6lo5PRsQr6hSzvhQHOdJ7J/afnRBQXaarm4OUKj0NJpxmoCNbYAbjLzsKUeuEw5+dgER avpi0/8jKRj18K6eNAaE6edAhq5HvupiqM+Ry3IL+JpVS8l0+ec1svoBHHhIJBvGLRDkq ic82YHBvs2bA5YlonHw30NTZ7NmQL3xPdXTwgKDeh90TSA99B8l5si9hM9YN5l4jZWw== 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=P756KL4Q; arc=none smtp.remote-ip=209.85.128.45 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (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 7EB1D606A339 for ; Wed, 2 Dec 2026 19:00:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 7EB1D606A339 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=P756KL4Q Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-4bba5e17cbeso72357085e9.1 for ; Wed, 02 Dec 2026 11:00:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796238029; x=1796842829; 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=UoQdeQvFK/CQKA1FerFY8qfpk6Dol2UHcLr9pp66/0U=; b=P756KL4QzrGsaoJDy0J58bn7gO6lalom3lcWG3P2AVbxgd067au+HhD073Iw/1pB/Y wMceU1z7BPlzn5UWivUojioy9KnkI5i9qH2qouDriFKsapAyQC6ay12RxC4q8OiJbtTk 5OJRYDbhkK2RlNbrNOcH96K7CtR9I5n0Nv8VYiwXNjDm42axAOW9F+z4Ov9LFFDGnfHr kQfHyM0IjWHEVHwC4gAGN18ZMZ3zM2H+GvC9HgGJSfbqkIc9AxqpCdkqrqR7jQDQ6MsC i3Y/CvY3vxg5u9ta92uxDWTIzqYxky92OIJA+gLYRWMgFtMao5ea3JDqZ3xsANr4GTmP wbNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796238029; x=1796842829; 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=UoQdeQvFK/CQKA1FerFY8qfpk6Dol2UHcLr9pp66/0U=; b=KJCyHHTOSmzCCnstHWiCoKGMvbE/xdAVyyyKAHJwnwJMO5m3raSDCBOVSMneNny5OI BD0LbPFDd2aCrLc9tR9zN7RKHhtjRZRq++sU0CcGHbrmwfjQCPqvRb1iyq4oPjgHA23r 8d6aT8k6B48p0mAAQGcEkwQ/2XHoiteQFxAuumbefc9kJTw7pgcJtR2FCMgX7Q8Ce9mJ zC5yuAohIa7z/5Meq6DqJarFvgd/rtfG2vegVv4kF0hxSC3WT/zU+zBefI5V0wo4wOKO O3deRpKTEr3QV272+F6ewFFZ70nl5hqgZqyMHp70wPiS3lfcEhBKFLX0vcq/g7yonZGa aXrQ== X-Forwarded-Encrypted: i=1; AL+hErGXJBjYyOmSpn37I2+cM5Y+VkZDR2Gikr8B1pQGD8RJnlAvH2YSNfs2hinEgvUoNKa2FOsuM9ryVA==@vger.kernel.org X-Gm-Message-State: APuU4Z9Bi8LVSGJfiKKT+HkJKtkh+hRR62/UhfJzF880gXq/kQ10glUo 2ji+6fua43uPlVMnOCgoBWXPb4eM7EWT4YmSWD4OxIsaiCGVYpSKKU+P X-Gm-Gg: AZFdTZfNu69ofYPNkxxk13LPoirOXMjbMSI66zU4/xHMBB2NE9I6leuBILvgcUxy0Wk Z2KE0jl0WYhur/9BGnZAFbVz4onXFu9zBFB1FQJMFxi7stcPOrmRQpqNK9xHXjEzvasBP9tkQIV gs9bZwwx0S8KosQnbDP7MfoTOVEWXYkBq6eJXhJLVkIuAoz2hRgfK4KPAk0shHAyRifPGc2dSSK y+UyFOkVnekQkwTeYz0suZVQ5nY8dRH9WiCNiD8lXKwDHHaMHvY7GV44nH3nqwJTRoIZDg9vX2e R4wVKvJDUGkGMYxS/wAvEnJFiIstaebwiSds9QGWyxGvuo5gkqXOoh6oGGSwWS+heUyuULuSWtd fCgGHTUK9EZD4dLea6EpClFMJ0KmLlrV5sjsDTteg5nVTkzU7On0OUaILCsweB/VRT5VAlodzVz Jmy02NOO9uZ3/le6r2CkXjFg3mV3ldfG5llJUeoUU9oXnbwGaYhRUoT/PJFlntZz3/tiLKEA6U6 6xonXlhObLgwbDftQKQW9hB5WwR/quvXYfseCNeK6znmjIkfrLd72qKDKM768bIyhR6YMo6eYKv WyEzaRryWCoTFYNdsBphvnPLkneAKiB8lQQpphA1czwaAlqPZeSXnYFAuz29e9DZ X-Received: by 2002:a05:600c:46c4:b0:4bb:6a5a:7834 with SMTP id 5b1f17b1804b1-4bb888106damr844364535e9.20.1796238028776; Wed, 02 Dec 2026 11:00:28 -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 5b1f17b1804b1-4bbc9f80c59sm85003845e9.1.2026.12.02.11.00.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2026 11:00:28 -0800 (PST) Date: Wed, 2 Dec 2026 19:00:26 +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: <20261202190026.2b1de6dc@pumpkin> In-Reply-To: References: <20261202023920.595207-1-jthoughton@google.com> <20261202174146.2a41aabb@pumpkin> 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 10:07:13 -0800 Dave Hansen wrote: > On 12/2/26 09:41, David Laight wrote: > > 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. > > My point is that misprediction alone not the problem. You have to pair > misprediction with an attacker-influenced access. You can put all the > branches in the world in to a path, as long as the attacker's actual > access is neutered. I was talking about execution cost not speculative execution issues. > Look at _inline_copy_from_user(). It's full of branches. But, it's safe > because all of the paths to raw_copy_from_user() (the potentially > exploitable access) have mitigations. I can only see one (x86-64) - and that should really be optimisable away. I think the code is basically: addr = addr > KERNEL_BASE ? KERNEL_BASE : addr; /* cmov */ stac() asm "rep movsb" /* Aborts with rcx != 0 on a fatal fault */ clac() if (len) /* failed */ In the non-fault case 'len' is %rcx from the 'rep movsb' and zero but the compiler can't optimise it away. David > > All of the paths that lead to "goto fail" are safe because they skip > raw_copy_from_user(). > > The can_do_masked_user_access() path is safe because it masks the > address (mitigation #1). The else{} side of that check is also safe. It > has one path leading to "goto fail" which doesn't do > raw_copy_from_user(). The other path has a speculation barrier in it, > which makes *that* path safe from bad speculation too (mitigation #2).