The patch titled Subject: mm-kasan-kmsan-copy_from-to_kernel_nofault-fix has been added to the -mm mm-unstable branch. Its filename is mm-kasan-kmsan-copy_from-to_kernel_nofault-fix.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-kasan-kmsan-copy_from-to_kernel_nofault-fix.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Subject: mm-kasan-kmsan-copy_from-to_kernel_nofault-fix Date: Tue Oct 15 04:53:38 PM PDT 2024 fix comment layout, per checkpatch Cc: Alexander Potapenko <glider@xxxxxxxxxx> Cc: Andrey Konovalov <andreyknvl@xxxxxxxxx> Cc: Andrey Ryabinin <ryabinin.a.a@xxxxxxxxx> Cc: Dmitry Vyukov <dvyukov@xxxxxxxxxx> Cc: Marco Elver <elver@xxxxxxxxxx> Cc: Sabyrzhan Tasbolatov <snovitoll@xxxxxxxxx> Cc: Vincenzo Frascino <vincenzo.frascino@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/kasan/kasan_test_c.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) --- a/mm/kasan/kasan_test_c.c~mm-kasan-kmsan-copy_from-to_kernel_nofault-fix +++ a/mm/kasan/kasan_test_c.c @@ -1960,8 +1960,10 @@ static void copy_to_kernel_nofault_oob(s char buf[128]; size_t size = sizeof(buf); - /* This test currently fails with the HW_TAGS mode. - * The reason is unknown and needs to be investigated. */ + /* + * This test currently fails with the HW_TAGS mode. The reason is + * unknown and needs to be investigated. + */ KASAN_TEST_NEEDS_CONFIG_OFF(test, CONFIG_KASAN_HW_TAGS); ptr = kmalloc(size - KASAN_GRANULE_SIZE, GFP_KERNEL); @@ -1969,16 +1971,16 @@ static void copy_to_kernel_nofault_oob(s OPTIMIZER_HIDE_VAR(ptr); /* - * We test copy_to_kernel_nofault() to detect corrupted memory that is - * being written into the kernel. In contrast, copy_from_kernel_nofault() - * is primarily used in kernel helper functions where the source address - * might be random or uninitialized. Applying KASAN instrumentation to - * copy_from_kernel_nofault() could lead to false positives. - * By focusing KASAN checks only on copy_to_kernel_nofault(), - * we ensure that only valid memory is written to the kernel, - * minimizing the risk of kernel corruption while avoiding - * false positives in the reverse case. - */ + * We test copy_to_kernel_nofault() to detect corrupted memory that is + * being written into the kernel. In contrast, + * copy_from_kernel_nofault() is primarily used in kernel helper + * functions where the source address might be random or uninitialized. + * Applying KASAN instrumentation to copy_from_kernel_nofault() could + * lead to false positives. By focusing KASAN checks only on + * copy_to_kernel_nofault(), we ensure that only valid memory is + * written to the kernel, minimizing the risk of kernel corruption + * while avoiding false positives in the reverse case. + */ KUNIT_EXPECT_KASAN_FAIL(test, copy_to_kernel_nofault(&buf[0], ptr, size)); KUNIT_EXPECT_KASAN_FAIL(test, _ Patches currently in -mm which might be from akpm@xxxxxxxxxxxxxxxxxxxx are lib-alloc_tag_module_unload-must-wait-for-pending-kfree_rcu-calls-fix.patch mm-consolidate-common-checks-in-hugetlb_get_unmapped_area-fix.patch mm-memoryc-remove-stray-newline-at-top-of-file.patch bootmem-stop-using-page-index-fix.patch mm-kasan-kmsan-copy_from-to_kernel_nofault-fix.patch