From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.49 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796238030; b=sdulNf/NoiXiB48cF8b2uyWOErXSGbqn8iL0u4L8CMkipAsDtmEPquF4bWCAha+j2tag uL6N373ZPC0fZ5zcpifUcgwufZ78X42p+5MCf1jwYEchj5y+T10i4DmqwX6C9S1D4LAT6 5DQUSiwLLZvMLl4uGwEkCrCo3Ou6P3C204wiAy/fSS44fhQ8TrAs1AM1Gh+W5Wal9N57u Z6u6Y4kC4KKSXXmxtic+edd6MNcnadwDkKJtHc5h1oejEegoOZ2Qg4kVsgPrp2S8aCRON 2nsC8HIloF/2hG4wmMDCCuTHg1ENr/UT+ecnw1eRanGzRBd60mCmOSn4n0BjTDJWrZA== 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=ZArxx9VJy6WxlDN/gKJ69lQL/Viecgoka/3axREY2c7NbD/vqwRSyo/wNkwfbK9gMk2a 0toVuyD7H2wH07zSJiR7IUa4P80ewIC7r2tFRmyi0pMuJ5pGYYENofRFlMZVzAmwxxAT7 j3r4bXnBvpb1gvrfJmoahv2X7ZTKpYCRv29VoywreWcWLt+rOJ3O+Ks7EYYlEz9cywpuw /RxqEcNG2QA7f51BavOPRAc5AKa/JvCSW2mMgbp9uMN3ub2ZlXJK+lIXKQfrcXW93KOAD VMofEkE8wG1DTXBR2KdFsqZnv6bfqFhBCTm1kkl52KphWfSKIlos7b0kHqhFNG7qS+w== 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.49 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (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 8849C606A33E for ; Wed, 2 Dec 2026 19:00:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 8849C606A33E 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-f49.google.com with SMTP id 5b1f17b1804b1-4bb6886d30aso128289885e9.3 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=ArQUlzPyELk02wC47LMejkRgYqtjxL5r+M8xq4wRs0QL+nW2MJDhNgoaOCewK5t6Ek +o+sRy8mYBwsKfGRAWYzc4m0S1mgXnviiyBRPscsszts/mNPWAtmNwCOLFEHUNCU+BOg OtFU1fnyDe8iP0cM3j4o0KQaSzmuxwDoZfjhtrlIK/OeKAXLdJRBXFYAJ6bhNuQCOBxO D4eBjNcSUzzTg6no66zlNeRZ1aNjzgZoF0ZJA7XGMvfddBhWuLERYwFpiZYe1+mRpApx D8zzytXxlLFmnBgPFDN3tg3nuLoLh2pGXK9sUIn+WYi/ELIZJirSuGb+doF4eNRGWf4M s7tg== X-Forwarded-Encrypted: i=1; AL+hErF60jAzdj4Mrlvo5fsE+ERxhG74yUvWT13O9SctH3Gy/iXuP5+6HiGD2/3FAzAUCj/F2nY=@vger.kernel.org X-Gm-Message-State: APuU4Z/jTrgFPhxkosZU4chh8hjmoJBcvZ45HwxhYLXDEUY2HL8BByX3 7JwjwIN9jkUYAgXchdYaGEIZYPa2p0aUVq8rF62qEPeMvXojFtASsAtS X-Gm-Gg: AZFdTZfN4XteMstK1tpjMLBVbHFgsB7a9e99fK7qhhPaKb0iLroP2PN+P2NohdOGH6f DeFybYxX4+uNDKL+3qRvITRYjvWjhaaAt+z6ZgnZvY8+KzreyTRa4R/jKlpuNZmkWNYcj7lPlEj j/i7msQOOJsjIK9otBSQF0qKVf8Hh3s0wnd+3DWhcPtaEUeaKF+MAehY2B4GZZCQ6lxn4l2459F Gh4aLP0pg4/LdusZo7/S1i0Ptfs21cEJOFKNyVPB/NjuDDWFbr13YLhPwZ2epwsywBNfRIVOX1y aGWy6MDaFyA+P67mhrQGQCiHyCO6ijy4oxUcMmaptG44AV+W7zAx00SCFWw12gBnBVu3q626tht qSErtoT5KX9ho8AuPxK4aSeKf+WVZyuDTlye1iC8LecxCqLWEQQzL+X+0wE/dbHqAOF+97cVKZO H7CYZRN0cCnfb954vV7lI2zHg8fDpeiC0Z6yk+OxKQShZwlK4vOfqp7wLKqA0aanNyVeoKZAhF/ G/hfX0wxAtTOv6zJr6D9JpKYaNCgYInzf/lVR/eTPQ5ItA+B3cZEGyIyHh+iE/aEpJs0eamuFxX eagGL+WCUGqcwdfjTrfyJRfqdxN6JrTp5vWNcdmncSqLphJj8iZ/QWI5sRmMaq5g 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: bpf@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).