From adebe26902e2a61e4678d10f68a45fd3e489ab7e Mon Sep 17 00:00:00 2001 From: Zqiang Date: Fri, 20 Nov 2020 06:53:11 -0800 Subject: [PATCH] UPSTREAM: rcu: Record kvfree_call_rcu() call stack for KASAN This commit adds a call to kasan_record_aux_stack() in kvfree_call_rcu() in order to record the call stack of the code that caused the object to be freed. Please note that this function does not update the allocated/freed state, which is important because RCU readers might still be referencing this object. Acked-by: Dmitry Vyukov Reviewed-by: Uladzislau Rezki (Sony) Signed-off-by: Zqiang Signed-off-by: Paul E. McKenney (cherry picked from commit 84109ab58590dc6c4e7eb36329fdc7ec121ed5a5) Bug: 217222520 Change-Id: Ia7c27babe4b2318ab116b508578c17e8967e70b1 Signed-off-by: Andrey Konovalov --- kernel/rcu/tree.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 844c35803739..2a8af69a0b20 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -3497,6 +3497,7 @@ void kvfree_call_rcu(struct rcu_head *head, rcu_callback_t func) goto unlock_return; } + kasan_record_aux_stack(ptr); success = kvfree_call_rcu_add_ptr_to_bulk(krcp, ptr); if (!success) { run_page_cache_worker(krcp);