From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.48 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796238030; b=fjmvzJK+F6xoFbjdeaiho6XmTKC/DlfbJN307WDa3qJQ4lAp4H1ZUxNKT0sXTSnMVHGx Z16J/Ytsk9VtuRFQTtCddwJCatxfWsaB3LTfStOkfZxTzkSHj7aZaMQhgsoBm2h9mN6nl 9NPw9AXknNpru4546gbhjQR0BgnVLIdXw6FccHdX0A3GxLpN5pPKWFJQxwte53qgYvgdj wxH16NKiEdQA5vMe2/NFLPSd0Ipnjmcpoi9jlUek2ky55L/Jw7Y0R62Dtf3hY+mAbaKFe Ij5Z0pNSh7RPCT74xJoHb9vAmgPkJ6hU+MJfJ1UC6x50aTvC3AqTw8L4Y8ITIuRT4NA== 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=n8NiFCzZYN+AsK1Jp1fko3NL2V3XLhgOpnzlDqvvylGWIraXmP9Sg5E3tryTvNHgH//3 fZtjCvT3lhz3uKIE8IHY84VMQmkI+Zx2pF4F8vFB85pXYhX4q41hIKLZp5Uramr5sS5LM cIIWyJXBGVR1pWV5GHQYs9LUuofPmCfR7D3dVj2OEARgJUvLljvKuywlLfnI8cECgsd5G ggeFhgoGOJxYH+6OpAg5EK4U3LAsfLCK5Oe/2sko7DGTNBiUlWcWnPycfgkRchDt1LNBv xwG7vBTcw1NhAtnxRqoCn5GDuTEmBoJzXAxNhuWT29hh/sf2dobxAmpoAhoDxIZbYPw== 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.48 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (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 7E921606A338 for ; Wed, 2 Dec 2026 19:00:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 7E921606A338 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-f48.google.com with SMTP id 5b1f17b1804b1-4bba5e17cbeso72357095e9.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=yJ9RjuAcybgB74tJ+Ww7KwtOmznkCjopLdau92Q4rfZ/zSnaYWioTzcrWQWxPANzbd C1qnWcP7NxU2v1f/QYlTWa7EmtqJEXnUHmIEQIwSS6IYKeRHYc5yEfseHY888wvKnaF6 FK4qsAhWN8IlEhSgb43igsqcrXGyEm0W+tQJdYlRAzyBJ6iH2U8TwqJRLNabfubUJjs8 z7GhGFn91HDNL7D/Y9D3+sOH7To2RUDwvFmRtxL3y51DlMUU5m4gxZpuwiq3joOa7CoV F9p/qfit1zwTSdv+u/kinLeduNaUoF6N+Fy6C8Q/Yb0hPwYL6FU6e/3NUyg0aPkCO3At b0gA== X-Forwarded-Encrypted: i=1; AL+hErGXiA7WdkLFOh9mclQ+Niz93wF8Sf+SghC86darZIx02hDMBxkq22w3YcVpHq2xUTVNhKNptKDkuq/6@vger.kernel.org X-Gm-Message-State: APuU4Z/B/MTXh3aGied+TDZsJ2/Qa+0rxku4sDiCICsWb/eYbcUvmmxi bM4/Gc6pEBLeDwYdzWtUN0j0siC3ctUPBqg1OrrFikDdyQrESPz3Ns7R X-Gm-Gg: AZFdTZcqmRzm+/QwSftjNxRsdh/4x4RAYNhqVJl70Qt17AvNqqJeUEKppbhMfa5+77n xZFHiKwwFc3AKVeHGoxqEkmOIuTlxt1TStcXXEnPe2O3mh0NARMiknVO6ZHzygMGiekylg6ZRtP 4ZW3Zjv1XFmNdxyWhKQ+7M7FxHOC+9rOJ6ntatd660E+v1dPDdb/7PnAfCcQAVU13rr0CauenPf a2WahOId0ZxqOHoBC+/WjGyRXjnPL2iFfMKHKCcTPKGeXzdNykUrhQvxeBVOxfcEqxkahWgYXQU 1czzKHnMhfQ4+9eY1anmsTkgPxORcXDfUMImKHUTYNxL8KHOU25gD62sUmBZkw8i1/BxXNjbnkD PlLBpfxdUS6UczBIUR/StUIpiQybo1b24hKe1bcZbB8VVN4DYETr5lQEXJ1/hUaMbsJuLq9QDvA Ik1xT3MJeCGzu0lf8hHpQgMiAE19dE3c6KswgDk7zz0TuLeP+xz8zkRUUndIzdVy5fkOOGQR59P ahRzTpk52OsE2oWSmRQXEI20HqsWhn7DiBXDGnJkW1qMXEUJQtww+j4yW6pn3atY9CwzylB+ING cz86/7hj3Zn+rkjAOJg1jlvi0sfXAfkRFc4hqeHJ5zh7ugOR4/MVpQU9lWhhD/JS 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: linux-arch@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).