]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
mm: unexport globally copy_to_kernel_nofault
authorSabyrzhan Tasbolatov <snovitoll@gmail.com>
Sun, 22 Jun 2025 05:19:06 +0000 (10:19 +0500)
committerAndrew Morton <akpm@linux-foundation.org>
Thu, 10 Jul 2025 05:42:22 +0000 (22:42 -0700)
commitd2ef92cd2a31ba7c0d0eb0dd5c1acf381f161fcd
tree67bb3777ee3dddfca36d5061c41463175b394a9d
parentd8e77a0b636485364d70b86addf0c76bf9bccc4f
mm: unexport globally copy_to_kernel_nofault

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.

[snovitoll@gmail.com: add a brief comment to `#ifndef MODULE`]
Link: https://lkml.kernel.org/r/20250622141142.79332-1-snovitoll@gmail.com
Link: https://lkml.kernel.org/r/20250622051906.67374-1-snovitoll@gmail.com
Fixes: ca79a00bb9a8 ("kasan: migrate copy_user_test to kunit")
Signed-off-by: Sabyrzhan Tasbolatov <snovitoll@gmail.com>
Suggested-by: Christoph Hellwig <hch@infradead.org>
Suggested-by: Marco Elver <elver@google.com>
Acked-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Andrey Konovalov <andreyknvl@gmail.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Dmitriy Vyukov <dvyukov@google.com>
Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/kasan/kasan_test_c.c
mm/maccess.c