The patch titled Subject: kasan-slub-move-kasan_poison_slab-hook-before-page_address-v2 has been added to the -mm tree. Its filename is kasan-slub-move-kasan_poison_slab-hook-before-page_address-v2.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/kasan-slub-move-kasan_poison_slab-hook-before-page_address-v2.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/kasan-slub-move-kasan_poison_slab-hook-before-page_address-v2.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-slub-move-kasan_poison_slab-hook-before-page_address-v2 fix compilation error when CONFIG_SLUB_DEBUG=n Link: http://lkml.kernel.org/r/ac27cc0bbaeb414ed77bcd6671a877cf3546d56e.1550066133.git.andreyknvl@xxxxxxxxxx Signed-off-by: Andrey Konovalov <andreyknvl@xxxxxxxxxx> Cc: Alexander Potapenko <glider@xxxxxxxxxx> Cc: Andrey Ryabinin <aryabinin@xxxxxxxxxxxxx> Cc: Catalin Marinas <catalin.marinas@xxxxxxx> Cc: Christoph Lameter <cl@xxxxxxxxx> Cc: David Rientjes <rientjes@xxxxxxxxxx> Cc: Dmitry Vyukov <dvyukov@xxxxxxxxxx> Cc: Evgeniy Stepanov <eugenis@xxxxxxxxxx> Cc: Joonsoo Kim <iamjoonsoo.kim@xxxxxxx> Cc: Kostya Serebryany <kcc@xxxxxxxxxx> Cc: Pekka Enberg <penberg@xxxxxxxxxx> Cc: Qian Cai <cai@xxxxxx> Cc: Vincenzo Frascino <vincenzo.frascino@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/slub.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) --- a/mm/slub.c~kasan-slub-move-kasan_poison_slab-hook-before-page_address-v2 +++ a/mm/slub.c @@ -1075,6 +1075,16 @@ static void setup_object_debug(struct km init_tracking(s, object); } +static void setup_page_debug(struct kmem_cache *s, void *addr, int order) +{ + if (!(s->flags & SLAB_POISON)) + return; + + metadata_access_enable(); + memset(addr, POISON_INUSE, PAGE_SIZE << order); + metadata_access_disable(); +} + static inline int alloc_consistency_checks(struct kmem_cache *s, struct page *page, void *object, unsigned long addr) @@ -1330,6 +1340,8 @@ slab_flags_t kmem_cache_flags(unsigned i #else /* !CONFIG_SLUB_DEBUG */ static inline void setup_object_debug(struct kmem_cache *s, struct page *page, void *object) {} +static inline void setup_page_debug(struct kmem_cache *s, + void *addr, int order) {} static inline int alloc_debug_processing(struct kmem_cache *s, struct page *page, void *object, unsigned long addr) { return 0; } @@ -1647,11 +1659,7 @@ static struct page *allocate_slab(struct start = page_address(page); - if (unlikely(s->flags & SLAB_POISON)) { - metadata_access_enable(); - memset(start, POISON_INUSE, PAGE_SIZE << order); - metadata_access_disable(); - } + setup_page_debug(s, start, order); shuffle = shuffle_freelist(s, page); _ Patches currently in -mm which might be from andreyknvl@xxxxxxxxxx are kasan-fix-assigning-tags-twice.patch kasan-kmemleak-pass-tagged-pointers-to-kmemleak.patch kmemleak-account-for-tagged-pointers-when-calculating-pointer-range-v2.patch kasan-slub-move-kasan_poison_slab-hook-before-page_address.patch kasan-slub-move-kasan_poison_slab-hook-before-page_address-v2.patch kasan-slub-fix-conflicts-with-config_slab_freelist_hardened.patch