From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796227850; b=a9vKdtvOKFPc/x1VsfI4cJbXfrY+u80f9UIkCfcYqv7LGk65aQawQ5I28fBHIMslVpSh WjnrwTjEjxtp0MJgDemLSolCRlGmE5S4tLKcPjOW2Ce1sb7nvLY3HyAsfWJZicbjXqqfW NBsoQrp0MdXAsiJQK2l/oAYVdCiuMnKWrimb+F0Xvu76IwbNSuTnSCGeZ4TMnxDxjZcTn N1xfvixvJe/OHsIeLyGUe84QW8v0A4xJJkbM1JyPZEOoKi84nQgp0U8a5+35GwT3H0gFo /mJr4Xyn1znqBwF+aa1mBSD/l8bnaiVxJIPNLw4vc5dQG+i7zWbZ7n7JMEw235Ggf3A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796227850; h=Received:DKIM-Signature:Message-ID:Date:MIME-Version:User-Agent: Subject:To:Cc:References:Content-Language:From:In-Reply-To: Content-Type:Content-Transfer-Encoding; bh=oiaL6pDTrrdUeXMPpKwh0B6lc3q5B4pebz/X3ZBBRKs=; b=17yGARMRL3YVqyX2FT0dOa7llDOBogFUmEIkRIBfB5jV3HdnGYkdOFNr6ps1bKl4rLHk /FOcp4mhKu6xWAetf9djr7Bd+Y7g1xZRDvtxSLHs19rjXZpCCsqRADIr/PmiRjecHQiaa 71NLWXPuEHmFzZG12QMolRfUnGrs1d/d0Fk0OLHf53Er6qdybA/w9rRF0rMkljAsqAXcx 6BN2/rPCiBTU94R9up3Ftwlj3qykWq62AHjzdrIlQDWJz2oeNBIMyR51kmhJSbRLtpCMj bRzQgp/CRlik8KaZARHBZshk6Ny50xxum5wbKd8nEktjV80S96XdFDlbDmgV5tVFNIA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=AakGL98x; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C5AE5606A31A; Wed, 2 Dec 2026 16:10:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=AakGL98x Received: by smtp.kernel.org (Postfix) with ESMTPSA id 049141F00893; Wed, 2 Dec 2026 16:10:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796227850; bh=oiaL6pDTrrdUeXMPpKwh0B6lc3q5B4pebz/X3ZBBRKs=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=AakGL98xGF+w8QmFS+Vzqx3f1MWVJL7/57i5OwfJf3AOEUtKo3uB4YRNHaDJzcr2J aOGIpEvGWh86ARzXOuyPgqqKS11Mf6KMZekxzTxaGn/fOdq0Q+Ih/rTrnG47Am4wBX 0eneGi739ZCMEW8U8Cb+z5Bvlr0Mq11UO42YO1OGOw4WlEQf2J1wzHohwuIoPQIWBM ZXFsKCcsCcnKszguiL+TXSHsVsUwKKGI8X6NVlCy86hkx+fbfOIbuDhsQxk9bosUEY bZpqMH+qaNAW/N8BrJloLyNf/9ORZlsi0usjazJFLukdFUIENgofy0Y7vfha68ryWg imS2TwC4/Yaiw== Message-ID: Date: Wed, 2 Dec 2026 17:10:38 +0100 X-Mailing-List: linux-perf-users@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 12/12] uaccess: Refuse and warn on unchecked user accesses without an mm To: James Houghton , Andrew Morton , Alexander Viro , Arnd Bergmann Cc: 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 References: <20261202023920.595207-1-jthoughton@google.com> <20261202023920.595207-13-jthoughton@google.com> Content-Language: fr-FR From: "Christophe Leroy (CS GROUP)" In-Reply-To: <20261202023920.595207-13-jthoughton@google.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Le 02/12/2026 à 03:39, James Houghton a écrit : > __copy_{from,to}_user() and __copy_{from,to}_user_inatomic() don't call > access_ok(): they rely on the caller having called it earlier. That > earlier check may have happened in a different context, e.g. KVM checks > a guest's memory slots when they are set up, and then accesses them > through __copy_{from,to}_user() from whichever task happens to run the > vCPU, or to tear down the VM. So the check in access_ok() doesn't cover > these accesses. > > Add uaccess_should_fail(), which combines the NULL current->mm check > with the existing should_fail_usercopy() fault injection, and use it in > place of should_fail_usercopy() in __copy_{from,to}_user() and > __copy_to_user_inatomic(). __copy_from_user_inatomic() never called > should_fail_usercopy(), so only add the NULL mm check there, rather than > start injecting failures that some of its callers don't expect, e.g. > __wp_page_copy_user() warns if the copy fails twice. > Instead, shouldn't we try to get rid of this unchecked user accesses completely ? Linus started already to try and get rid of __get_user() and __put_user() completely. Shouldn't we continue in that direction ? Christophe