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=1796233532; b=JaHLIYgWH6ySFxUXyLBvCt4KrRhQOex2iGJ92026NWJmg58qZzS7zFVITyALnr7Q7VEs y9J1L/ocbevyobEStQbMxxUil/BfMQK64xH0vvZhoMF+mez22NVdicnfOPlFml5QSAwDg CVUH6B8qdxF9P3RnPw9LT2HLq+ILLCHdpnE1RG73meCCNjNq8m4Ugx8OXHi3LfqpylWww 23lp0cJ6ei0Cbge1+Hfwq8kChCUEwdD5XdmRTcyW5LJuGZJiE6WVmxBeF1Uh8iAx2a0Bd yRpW5cQHnlzV/Awwga0qULBlC9qlUA+uoxnvDe0Htwd6JHMWLMb94Yw+aFlaBu3lw7A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796233532; 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=/HCnfct9IyxqDpBPd74+CXnE4R6N3C8fwGo026I2bCI=; b=WayCtFMVzPIYz8FzaXl7PoTG3EnPaLADfvGWDKjSpHL+dLBhEiDdOVJSKR0zGSkrrmPZ blP0pij2fffIRBhGY3qu4FqO5xXz2wxgJIqYbCcJ3WtvmGLLqujXxzt8NUhQJVFRz8PhT 7TyF1encqQq9sKF22rmyvNfFGF7wbsRjdDJ9M32P+hYSPxIHm8FrsjOrM4KAyLymV4wCW xMGsPb5gavvfpWsq7WRlwyHDDRmV+n5WmlXPUJPlRMtOkfK9fRLGwUMf1kFuSUxZQPfmK blqL+F2Hz8nbRgM4UCYMMHFdbSWNyiKjsTYYAiESPeeAtlP1Njg4Q5uGKyokZOqQ0yA== 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=o7BaYnKR; 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 B6010606A32F for ; Wed, 2 Dec 2026 17:45:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B6010606A32F 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=o7BaYnKR Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-4a35ac4475dso94921275e9.2 for ; Wed, 02 Dec 2026 09:45:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796233530; x=1796838330; 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=/HCnfct9IyxqDpBPd74+CXnE4R6N3C8fwGo026I2bCI=; b=o7BaYnKRZZ72fVSyIWGcPWaF4J6rloFtaDmVtUzJAyCBu+NZqdmb63FP5LnuTz+6cQ BDmOoTxZaMdRdUgf1X5QiXfNOE88W6GHKfzAnKaX/LXGo1zXgOSR64PVmu0D2I9eBL+Z ALnXm6GwWsUZ7DXy5hzPkG/I1X+EtpGXefLapSBQaRvKhSCY/z/Rba7zrWTKU1SbQ4Ix mMFDtJI2ujb0lCPBYUIXNz2PwGo3zGj6+VpELiHz3D3ae7jHJDevxTgFe/6gBxAbFl6s V2+4VVD3eC29uUKq0GRF3y+7v84dpO7PjYyprU3XyNpE7zoPu8K4ygDQxkZLC4vtM5u/ v0SA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796233530; x=1796838330; 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=/HCnfct9IyxqDpBPd74+CXnE4R6N3C8fwGo026I2bCI=; b=KgzH6LDO3tImVt9QA4GDrco2HydOGE8GBVvr+RtS9SmreZiu0SEaqfcdY7ivO02Ap6 lADEeIIlQZ+W76Utl/cvQaXbqSm8Daz7ai3x2AisQ9p9tPHr3K0dyJlFEz6x5DehKgTY Hnm23RVk9y4SN9wz23IRL5wHfP46qRuVrHrPS9C3xjJcN3dvhDJGFhHQYP0x5nUfOLwc KVqWJbhNv8gODw85YYTyDkWA70oGEFy+/7U42NoarLo1LfAui7Bq/JveC2OB6hTfWK00 ifV0HmZo28WYSWunpzKz4o/2GSiodIh5BDTbk9M9D5ARMguTr6sF00NriTH21sqx5zEP TtuQ== X-Forwarded-Encrypted: i=1; AL+hErFR4McNrbOe/51Gpb2mUtnSUntaNdychwcefwVpd7ut3YyBNfufHvNPHigpN2R9HnLNy9I=@vger.kernel.org X-Gm-Message-State: APuU4Z+BeZudQzwNEemXy5qgJXZjJpAqb2R0UVLFaW5mLP/SocMgAhyn mzJntAbTf/bqLPoACHXlDoy+ht4/o5VtVblPbDNx+NKw442XZ7QNro0M X-Gm-Gg: AZFdTZfyDUqo+wivZ2NqpXqWo6fRJPy5olSoeWQ5QlFpT1AHNZQigferO9+k/+fmTKH wmBNj1m+y8JQ8Sl7nO18SdKgMREFTfzkqAyqQ+BSB2dxg4Q2cnVLOM315C1hPQHDAWl56tlrrIB X8VcnHf9YZVib/KvCGp85GkIXR6UgxjZc2gRjJd3FyB3zT1HJqHmPOWdLnphu1pXM3x51gF2H+8 ielX771drsndD1HwCiYkOWmJBjT5mT5jVn0kJejaBLskdP5fmX2bwCL/3zQQPhTFME3cqjWbXws hONXZ2aOTNB0DKbwAKQxPV2isfLAccPDviRHjHq/KYfUOzd6HHemj+SF5UYF/J8pbBGRAvjgdvW XXuXw0CSh79kPsTOeQmczDvtNHMbCHhZCyMRxiAKRYFBHe0m0Rplf50rvtpPXgQ3grzo4eRYTeE EHkvNs/aD5NrUgYU6Z/VmlHmtuLcPQHhW3QbseNY0IES8TV4j5ndyVeKX7Fzd50tkQ6bAKbaQq6 iyfLk38+sPYTUB3ZlPwYWvJxugexq1w86WltlpLvRmgIWH6CrTKSmo9LupNwyVLuj3kPJf1Fnn7 /TJYc7fjctMFcfEJkr9usFELSPsXdpyJ2hi7mM2CB28R+quoJzSp/RGxC7cUHSZM X-Received: by 2002:a05:600c:4504:b0:4a1:9078:911 with SMTP id 5b1f17b1804b1-4bb888284d7mr841005575e9.31.1796233530119; Wed, 02 Dec 2026 09:45:30 -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-4bbe0032c82sm4056485e9.1.2026.12.02.09.45.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2026 09:45:29 -0800 (PST) Date: Wed, 2 Dec 2026 17:45:28 +0000 From: David Laight To: "Christophe Leroy (CS GROUP)" Cc: 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 12/12] uaccess: Refuse and warn on unchecked user accesses without an mm Message-ID: <20261202174528.6b8c9ee5@pumpkin> In-Reply-To: References: <20261202023920.595207-1-jthoughton@google.com> <20261202023920.595207-13-jthoughton@google.com> 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=UTF-8 Content-Transfer-Encoding: quoted-printable On Wed, 2 Dec 2026 17:10:38 +0100 "Christophe Leroy (CS GROUP)" wrote: > Le 02/12/2026 =C3=A0 03:39, James Houghton a =C3=A9crit=C2=A0: > > __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. > >=20 > > 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. > > =20 >=20 > Instead, shouldn't we try to get rid of this unchecked user accesses=20 > completely ? Linus started already to try and get rid of __get_user()=20 > and __put_user() completely. Shouldn't we continue in that direction ? That and the abuse of those functions for accesses to 'dodgy' pointers to kernel memory. I think bpf does some, if the pointers are dodgy then what you read is garbage and IMHO you shouldn't be doing it. I think the problem is that it allows arbitrary code be added at random places in the kernel - where nothing has checked that the types match at all. David >=20 > Christophe >=20