The patch titled Subject: kasan: common: provide can_alloc in kasan_save_stack() has been added to the -mm tree. Its filename is kasan-common-provide-can_alloc-in-kasan_save_stack.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/kasan-common-provide-can_alloc-in-kasan_save_stack.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/kasan-common-provide-can_alloc-in-kasan_save_stack.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: Marco Elver <elver@xxxxxxxxxx> Subject: kasan: common: provide can_alloc in kasan_save_stack() Add another argument, can_alloc, to kasan_save_stack() which is passed as-is to __stack_depot_save(). No functional change intended. Link: https://lkml.kernel.org/r/20210913112609.2651084-5-elver@xxxxxxxxxx Signed-off-by: Marco Elver <elver@xxxxxxxxxx> Tested-by: Shuah Khan <skhan@xxxxxxxxxxxxxxxxxxx> Acked-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx> Cc: Alexander Potapenko <glider@xxxxxxxxxx> Cc: Andrey Konovalov <andreyknvl@xxxxxxxxx> Cc: Andrey Ryabinin <ryabinin.a.a@xxxxxxxxx> Cc: Dmitry Vyukov <dvyukov@xxxxxxxxxx> Cc: "Gustavo A. R. Silva" <gustavoars@xxxxxxxxxx> Cc: Lai Jiangshan <jiangshanlai@xxxxxxxxx> Cc: Taras Madan <tarasmadan@xxxxxxxxxx> Cc: Tejun Heo <tj@xxxxxxxxxx> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx> Cc: Vijayanand Jitta <vjitta@xxxxxxxxxxxxxx> Cc: Vinayak Menon <vinmenon@xxxxxxxxxxxxxx> Cc: Walter Wu <walter-zh.wu@xxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/kasan/common.c | 6 +++--- mm/kasan/generic.c | 2 +- mm/kasan/kasan.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) --- a/mm/kasan/common.c~kasan-common-provide-can_alloc-in-kasan_save_stack +++ a/mm/kasan/common.c @@ -30,20 +30,20 @@ #include "kasan.h" #include "../slab.h" -depot_stack_handle_t kasan_save_stack(gfp_t flags) +depot_stack_handle_t kasan_save_stack(gfp_t flags, bool can_alloc) { unsigned long entries[KASAN_STACK_DEPTH]; unsigned int nr_entries; nr_entries = stack_trace_save(entries, ARRAY_SIZE(entries), 0); nr_entries = filter_irq_stacks(entries, nr_entries); - return stack_depot_save(entries, nr_entries, flags); + return __stack_depot_save(entries, nr_entries, flags, can_alloc); } void kasan_set_track(struct kasan_track *track, gfp_t flags) { track->pid = current->pid; - track->stack = kasan_save_stack(flags); + track->stack = kasan_save_stack(flags, true); } #if defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS) --- a/mm/kasan/generic.c~kasan-common-provide-can_alloc-in-kasan_save_stack +++ a/mm/kasan/generic.c @@ -345,7 +345,7 @@ void kasan_record_aux_stack(void *addr) return; alloc_meta->aux_stack[1] = alloc_meta->aux_stack[0]; - alloc_meta->aux_stack[0] = kasan_save_stack(GFP_NOWAIT); + alloc_meta->aux_stack[0] = kasan_save_stack(GFP_NOWAIT, true); } void kasan_set_free_info(struct kmem_cache *cache, --- a/mm/kasan/kasan.h~kasan-common-provide-can_alloc-in-kasan_save_stack +++ a/mm/kasan/kasan.h @@ -251,7 +251,7 @@ void kasan_report_invalid_free(void *obj struct page *kasan_addr_to_page(const void *addr); -depot_stack_handle_t kasan_save_stack(gfp_t flags); +depot_stack_handle_t kasan_save_stack(gfp_t flags, bool can_alloc); void kasan_set_track(struct kasan_track *track, gfp_t flags); void kasan_set_free_info(struct kmem_cache *cache, void *object, u8 tag); struct kasan_track *kasan_get_free_track(struct kmem_cache *cache, _ Patches currently in -mm which might be from elver@xxxxxxxxxx are kasan-fix-kconfig-check-of-cc_has_working_nosanitize_address.patch lib-stackdepot-include-gfph.patch lib-stackdepot-remove-unused-function-argument.patch lib-stackdepot-introduce-__stack_depot_save.patch kasan-common-provide-can_alloc-in-kasan_save_stack.patch kasan-generic-introduce-kasan_record_aux_stack_noalloc.patch workqueue-kasan-avoid-alloc_pages-when-recording-stack.patch mm-fix-data-race-in-pagepoisoned.patch