]> Git Repo - linux.git/commit
kasan: handle concurrent kasan_record_aux_stack calls
authorAndrey Konovalov <[email protected]>
Tue, 19 Dec 2023 21:19:51 +0000 (22:19 +0100)
committerAndrew Morton <[email protected]>
Fri, 29 Dec 2023 19:58:41 +0000 (11:58 -0800)
commita414d4286f3400aa05631c4931eb3feba83e29e8
tree44095dcb97d398bb82d6de0ad8a9f8f823599495
parenta914d8d6cf204287aa2dfb9235d29d7944ad72a1
kasan: handle concurrent kasan_record_aux_stack calls

kasan_record_aux_stack can be called concurrently on the same object.
This might lead to a race condition when rotating the saved aux stack
trace handles, which in turns leads to incorrect accounting of stack depot
handles and refcount underflows in the stack depot code.

Fix by introducing a raw spinlock to protect the aux stack trace handles
in kasan_record_aux_stack.

Link: https://lkml.kernel.org/r/1606b960e2f746862d1f459515972f9695bf448a.1703020707.git.andreyknvl@google.com
Fixes: 773688a6cb24 ("kasan: use stack_depot_put for Generic mode")
Signed-off-by: Andrey Konovalov <[email protected]>
Reported-by: Tetsuo Handa <[email protected]>
Reported-by: [email protected]
Closes: https://lore.kernel.org/all/[email protected]/
Reviewed-by: Marco Elver <[email protected]>
Cc: Alexander Potapenko <[email protected]>
Cc: Dmitry Vyukov <[email protected]>
Cc: Evgenii Stepanov <[email protected]>
Cc: Vlastimil Babka <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
mm/kasan/generic.c
mm/kasan/kasan.h
This page took 0.050064 seconds and 4 git commands to generate.