From 25917c05ab477bf60f8cf09acb1e9e89de3df61f Mon Sep 17 00:00:00 2001 From: Mohamad Alsadhan Date: Tue, 17 Mar 2026 17:49:46 +0300 Subject: rust_binder: add fd translation tracepoints Add Rust Binder tracepoint declarations for both `transaction_fd_send` and `transaction_fd_recv`. Also, wire in the corresponding trace calls where fd objects are serialised/deserialised. Signed-off-by: Mohamad Alsadhan Link: https://patch.msgid.link/20260317-rust-binder-trace-v3-5-6fae4fbcf637@sdhn.cc Signed-off-by: Greg Kroah-Hartman --- drivers/android/binder/trace.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'drivers/android/binder/trace.rs') diff --git a/drivers/android/binder/trace.rs b/drivers/android/binder/trace.rs index d96afdb79c65..c6f39d83314e 100644 --- a/drivers/android/binder/trace.rs +++ b/drivers/android/binder/trace.rs @@ -18,6 +18,8 @@ declare_trace! { unsafe fn binder_wait_for_work(proc_work: bool, transaction_stack: bool, thread_todo: bool); unsafe fn binder_transaction(reply: bool, t: rust_binder_transaction, thread: *mut task_struct); unsafe fn binder_transaction_received(t: rust_binder_transaction); + unsafe fn binder_transaction_fd_send(t_debug_id: c_int, fd: c_int, offset: usize); + unsafe fn binder_transaction_fd_recv(t_debug_id: c_int, fd: c_int, offset: usize); } #[inline] @@ -77,3 +79,14 @@ pub(crate) fn trace_transaction_received(t: &Transaction) { // SAFETY: The raw transaction is valid for the duration of this call. unsafe { binder_transaction_received(raw_transaction(t)) } } + +#[inline] +pub(crate) fn trace_transaction_fd_send(t_debug_id: usize, fd: u32, offset: usize) { + // SAFETY: This function is always safe to call. + unsafe { binder_transaction_fd_send(t_debug_id as c_int, fd as c_int, offset) } +} +#[inline] +pub(crate) fn trace_transaction_fd_recv(t_debug_id: usize, fd: u32, offset: usize) { + // SAFETY: This function is always safe to call. + unsafe { binder_transaction_fd_recv(t_debug_id as c_int, fd as c_int, offset) } +} -- cgit v1.2.3