diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 24264e6e1e71..2ebcbd3121db 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -196,3 +196,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_selinux_is_initialized); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_mmap_file); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_file_open); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_bpf_syscall); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_set_cpus_allowed_ptr_locked); diff --git a/include/trace/hooks/sched.h b/include/trace/hooks/sched.h index 5288c4752f08..a80db4f8e305 100644 --- a/include/trace/hooks/sched.h +++ b/include/trace/hooks/sched.h @@ -267,6 +267,11 @@ DECLARE_RESTRICTED_HOOK(android_rvh_check_preempt_wakeup, TP_ARGS(rq, p, preempt, nopreempt, wake_flags, se, pse, next_buddy_marked, granularity), 1); +DECLARE_RESTRICTED_HOOK(android_rvh_set_cpus_allowed_ptr_locked, + TP_PROTO(const struct cpumask *cpu_valid_mask, const struct cpumask *new_mask, + unsigned int *dest_cpu), + TP_ARGS(cpu_valid_mask, new_mask, dest_cpu), 1); + DECLARE_HOOK(android_vh_free_task, TP_PROTO(struct task_struct *p), TP_ARGS(p)); diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 200e6804e690..191203599c8c 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -2844,6 +2844,8 @@ static int __set_cpus_allowed_ptr_locked(struct task_struct *p, * immediately required to distribute the tasks within their new mask. */ dest_cpu = cpumask_any_and_distribute(cpu_valid_mask, new_mask); + trace_android_rvh_set_cpus_allowed_ptr_locked(cpu_valid_mask, new_mask, &dest_cpu); + if (dest_cpu >= nr_cpu_ids) { ret = -EINVAL; goto out;