The patch titled Subject: kasan: make tag based mode work with CONFIG_HARDENED_USERCOPY has been added to the -mm tree. Its filename is kasan-make-tag-based-mode-work-with-config_hardened_usercopy.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/kasan-make-tag-based-mode-work-with-config_hardened_usercopy.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/kasan-make-tag-based-mode-work-with-config_hardened_usercopy.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: make tag based mode work with CONFIG_HARDENED_USERCOPY With CONFIG_HARDENED_USERCOPY enabled __check_heap_object() compares and then subtracts a potentially tagged pointer with a non-tagged address of the page that this pointer belongs to, which leads to unexpected behavior. Untag the pointer in __check_heap_object() before doing any of these operations. Link: http://lkml.kernel.org/r/7e756a298d514c4482f52aea6151db34818d395d.1546540962.git.andreyknvl@xxxxxxxxxx Signed-off-by: Andrey Konovalov <andreyknvl@xxxxxxxxxx> Cc: Andrey Ryabinin <aryabinin@xxxxxxxxxxxxx> Cc: Christoph Lameter <cl@xxxxxxxxx> Cc: Dmitry Vyukov <dvyukov@xxxxxxxxxx> Cc: Mark Rutland <mark.rutland@xxxxxxx> Cc: Vincenzo Frascino <vincenzo.frascino@xxxxxxx> Cc: Will Deacon <will.deacon@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/slub.c | 2 ++ 1 file changed, 2 insertions(+) --- a/mm/slub.c~kasan-make-tag-based-mode-work-with-config_hardened_usercopy +++ a/mm/slub.c @@ -3846,6 +3846,8 @@ void __check_heap_object(const void *ptr unsigned int offset; size_t object_size; + ptr = kasan_reset_tag(ptr); + /* Find object and usable object size. */ s = page->slab_cache; _ Patches currently in -mm which might be from andreyknvl@xxxxxxxxxx are kasan-arm64-use-arch_slab_minalign-instead-of-manual-aligning.patch kasan-make-tag-based-mode-work-with-config_hardened_usercopy.patch kasan-fix-krealloc-handling-for-tag-based-mode.patch