This patch series is the continuation of [1] the previous discussion
related to the KASAN internal refactoring.
Here we remove kasan_enabled() checks which are duplicated by higher callers.
These checks deduplication are also related to the separate patch series [2].
[1] https://lore.kernel.org/all/CA+fCnZce3AR+pUesbDkKMtMJ+iR8eDrcjFTbVpAcwjBoZ=gJnQ@mail.gmail.com/
[2] https://lore.kernel.org/all/aNTfPjS2buXMI46D@MiWiFi-R3L-srv/
* Altered functions:
check_page_allocation
Delete the check because callers have it already in __wrappers in
include/linux/kasan.h:
__kasan_kfree_large
__kasan_mempool_poison_pages
__kasan_mempool_poison_object
kasan_populate_vmalloc, kasan_release_vmalloc
Add __wrappers in include/linux/kasan.h.
They are called externally in mm/vmalloc.c.
__kasan_unpoison_vmalloc, __kasan_poison_vmalloc
Delete checks because there're already kasan_enabled() checks
in respective __wrappers in include/linux/kasan.h.
release_free_meta -- Delete the check because the higher caller path
has it already. See the stack trace:
__kasan_slab_free -- has the check already
__kasan_mempool_poison_object -- has the check already
poison_slab_object
kasan_save_free_info
release_free_meta
kasan_enabled() -- Delete here
* Other mm/kasan/* functions with kasan_enabled()
where callers are defined in internal mm/kasan/kasan.h:
mm/kasan/generic.c:
kasan_check_range
check_region_inline
kasan_byte_accessible
mm/kasan/shadow.c:
kasan_poison
kasan_poison_last_granule
mm/kasan/kasan_test_c.c:
kasan_suite_init
== Tests:
* ARCH=um defconfig (-e KASAN, selects ARCH_DEFER_KASAN)
Compiled and run ./linux with no issue
* ARCH=powerpc ppc64le_defconfig (-e KASAN, selects ARCH_DEFER_KASAN)
Compiled and run qemu-system-ppc64 with no issue
* ARCH=arm64 defconfig (-e KASAN_GENERIC) and KUnit tests:
[ 4.065375] # kasan: pass:61 fail:1 skip:14 total:76
[ 4.065529] # Totals: pass:61 fail:1 skip:14 total:76
[ 4.065682] not ok 1 kasan
1 test is failing:
[ 3.772739] # kasan_strings: EXPECTATION FAILED at mm/kasan/kasan_test_c.c:1700
[ 3.772739] KASAN failure expected in "strscpy(ptr, src + KASAN_GRANULE_SIZE, KASAN_GRANULE_SIZE)", but none occurred
which is also reproducable in the main tree.
Sabyrzhan Tasbolatov (2):
kasan: remove __kasan_save_free_info wrapper
kasan: cleanup of kasan_enabled() checks
include/linux/kasan.h | 20 ++++++++++++++++++--
mm/kasan/common.c | 3 ---
mm/kasan/generic.c | 5 +----
mm/kasan/kasan.h | 7 +------
mm/kasan/shadow.c | 20 ++++----------------
mm/kasan/tags.c | 2 +-
6 files changed, 25 insertions(+), 32 deletions(-)
--
2.34.1