Skip to content

Commit 330d8df

Browse files
xairyakpm00
authored andcommitted
kasan: remove vmalloc_percpu test
Commit 1a2473f ("kasan: improve vmalloc tests") added the vmalloc_percpu KASAN test with the assumption that __alloc_percpu always uses vmalloc internally, which is tagged by KASAN. However, __alloc_percpu might allocate memory from the first per-CPU chunk, which is not allocated via vmalloc(). As a result, the test might fail. Remove the test until proper KASAN annotation for the per-CPU allocated are added; tracked in https://bugzilla.kernel.org/show_bug.cgi?id=215019. Link: https://lkml.kernel.org/r/[email protected] Fixes: 1a2473f ("kasan: improve vmalloc tests") Signed-off-by: Andrey Konovalov <[email protected]> Reported-by: Samuel Holland <[email protected]> Link: https://lore.kernel.org/all/[email protected]/ Reported-by: Sabyrzhan Tasbolatov <[email protected]> Link: https://lore.kernel.org/all/CACzwLxiWzNqPBp4C1VkaXZ2wDwvY3yZeetCi1TLGFipKW77drA@mail.gmail.com/ Cc: Alexander Potapenko <[email protected]> Cc: Andrey Ryabinin <[email protected]> Cc: Dmitry Vyukov <[email protected]> Cc: Marco Elver <[email protected]> Cc: Sabyrzhan Tasbolatov <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent ece5897 commit 330d8df

File tree

1 file changed

+0
-27
lines changed

1 file changed

+0
-27
lines changed

mm/kasan/kasan_test_c.c

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1810,32 +1810,6 @@ static void vm_map_ram_tags(struct kunit *test)
18101810
free_pages((unsigned long)p_ptr, 1);
18111811
}
18121812

1813-
static void vmalloc_percpu(struct kunit *test)
1814-
{
1815-
char __percpu *ptr;
1816-
int cpu;
1817-
1818-
/*
1819-
* This test is specifically crafted for the software tag-based mode,
1820-
* the only tag-based mode that poisons percpu mappings.
1821-
*/
1822-
KASAN_TEST_NEEDS_CONFIG_ON(test, CONFIG_KASAN_SW_TAGS);
1823-
1824-
ptr = __alloc_percpu(PAGE_SIZE, PAGE_SIZE);
1825-
1826-
for_each_possible_cpu(cpu) {
1827-
char *c_ptr = per_cpu_ptr(ptr, cpu);
1828-
1829-
KUNIT_EXPECT_GE(test, (u8)get_tag(c_ptr), (u8)KASAN_TAG_MIN);
1830-
KUNIT_EXPECT_LT(test, (u8)get_tag(c_ptr), (u8)KASAN_TAG_KERNEL);
1831-
1832-
/* Make sure that in-bounds accesses don't crash the kernel. */
1833-
*c_ptr = 0;
1834-
}
1835-
1836-
free_percpu(ptr);
1837-
}
1838-
18391813
/*
18401814
* Check that the assigned pointer tag falls within the [KASAN_TAG_MIN,
18411815
* KASAN_TAG_KERNEL) range (note: excluding the match-all tag) for tag-based
@@ -2023,7 +1997,6 @@ static struct kunit_case kasan_kunit_test_cases[] = {
20231997
KUNIT_CASE(vmalloc_oob),
20241998
KUNIT_CASE(vmap_tags),
20251999
KUNIT_CASE(vm_map_ram_tags),
2026-
KUNIT_CASE(vmalloc_percpu),
20272000
KUNIT_CASE(match_all_not_assigned),
20282001
KUNIT_CASE(match_all_ptr_tag),
20292002
KUNIT_CASE(match_all_mem_tag),

0 commit comments

Comments
 (0)