The patch titled Subject: lib/stackdepot: fix setting next_slab_inited in init_stack_slab has been added to the -mm mm-nonmm-unstable branch. Its filename is lib-stackdepot-fix-setting-next_slab_inited-in-init_stack_slab.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/lib-stackdepot-fix-setting-next_slab_inited-in-init_stack_slab.patch This patch will later appear in the mm-nonmm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm 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 via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Andrey Konovalov <andreyknvl@xxxxxxxxxx> Subject: lib/stackdepot: fix setting next_slab_inited in init_stack_slab Date: Mon, 30 Jan 2023 21:49:25 +0100 Patch series "lib/stackdepot: fixes and clean-ups". A set of fixes, comments, and clean-ups I came up with while reading the stack depot code. This patch (of 18): In commit 305e519ce48e ("lib/stackdepot.c: fix global out-of-bounds in stack_slabs"), init_stack_slab was changed to only use preallocated memory for the next slab if the slab number limit is not reached. However, setting next_slab_inited was not moved together with updating stack_slabs. Set next_slab_inited only if the preallocated memory was used for the next slab. Link: https://lkml.kernel.org/r/cover.1675111415.git.andreyknvl@xxxxxxxxxx Link: https://lkml.kernel.org/r/9fbb4d2bf9b2676a29b120980b5ffbda8e2304ee.1675111415.git.andreyknvl@xxxxxxxxxx Fixes: 305e519ce48e ("lib/stackdepot.c: fix global out-of-bounds in stack_slabs") Signed-off-by: Andrey Konovalov <andreyknvl@xxxxxxxxxx> Cc: Alexander Potapenko <glider@xxxxxxxxxx> Cc: Evgenii Stepanov <eugenis@xxxxxxxxxx> Cc: Marco Elver <elver@xxxxxxxxxx> Cc: Vlastimil Babka <vbabka@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- --- a/lib/stackdepot.c~lib-stackdepot-fix-setting-next_slab_inited-in-init_stack_slab +++ a/lib/stackdepot.c @@ -105,12 +105,13 @@ static bool init_stack_slab(void **preal if (depot_index + 1 < STACK_ALLOC_MAX_SLABS) { stack_slabs[depot_index + 1] = *prealloc; *prealloc = NULL; + /* + * This smp_store_release pairs with smp_load_acquire() + * from |next_slab_inited| above and in + * stack_depot_save(). + */ + smp_store_release(&next_slab_inited, 1); } - /* - * This smp_store_release pairs with smp_load_acquire() from - * |next_slab_inited| above and in stack_depot_save(). - */ - smp_store_release(&next_slab_inited, 1); } return true; } _ Patches currently in -mm which might be from andreyknvl@xxxxxxxxxx are kasan-reset-page-tags-properly-with-sampling.patch kasan-reset-page-tags-properly-with-sampling-v2.patch lib-stackdepot-fix-setting-next_slab_inited-in-init_stack_slab.patch lib-stackdepot-put-functions-in-logical-order.patch lib-stackdepot-use-pr_fmt-to-define-message-format.patch lib-stackdepot-mm-rename-stack_depot_want_early_init.patch lib-stackdepot-rename-stack_depot_disable.patch lib-stackdepot-annotate-init-and-early-init-functions.patch lib-stackdepot-lower-the-indentation-in-stack_depot_init.patch lib-stackdepot-reorder-and-annotate-global-variables.patch lib-stackdepot-rename-hash-table-constants-and-variables.patch lib-stackdepot-rename-init_stack_slab.patch lib-stackdepot-rename-slab-variables.patch lib-stackdepot-rename-handle-and-slab-constants.patch lib-stacktrace-drop-impossible-warn_on-for-depot_init_slab.patch lib-stackdepot-annotate-depot_init_slab-and-depot_alloc_stack.patch lib-stacktrace-kasan-kmsan-rework-extra_bits-interface.patch lib-stackdepot-annotate-racy-slab_index-accesses.patch lib-stackdepot-various-comments-clean-ups.patch lib-stackdepot-move-documentation-comments-to-stackdepoth.patch