ANDROID: vendor_hooks: Add hooks for mutex

Current might be preempt after spin_unlock(&lock->wait_lock),
we want to add a hook after wake_up_q(&wake_q) in which to
disable owner's privilege in scheduler.

Bug: 231647361
Change-Id: I3016da2fd31b8bdc8435df4e800f91381a64af4f
Signed-off-by: Liujie Xie <xieliujie@oppo.com>
This commit is contained in:
Liujie Xie 2022-05-06 14:04:56 +08:00
parent 0780756946
commit 2f55d5cbe2
3 changed files with 5 additions and 0 deletions

View File

@ -241,6 +241,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_sync_txn_recvd);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_build_sched_domains);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alter_mutex_list_add);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mutex_unlock_slowpath);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mutex_unlock_slowpath_end);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rwsem_wake_finish);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_do_undefinstr);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_do_ptrauth_fault);

View File

@ -54,6 +54,9 @@ DECLARE_HOOK(android_vh_alter_mutex_list_add,
DECLARE_HOOK(android_vh_mutex_unlock_slowpath,
TP_PROTO(struct mutex *lock),
TP_ARGS(lock));
DECLARE_HOOK(android_vh_mutex_unlock_slowpath_end,
TP_PROTO(struct mutex *lock, struct task_struct *next),
TP_ARGS(lock, next));
/* macro versions of hooks are no longer required */

View File

@ -1293,6 +1293,7 @@ static noinline void __sched __mutex_unlock_slowpath(struct mutex *lock, unsigne
spin_unlock(&lock->wait_lock);
wake_up_q(&wake_q);
trace_android_vh_mutex_unlock_slowpath_end(lock, next);
}
#ifndef CONFIG_DEBUG_LOCK_ALLOC