From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.46 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796238030; b=Ys7lhCnwT0Yg7UhHTOGpoGuRAx6AXiuWzQyePiAFAytyLwNEUHmm+mLa4g8anMIqg1kf cVgh6YuKHUf2R9Gu17lZ05mb622Vbkn5C/Y3hpcPuxevgIdhKxpFTMk/z+R37B9m2fY9m 78jMA0/rTck23q/X07rIXkXkMY8hPDeuMKi0GxFUXuHszAMBBB4jd2GKDd5tr+lctF/nM PsUc9Ki+5qgmAqBAEO4uZF02bfErMHDOQsM5KbmZfdVVNa1vDlmwMcbCsk3G4Ju4vsWCu ZEmngJkTq+9cr50X9KTwIfbweqeHZjyX8dkSmjcyeOWnpItASM0yAl9VEi7pvHooBZQ== 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=c+B6GptsqtZmiGQqV0hVL8dpVoSLt5hymNb7yj60Ttq7YxYymfQty7b2uXB8fbtz+XsC 2ha7h+fKZQSbavZthzpjXaaosDFgRpHI5KuAFcf1d+jT2yVlr6exmwOOiYjK/BM3vefpM RnqAsuK/gCMKVsK5oBxcJn/eAwS2dJStAtkxhY0uvNAQb804Uv9Ap/0DVSAU1sZI9DQE7 hBa8N2R8+SL7Aei7IhKzS097jo4CsOs35n4g/AZ3IkxnAJ59yOSNIpZXC1KwwkVfcxxCi 5QJk4cu936FPcf3ahIqIusAghbOrBBO3RBPg+yKhKZ7W7ZYJjrFEwTRCV84uuJHgrpw== 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.46 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.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 8A063606A32F for ; Wed, 2 Dec 2026 19:00:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 8A063606A32F 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-f46.google.com with SMTP id 5b1f17b1804b1-4bba5e17cbeso72357065e9.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=AAXW69gu1PDbf45iiDNM79LlK9vpNRAl4V3qWcEWmk9BJy1iPNwNsGfDNQSLB6+liE QUUo6KdTDtmmJOwjyN9rYExpB2N3BGveUP9Ii9kEM3BGDxNdA441Z6PfczoHtEm7F6kV YdMKzCbQyF/8/BZWSNQMTmHqlm6RYTvGCtHyZ3n+YatWVBqNFgOpGqzGomeI3yPQgo/E 3b5I1qLLk8yrr09u2MlOXy7JCAVFl8mAckKaI88I1BMThq+ZkTqUv79Y+v2+SItuZ/X0 tRuTyh0qhqcq9bYR7LQIezCYkOYtoZHKQXYbQJr5O4KzQT/sUSDp6QmubGzKN70K4mMI wJ0g== X-Forwarded-Encrypted: i=1; AL+hErFb+Q9DER1KvlfC5QSm7GY8EKL+JtqMqrwuSNdrjYBGChTSWuB5cc2ceS7cgrjwLoStBwj1PWDiR1HRzQ==@vger.kernel.org X-Gm-Message-State: APuU4Z9wSy5CFdy9UVm8AK1nL6IdYstGlXkXAUDB0N0QTh6QJW53AXYN 1qP+QcxFcjf2p0szVghLFL3yQy7z8o51olm3ol5OQRO8LfZ7XdY8Eq8m X-Gm-Gg: AZFdTZceLotQ3iMvurdj8PouGSgLOckjE5/a4B344M0nEfxdI5dMmTKXdPkR3o8lIhp HAZgPnD/pkOSYcCKnerBC5JRMohgZuGmVElZtsJ1Gj/xM8qRLAOPXMOJzKi1NKPy2h6Tlgz9R7y EEPnMo7Xt5/Hr0KnhhufYoI0TsvEoNanljHOeUmQvDJRHUKNv5XXcpts+4rUV3YaYTARuEq8ign +SHNSAvGXRwtUgnKT3+irfEzRaJdV3MHch2MTE8eRC0DUfkch6BcHFMRadsain98BvlwOe434Dn f3Mzcol7Vf0HMcTUKOnwD46qXAfdvlOPzFe/88uJZvpKz7FDIgqd4Z9wPt8l4w2F76JYl3R+QnK uDg5BXHKsVu6oD2ahQOXcVCdTdi1BL2TnyicXicUIpm0M7zUIO9zdlxLxULGxelq/HC8SGPJldM Ic0B3g5oeH8x14YaxajNL3AS5ZDU4yktY1Vh9qbYfJYrIlSKCd7cqA07kZImo1y8rm007LvTTDL syxhky0S6CWmDp17BdC3aFNk6BxR5mC2isXQGkzowxxAdWzv4Y7uD5M/IXNcp4A/0a9C0UlWaYL RiOYAvLyC3cEFLzaSdcbRqen9s21hdu20B7gwMFMfystRhUKzTAAB3Po0n4l3nJL 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-btrfs@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).