mm-unexport-globally-copy_to_kernel_nofault.patch removed from -mm tree
The quilt patch titled
Subject: mm: unexport globally copy_to_kernel_nofault
has been removed from the -mm tree. Its filename was
mm-unexport-globally-copy_to_kernel_nofault.patch
This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Sabyrzhan Tasbolatov <[email protected]>
Subject: mm: unexport globally copy_to_kernel_nofault
Date: Sun, 22 Jun 2025 10:19:06 +0500
copy_to_kernel_nofault() is an internal helper which should not be visible to loadable modules – exporting it would give exploit code a cheap oracle to probe kernel addresses. Instead, keep the helper un-exported and compile the kunit case that exercises it only when mm/kasan/kasan_test.o is linked into vmlinux.
---
mm/kasan/kasan_test_c.c | 8 ++++++++ mm/maccess.c | 1 - 2 files changed, 8 insertions(+), 1 deletion(-)
mm/kasan/kasan_test_c.c renamed from mm/kasan/kasan_test_c.c~mm-unexport-globally-copy_to_kernel_nofault +8 -0
@@ -1977,6 +1977,11 @@ static void rust_uaf(struct kunit *test)KUNIT_EXPECT_KASAN_FAIL (test,kasan_test_rust_uaf ()); } +/* +* copy_to_kernel_nofault() is an internal helper available when +* kasan_test is built-in, so it must not be visible to loadable modules. +*/ +#ifndef MODULE static void copy_to_kernel_nofault_oob (struct kunit *test) {char *ptr;
@@ -2011,6 +2016,7 @@ static void copy_to_kernel_nofault_oob(s kfree(ptr); } +#endif /* !MODULE */ static void copy_user_test_oob (struct kunit *test) {
@@ -2131,7 +2137,9 @@ static struct kunit_case kasan_kunit_tesKUNIT_CASE (match_all_not_assigned),KUNIT_CASE (match_all_ptr_tag),KUNIT_CASE (match_all_mem_tag), +#ifndef MODULEKUNIT_CASE (copy_to_kernel_nofault_oob), +#endifKUNIT_CASE (rust_uaf), KUNIT_CASE(copy_user_test_oob), {}
mm/maccess.c renamed from mm/maccess.c~mm-unexport-globally-copy_to_kernel_nofault +0 -1
@@ -82,7 +82,6 @@ Efault:pagefault_enable ();return -EFAULT ; } -EXPORT_SYMBOL_GPL (copy_to_kernel_nofault);long strncpy_from_kernel_nofault (char *dst,const void *unsafe_addr,long count) {
_
Patches currently in -mm which might be from [email protected] are