1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #undef TRACE_SYSTEM 3 #define TRACE_SYSTEM binder 4 #undef TRACE_INCLUDE_PATH 5 #define TRACE_INCLUDE_PATH trace/hooks 6 #if !defined(_TRACE_HOOK_BINDER_H) || defined(TRACE_HEADER_MULTI_READ) 7 #define _TRACE_HOOK_BINDER_H 8 #include <linux/tracepoint.h> 9 #include <trace/hooks/vendor_hooks.h> 10 /* 11 * Following tracepoints are not exported in tracefs and provide a 12 * mechanism for vendor modules to hook and extend functionality 13 */ 14 #if defined(__GENKSYMS__) || !IS_ENABLED(CONFIG_ANDROID_BINDER_IPC) 15 struct binder_alloc; 16 struct binder_proc; 17 struct binder_thread; 18 struct binder_transaction; 19 struct binder_transaction_data; 20 struct binder_work; 21 struct binder_buffer; 22 #else 23 /* struct binder_alloc */ 24 #include <../drivers/android/binder_alloc.h> 25 /* struct binder_proc, struct binder_thread, struct binder_transaction */ 26 #include <../drivers/android/binder_internal.h> 27 #endif 28 29 #ifdef __GENKSYMS__ 30 struct task_struct; 31 struct seq_file; 32 #else 33 /* struct task_struct */ 34 #include <linux/sched.h> 35 /* struct seq_file */ 36 #include <linux/seq_file.h> 37 /* struct binder_transaction_data */ 38 #include <uapi/linux/android/binder.h> 39 #endif /* __GENKSYMS__ */ 40 41 DECLARE_HOOK(android_vh_binder_transaction_init, 42 TP_PROTO(struct binder_transaction *t), 43 TP_ARGS(t)); 44 DECLARE_HOOK(android_vh_binder_priority_skip, 45 TP_PROTO(struct task_struct *task, bool *skip), 46 TP_ARGS(task, skip)); 47 DECLARE_HOOK(android_vh_binder_set_priority, 48 TP_PROTO(struct binder_transaction *t, struct task_struct *task), 49 TP_ARGS(t, task)); 50 DECLARE_HOOK(android_vh_binder_restore_priority, 51 TP_PROTO(struct binder_transaction *t, struct task_struct *task), 52 TP_ARGS(t, task)); 53 DECLARE_HOOK(android_vh_binder_wakeup_ilocked, 54 TP_PROTO(struct task_struct *task, bool sync, struct binder_proc *proc), 55 TP_ARGS(task, sync, proc)); 56 DECLARE_HOOK(android_vh_binder_wait_for_work, 57 TP_PROTO(bool do_proc_work, struct binder_thread *tsk, struct binder_proc *proc), 58 TP_ARGS(do_proc_work, tsk, proc)); 59 DECLARE_HOOK(android_vh_sync_txn_recvd, 60 TP_PROTO(struct task_struct *tsk, struct task_struct *from), 61 TP_ARGS(tsk, from)); 62 DECLARE_HOOK(android_vh_binder_alloc_new_buf_locked, 63 TP_PROTO(size_t size, struct binder_alloc *alloc, int is_async), 64 TP_ARGS(size, alloc, is_async)); 65 DECLARE_HOOK(android_vh_binder_reply, 66 TP_PROTO(struct binder_proc *target_proc, struct binder_proc *proc, 67 struct binder_thread *thread, struct binder_transaction_data *tr), 68 TP_ARGS(target_proc, proc, thread, tr)); 69 DECLARE_HOOK(android_vh_binder_trans, 70 TP_PROTO(struct binder_proc *target_proc, struct binder_proc *proc, 71 struct binder_thread *thread, struct binder_transaction_data *tr), 72 TP_ARGS(target_proc, proc, thread, tr)); 73 DECLARE_RESTRICTED_HOOK(android_rvh_binder_transaction, 74 TP_PROTO(struct binder_proc *target_proc, struct binder_proc *proc, 75 struct binder_thread *thread, struct binder_transaction_data *tr), 76 TP_ARGS(target_proc, proc, thread, tr), 1); 77 DECLARE_HOOK(android_vh_binder_preset, 78 TP_PROTO(struct hlist_head *hhead, struct mutex *lock), 79 TP_ARGS(hhead, lock)); 80 DECLARE_HOOK(android_vh_binder_proc_transaction, 81 TP_PROTO(struct task_struct *caller_task, struct task_struct *binder_proc_task, 82 struct task_struct *binder_th_task, int node_debug_id, 83 unsigned int code, bool pending_async), 84 TP_ARGS(caller_task, binder_proc_task, binder_th_task, node_debug_id, code, pending_async)); 85 DECLARE_HOOK(android_vh_binder_proc_transaction_end, 86 TP_PROTO(struct task_struct *caller_task, struct task_struct *binder_proc_task, 87 struct task_struct *binder_th_task, unsigned int code, 88 bool pending_async, bool sync), 89 TP_ARGS(caller_task, binder_proc_task, binder_th_task, code, pending_async, sync)); 90 DECLARE_HOOK(android_vh_binder_new_ref, 91 TP_PROTO(struct task_struct *proc, uint32_t ref_desc, int node_debug_id), 92 TP_ARGS(proc, ref_desc, node_debug_id)); 93 DECLARE_HOOK(android_vh_binder_del_ref, 94 TP_PROTO(struct task_struct *proc, uint32_t ref_desc), 95 TP_ARGS(proc, ref_desc)); 96 DECLARE_HOOK(android_vh_binder_print_transaction_info, 97 TP_PROTO(struct seq_file *m, struct binder_proc *proc, 98 const char *prefix, struct binder_transaction *t), 99 TP_ARGS(m, proc, prefix, t)); 100 DECLARE_HOOK(android_vh_binder_looper_state_registered, 101 TP_PROTO(struct binder_thread *thread, struct binder_proc *proc), 102 TP_ARGS(thread, proc)); 103 DECLARE_HOOK(android_vh_binder_thread_read, 104 TP_PROTO(struct list_head **list, struct binder_proc *proc, 105 struct binder_thread *thread), 106 TP_ARGS(list, proc, thread)); 107 DECLARE_HOOK(android_vh_binder_free_proc, 108 TP_PROTO(struct binder_proc *proc), 109 TP_ARGS(proc)); 110 DECLARE_HOOK(android_vh_binder_thread_release, 111 TP_PROTO(struct binder_proc *proc, struct binder_thread *thread), 112 TP_ARGS(proc, thread)); 113 DECLARE_HOOK(android_vh_binder_read_done, 114 TP_PROTO(struct binder_proc *proc, struct binder_thread *thread), 115 TP_ARGS(proc, thread)); 116 DECLARE_HOOK(android_vh_binder_has_work_ilocked, 117 TP_PROTO(struct binder_thread *thread, bool do_proc_work, int *ret), 118 TP_ARGS(thread, do_proc_work, ret)); 119 DECLARE_HOOK(android_vh_binder_proc_transaction_finish, 120 TP_PROTO(struct binder_proc *proc, struct binder_transaction *t, 121 struct task_struct *binder_th_task, bool pending_async, bool sync), 122 TP_ARGS(proc, t, binder_th_task, pending_async, sync)); 123 DECLARE_HOOK(android_vh_alloc_oem_binder_struct, 124 TP_PROTO(struct binder_transaction_data *tr, struct binder_transaction *t, 125 struct binder_proc *proc), 126 TP_ARGS(tr, t, proc)); 127 DECLARE_HOOK(android_vh_binder_transaction_received, 128 TP_PROTO(struct binder_transaction *t, struct binder_proc *proc, 129 struct binder_thread *thread, uint32_t cmd), 130 TP_ARGS(t, proc, thread, cmd)); 131 DECLARE_HOOK(android_vh_free_oem_binder_struct, 132 TP_PROTO(struct binder_transaction *t), 133 TP_ARGS(t)); 134 DECLARE_HOOK(android_vh_binder_special_task, 135 TP_PROTO(struct binder_transaction *t, struct binder_proc *proc, 136 struct binder_thread *thread, struct binder_work *w, 137 struct list_head *head, bool sync, bool *special_task), 138 TP_ARGS(t, proc, thread, w, head, sync, special_task)); 139 DECLARE_HOOK(android_vh_binder_free_buf, 140 TP_PROTO(struct binder_proc *proc, struct binder_thread *thread, 141 struct binder_buffer *buffer), 142 TP_ARGS(proc, thread, buffer)); 143 DECLARE_HOOK(android_vh_binder_buffer_release, 144 TP_PROTO(struct binder_proc *proc, struct binder_thread *thread, 145 struct binder_buffer *buffer, bool has_transaction), 146 TP_ARGS(proc, thread, buffer, has_transaction)); 147 /* macro versions of hooks are no longer required */ 148 149 #endif /* _TRACE_HOOK_BINDER_H */ 150 /* This part must be outside protection */ 151 #include <trace/define_trace.h> 152