lib-stacktrace-kasan-kmsan-rework-extra_bits-interface.patch removed from -mm tree
The quilt patch titled
Subject: lib/stacktrace, kasan, kmsan: rework extra_bits interface
has been removed from the -mm tree. Its filename was
lib-stacktrace-kasan-kmsan-rework-extra_bits-interface.patch
This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Andrey Konovalov <[email protected]>
Subject: lib/stacktrace, kasan, kmsan: rework extra_bits interface
Date: Fri, 10 Feb 2023 22:16:03 +0100
The current implementation of the extra_bits interface is confusing:
passing extra_bits to __stack_depot_save makes it seem that the extra bits are somehow stored in stack depot. In reality, they are only embedded into a stack depot handle and are not used within stack depot.
Drop the extra_bits argument from __stack_depot_save and instead provide a new stack_depot_set_extra_bits function (similar to the exsiting stack_depot_get_extra_bits) that saves extra bits into a stack depot handle.
Update the callers of __stack_depot_save to use the new interace.
This change also fixes a minor issue in the old code: __stack_depot_save does not return NULL if saving stack trace fails and extra_bits is used.
---
include/linux/stackdepot.h renamed from include/linux/stackdepot.h~lib-stacktrace-kasan-kmsan-rework-extra_bits-interface +3 -1
@@ -57,7 +57,6 @@ static inline int stack_depot_early_initdepot_stack_handle_t __stack_depot_save (unsigned long *entries,unsigned int nr_entries, -unsigned int extra_bits,gfp_t gfp_flags,bool can_alloc); depot_stack_handle_t stack_depot_save(unsigned long *entries,
@@ -71,6 +70,9 @@ void stack_depot_print(depot_stack_handlint stack_depot_snprint (depot_stack_handle_t handle,char *buf,size_t size,int spaces); +depot_stack_handle_t __must_check stack_depot_set_extra_bits ( +depot_stack_handle_t handle,unsigned int extra_bits); +unsigned int stack_depot_get_extra_bits (depot_stack_handle_t handle);#endif
lib/stackdepot.c renamed from lib/stackdepot.c~lib-stacktrace-kasan-kmsan-rework-extra_bits-interface +33 -9
78 lines not on this page · raw message
mm/kasan/common.c renamed from mm/kasan/common.c~lib-stacktrace-kasan-kmsan-rework-extra_bits-interface +1 -1
@@ -43,7 +43,7 @@ depot_stack_handle_t kasan_save_stack(gfunsigned int nr_entries; nr_entries =stack_trace_save (entries,ARRAY_SIZE (entries),0 ); -return __stack_depot_save (entries, nr_entries,0 , flags, can_alloc); +return __stack_depot_save (entries, nr_entries, flags, can_alloc); }void kasan_set_track (struct kasan_track *track,gfp_t flags)
mm/kmsan/core.c renamed from mm/kmsan/core.c~lib-stacktrace-kasan-kmsan-rework-extra_bits-interface +7 -3
@@ -69,13 +69,15 @@ depot_stack_handle_t kmsan_save_stack_wi {unsigned long entries[KMSAN_STACK_DEPTH ];unsigned int nr_entries; +depot_stack_handle_t handle; nr_entries =stack_trace_save (entries,KMSAN_STACK_DEPTH ,0 );/* Don't sleep (see might_sleep_if() in __alloc_pages_nodemask()). */ flags &= ~__GFP_DIRECT_RECLAIM; -return __stack_depot_save (entries, nr_entries, extra, flags, true); + handle =__stack_depot_save (entries, nr_entries, flags, true); +return stack_depot_set_extra_bits (handle, extra); }/* Copy the metadata following the memmove() behavior. */
@@ -215,6 +217,7 @@ depot_stack_handle_t kmsan_internal_chaiu32 extra_bits;int depth;bool uaf; +depot_stack_handle_t handle;if (!id)return id;
@@ -250,8 +253,9 @@ depot_stack_handle_t kmsan_internal_chai* positives when __stack_depot_save() passes it to instrumented code. */ kmsan_internal_unpoison_memory (entries,sizeof (entries), false); -return __stack_depot_save (entries,ARRAY_SIZE (entries), extra_bits, -GFP_ATOMIC , true); + handle =__stack_depot_save (entries,ARRAY_SIZE (entries),GFP_ATOMIC , + true); +return stack_depot_set_extra_bits (handle, extra_bits); } void kmsan_internal_set_shadow_origin(void *addr, size_t size, int b,
_
Patches currently in -mm which might be from [email protected] are