Re: [PATCH v2] mm: unexport globally copy_to_kernel_nofault
From: Arnd Bergmann
Date: Sun Jun 22 2025 - 13:45:01 EST
On Sun, Jun 22, 2025, at 16:11, Sabyrzhan Tasbolatov wrote:
> `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.
>
> Fixes: ca79a00bb9a8 ("kasan: migrate copy_user_test to kunit")
> Suggested-by: Christoph Hellwig <hch@xxxxxxxxxxxxx>
> Suggested-by: Marco Elver <elver@xxxxxxxxxx>
> Reviewed-by: Andrey Konovalov <andreyknvl@xxxxxxxxx>
> Signed-off-by: Sabyrzhan Tasbolatov <snovitoll@xxxxxxxxx>
Acked-by: Arnd Bergmann <arnd@xxxxxxxx>