The patch titled Subject: kasan, mm: perform untagged pointers comparison in krealloc has been added to the -mm tree. Its filename is kasan-mm-perform-untagged-pointers-comparison-in-krealloc.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/kasan-mm-perform-untagged-pointers-comparison-in-krealloc.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/kasan-mm-perform-untagged-pointers-comparison-in-krealloc.patch 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 and is updated there every 3-4 working days ------------------------------------------------------ From: Andrey Konovalov <andreyknvl@xxxxxxxxxx> Subject: kasan, mm: perform untagged pointers comparison in krealloc The krealloc function checks where the same buffer was reused or a new one allocated by comparing kernel pointers. Tag-based KASAN changes memory tag on the krealloc'ed chunk of memory and therefore also changes the pointer tag of the returned pointer. Therefore we need to perform comparison on untagged (with tags reset) pointers to check whether it's the same memory region or not. Link: http://lkml.kernel.org/r/14f6190d7846186a3506cd66d82446646fe65090.1544099024.git.andreyknvl@xxxxxxxxxx Signed-off-by: Andrey Konovalov <andreyknvl@xxxxxxxxxx> Reviewed-by: Andrey Ryabinin <aryabinin@xxxxxxxxxxxxx> Reviewed-by: Dmitry Vyukov <dvyukov@xxxxxxxxxx> Cc: Christoph Lameter <cl@xxxxxxxxx> Cc: Mark Rutland <mark.rutland@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/slab_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/mm/slab_common.c~kasan-mm-perform-untagged-pointers-comparison-in-krealloc +++ a/mm/slab_common.c @@ -1534,7 +1534,7 @@ void *krealloc(const void *p, size_t new } ret = __do_krealloc(p, new_size, flags); - if (ret && p != ret) + if (ret && kasan_reset_tag(p) != kasan_reset_tag(ret)) kfree(p); return ret; _ Patches currently in -mm which might be from andreyknvl@xxxxxxxxxx are kasan-mm-change-hooks-signatures.patch kasan-slub-handle-pointer-tags-in-early_kmem_cache_node_alloc.patch kasan-move-common-generic-and-tag-based-code-to-commonc.patch kasan-rename-source-files-to-reflect-the-new-naming-scheme.patch kasan-add-config_kasan_generic-and-config_kasan_sw_tags.patch kasan-arm64-adjust-shadow-size-for-tag-based-mode.patch kasan-rename-kasan_zero_page-to-kasan_early_shadow_page.patch kasan-initialize-shadow-to-0xff-for-tag-based-mode.patch arm64-move-untagged_addr-macro-from-uaccessh-to-memoryh.patch kasan-add-tag-related-helper-functions.patch kasan-arm64-untag-address-in-_virt_addr_is_linear.patch kasan-preassign-tags-to-objects-with-ctors-or-slab_typesafe_by_rcu.patch kasan-arm64-fix-up-fault-handling-logic.patch kasan-arm64-enable-top-byte-ignore-for-the-kernel.patch kasan-mm-perform-untagged-pointers-comparison-in-krealloc.patch kasan-split-out-generic_reportc-from-reportc.patch kasan-add-bug-reporting-routines-for-tag-based-mode.patch mm-move-obj_to_index-to-include-linux-slab_defh.patch kasan-add-hooks-implementation-for-tag-based-mode.patch kasan-arm64-add-brk-handler-for-inline-instrumentation.patch kasan-mm-arm64-tag-non-slab-memory-allocated-via-pagealloc.patch kasan-add-__must_check-annotations-to-kasan-hooks.patch kasan-arm64-select-have_arch_kasan_sw_tags.patch kasan-update-documentation.patch kasan-add-spdx-license-identifier-mark-to-source-files.patch