Re: [PATCH v2] mm: unexport globally copy_to_kernel_nofault

From: David Hildenbrand
Date: Mon Jun 23 2025 - 04:09:57 EST


On 22.06.25 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: David Hildenbrand <david@xxxxxxxxxx>

--
Cheers,

David / dhildenb