From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 48F00606A32C for ; Wed, 2 Dec 2026 19:00:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=1QEf5FKU; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=mOoyUfVi DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=S7161FoJ+xGoW1sVvGH2NpPARrLUmk7iwVlNbw2xFtk=; b=1QEf5FKUZvuOQo9/y1IA+YkGw6 p19dp8HareTgQduspcGtc4cvno970WwzuvhOy/o6kBwRGwHswd2y9GOsyjmCOriA8fHR2tcAQkC5Q fxXJBf9PCB4au9ku4eVz0eSyU1nXilZoL8yR89me1Qne2T+EGyD/IuZzTJTz8Zj/QcrSB3hqoHrkF vlyaHLLfMAPa2QwNoOkJ2py1c5CHiEvdUhik1lqeLUH+2KbNi1gkL8PIb6wnMMzWIRrySoZmt/K56 E8fnFoymXuhEZV+Lwobmb8ZOtD8IGC6nXVr+DkpMWUlwMhQYhpUJIt+gZJ+6tShYO0aGU9o9JqOGF WBzEGSKg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYpZG-0000000Cayb-0A55; Wed, 02 Dec 2026 19:00:38 +0000 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYpZ8-0000000Cawy-3lx8 for linux-riscv@lists.infradead.org; Wed, 02 Dec 2026 19:00:35 +0000 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-4bb69f5b161so89179645e9.0 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=lists.infradead.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=mOoyUfViqt3aZaMFKxXh7sE61WXwz86WBGyk8BPYDChaD7miw4uLknIdCI4eZIcaqH drBIDq/cbDeXvhcz06YSCt4QEyAX5tNaJOi90sjA4eHfhT7REOO6r4/MelVhedfAmCYU uRHcSTzfZGOjFMxkaGNgZpAPpLVqzfFxzSxYSrA8APJiA3pYiAek1nmqUz+TOOEpGMif Lrq57a9apJ9K2ta5m/yCpsIWvFiCg+g/ixFijO9MEKY57K3UoZS5qjDeDqxcuXMoFxl0 gKR5ihge1TOhcFM9yY71MUyKly43ucv7iO3m8mNMlpa/0+XX6XoGfzfDGqFsl64zAUgQ BNdA== 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/CQKA1FerFY8qfpk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bFdAtl2PcuqJwziF+3iXhvUFuAq4pERfc8EJX9wcckMBaLZ+zBb 4XJ3s+7RyuBKdZYAPK2saw29uEC3+677LOVOKwsDc+JE7F7FHT2bQb+K+viCc2QWLgQEzQmQAlP qdlSnI07l6Dbx5UwVewIUBR5vfwmyLZMIw0a+bjZMxoVN129A4LpZ02BydpuqL3V 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-Archived-By: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261202_110031_643725_720BFE4E X-CRM114-Status: GOOD ( 22.16 ) X-Spam-Score: -2.1 (--) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" X-Spam-Status: No, score=-2.3 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_2 autolearn=no autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 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). _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv