From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.45 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796233532; b=C8nzo+L8NqpwUWjkDQ4alpZndPDxeAs0TFr3mAm4wB9I3VJBCUL4Jf62qK9NOMCbNzDn VADT70y4U9qwbIroO1KBnM5lhCUZwLnq/6ZiiFo4mOsDrJ6dl/HuiNXKefD3ZAtn45Tbk xBMm+pC55wQTvnp/MuGJIqao+6Ss6sRGDTQSM1IWzLJtxXNHWKItCJykhlCGnNCSjzKAr /9zuTd6khyy3F6Y3+lvf0S7nQTYuexRCL/MfGFZ4JuJH81bOR1J5cgZio9N10wbsPatZk vXVWaCIDNQoj811geixQTcRSql3/qkuh+m9URx+Lnp7hF7SfMTsqnV4TETeRdYzkedw== 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=qqjTn4ZDyb9RWbf9mHLl7HDICIJ9aM/cbUZn7vqA1hHurOx9Wnf9E2/Vg+83VERy3Lby GcNZXdRMYl+JVMyrZnLbfDputhYbjF1TYLP62q3k6eKFVHXDwWC6QpIb9AxX0+KndPqNh yYN8MGjqgzzTwOcNATDDOa9REbJVoXEvP7Ak5+APar+T4Lk7Z76wcNrJ5aPJolB/5THP2 XZgI+Jt6lGZjHX9STqAU38UiYEVknlwHL1J/ieRdx/udLY6nkOCT+Fcbw2Fsirg8sYfzH n9a0h9zs1AXsGn8EG3A3FYkEUSd6HOuLVYpk09PML+KDIAJDz73FbMs5hs7S/izlSeg== 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.45 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (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 B410D606A32C for ; Wed, 2 Dec 2026 17:45:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B410D606A32C 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-f45.google.com with SMTP id 5b1f17b1804b1-4a35ac4475dso94921285e9.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=wUBxXOKw+4KuAFnumEmETcRgcf9qX6YKtNb+Dyfh5KEyjm5HZxxogbaNqRsRZz4/rY KW6E18Z6t58BdH+56BUCRQ2+PLfKHTE0yKlgIoCd9Tzjjf/zTa8+EWv3BTN5xWpsrYAk 9JdocYsP6YcOQtLnxLHj3+Yg5E79/nUtsBo1NbutBAThCTwNhpj2yPK0zLMVSxcfBFmY LngOGVBaknmpU/LJRfo7PLyls4JPaJ9DHvP1Pa4uyFpCY3IxXMlR1lOQUYZdexFdIkUO xBriYe23ILOXSxqfya6An4D6irXQ2Bvd52UKoVrTeHBJUuj0jntdnoS5rrPQn59ddX4z yeqg== X-Forwarded-Encrypted: i=1; AL+hErGUH/sN4RVXC5sge3ginbl7GIjRnGVddb97Qj01GeK7K5zRcoiyyYVPHDMKwWwFi/ZaBpejUX+/wDb9xWGz@vger.kernel.org X-Gm-Message-State: APuU4Z/0t7hz8xXpbVJtmmswuPgvnRgnO/zVcfhzP+xK6R9WT1hr1L8i obGZY3mWqzNOzv3VErI3lxhpev4Xy1/PabZGWJ3Wq9TXakXxTRoeUw19 X-Gm-Gg: AZFdTZfXnTeHAM8OsUT2tFTnh2JKeEivqwB2IVO0kNRUjcezv/rWcK2n6PWGzrKHUVD LbqBYs1se0t+ksjSBkXfa9Z5aFFCesXP4KovpoMZIVCvACPVwYg42iyB8xJ2yM/qVyyPwzacri0 2/RkcehfXNWQ66tTt9EDBF037Rmy0aZJSrk953IgrFylWe+Y7BZJDWKa1ojwbX1dG1NRN8nlhI4 nTdDt3ePgmvb2DbprZ9jtR4RT65nd+AcWPnnqaQuhog5/748OdkjBbuPKkp1VfExfxNMbj4BJl0 p7bpAmIZmS9LroZa8pF8tUZ6OCt2sxje4ZWnSTg1pTxYD+zcw9Akqj65nhvEVFQtsDJpdq149RY 97THCC/koYmjp3qV58l0iDyUmtBJ8RZ/zK4MFucDfpYXWuPMaJ93YqyafXxHBY8a18KYPZazm2v bGcBGGxuMgq2sqzXm/vb2Q/yBfCK+QdFMlaNGUTWQhYwH/7bNGp5Dq6RXXzyQ3zZV+8vN6iJA3U 9B/9yS8qyX4QnAmyYdI9OHP9SgUo9mX/zHJfn4NAN2FLFHgwfb6pR5fS1Z86gazasAXxfHw5p3H b/5M96cs21fmdgts3D82ynQXyRhb2INt63MH/zYc9uJn+Vpk2+N5wN2q5+TThspl 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: linux-fsdevel@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