The patch titled Subject: revert kasan-remove-kfence-leftovers has been removed from the -mm tree. Its filename was kfence-kasan-make-kfence-compatible-with-kasan-fix.patch This patch was dropped because it was folded into kfence-kasan-make-kfence-compatible-with-kasan.patch ------------------------------------------------------ From: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Subject: revert kasan-remove-kfence-leftovers Signed-off-by: Marco Elver <elver@xxxxxxxxxx> Signed-off-by: Alexander Potapenko <glider@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/kasan/kasan.h | 9 +++++++++ mm/kasan/shadow.c | 13 +++++++++++++ 2 files changed, 22 insertions(+) --- a/mm/kasan/kasan.h~kfence-kasan-make-kfence-compatible-with-kasan-fix +++ a/mm/kasan/kasan.h @@ -3,6 +3,7 @@ #define __MM_KASAN_KASAN_H #include <linux/kasan.h> +#include <linux/kfence.h> #include <linux/stackdepot.h> #ifdef CONFIG_KASAN_HW_TAGS @@ -319,12 +320,20 @@ static inline u8 kasan_random_tag(void) static inline void kasan_poison(const void *address, size_t size, u8 value) { + /* Skip KFENCE memory if called explicitly outside of sl*b. */ + if (is_kfence_address(address)) + return; + hw_set_mem_tag_range(kasan_reset_tag(address), round_up(size, KASAN_GRANULE_SIZE), value); } static inline void kasan_unpoison(const void *address, size_t size) { + /* Skip KFENCE memory if called explicitly outside of sl*b. */ + if (is_kfence_address(address)) + return; + hw_set_mem_tag_range(kasan_reset_tag(address), round_up(size, KASAN_GRANULE_SIZE), get_tag(address)); } --- a/mm/kasan/shadow.c~kfence-kasan-make-kfence-compatible-with-kasan-fix +++ a/mm/kasan/shadow.c @@ -13,6 +13,7 @@ #include <linux/init.h> #include <linux/kasan.h> #include <linux/kernel.h> +#include <linux/kfence.h> #include <linux/kmemleak.h> #include <linux/memory.h> #include <linux/mm.h> @@ -84,6 +85,10 @@ void kasan_poison(const void *address, s address = kasan_reset_tag(address); size = round_up(size, KASAN_GRANULE_SIZE); + /* Skip KFENCE memory if called explicitly outside of sl*b. */ + if (is_kfence_address(address)) + return; + shadow_start = kasan_mem_to_shadow(address); shadow_end = kasan_mem_to_shadow(address + size); @@ -102,6 +107,14 @@ void kasan_unpoison(const void *address, */ address = kasan_reset_tag(address); + /* + * Skip KFENCE memory if called explicitly outside of sl*b. Also note + * that calls to ksize(), where size is not a multiple of machine-word + * size, would otherwise poison the invalid portion of the word. + */ + if (is_kfence_address(address)) + return; + kasan_poison(address, size, tag); if (size & KASAN_GRANULE_MASK) { _ Patches currently in -mm which might be from akpm@xxxxxxxxxxxxxxxxxxxx are kfence-kasan-make-kfence-compatible-with-kasan.patch lib-stackdepot-add-support-to-disable-stack-depot-fix.patch seq_file-document-how-per-entry-resources-are-managed-fix.patch initramfs-panic-with-memory-information-fix.patch mm-page_allocc-refactor-initialization-of-struct-page-for-holes-in-memory-layout-fix.patch mm.patch mm-vmstat-fix-proc-sys-vm-stat_refresh-generating-false-warnings-fix-2.patch linux-next-rejects.patch linux-next-git-rejects.patch kernel-forkc-export-kernel_thread-to-modules.patch