mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-29 13:23:23 +01:00
kasan: generic: introduce kasan_record_aux_stack_noalloc()
Introduce a variant of kasan_record_aux_stack() that does not do any memory allocation through stackdepot. This will permit using it in contexts that cannot allocate any memory. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Marco Elver <[email protected]> Tested-by: Shuah Khan <[email protected]> Acked-by: Sebastian Andrzej Siewior <[email protected]> Reviewed-by: Andrey Konovalov <[email protected]> Cc: Alexander Potapenko <[email protected]> Cc: Andrey Ryabinin <[email protected]> Cc: Dmitry Vyukov <[email protected]> Cc: "Gustavo A. R. Silva" <[email protected]> Cc: Lai Jiangshan <[email protected]> Cc: Taras Madan <[email protected]> Cc: Tejun Heo <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Vijayanand Jitta <[email protected]> Cc: Vinayak Menon <[email protected]> Cc: Walter Wu <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
1 parent
7594b34774
commit
7cb3007ce2
2 files changed
+14
-2
No files matched your search
@@ -370,12 +370,14 @@ static inline void kasan_unpoison_task_stack(struct task_struct *task) {}
|
||||
void kasan_cache_shrink(struct kmem_cache *cache);
|
||||
void kasan_cache_shutdown(struct kmem_cache *cache);
|
||||
void kasan_record_aux_stack(void *ptr);
|
||||
void kasan_record_aux_stack_noalloc(void *ptr);
|
||||
|
||||
#else /* CONFIG_KASAN_GENERIC */
|
||||
|
||||
static inline void kasan_cache_shrink(struct kmem_cache *cache) {}
|
||||
static inline void kasan_cache_shutdown(struct kmem_cache *cache) {}
|
||||
static inline void kasan_record_aux_stack(void *ptr) {}
|
||||
static inline void kasan_record_aux_stack_noalloc(void *ptr) {}
|
||||
|
||||
#endif /* CONFIG_KASAN_GENERIC */
|
||||
|
||||
|
||||
+12
-2
@@ -328,7 +328,7 @@ DEFINE_ASAN_SET_SHADOW(f3);
|
||||
DEFINE_ASAN_SET_SHADOW(f5);
|
||||
DEFINE_ASAN_SET_SHADOW(f8);
|
||||
|
||||
void kasan_record_aux_stack(void *addr)
|
||||
static void __kasan_record_aux_stack(void *addr, bool can_alloc)
|
||||
{
|
||||
struct page *page = kasan_addr_to_page(addr);
|
||||
struct kmem_cache *cache;
|
||||
@@ -345,7 +345,17 @@ 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, true);
|
||||
alloc_meta->aux_stack[0] = kasan_save_stack(GFP_NOWAIT, can_alloc);
|
||||
}
|
||||
|
||||
void kasan_record_aux_stack(void *addr)
|
||||
{
|
||||
return __kasan_record_aux_stack(addr, true);
|
||||
}
|
||||
|
||||
void kasan_record_aux_stack_noalloc(void *addr)
|
||||
{
|
||||
return __kasan_record_aux_stack(addr, false);
|
||||
}
|
||||
|
||||
void kasan_set_free_info(struct kmem_cache *cache,
|
||||
|
||||
Reference in new issue
Block a user