binder_get_n...refs_for_txn(9)
π binder_get_n...refs_for_txn(9) β from the Kernel API Manual β¨
okay so bestie, welcome to the binder_get_n...refs_for_txn page, straight out of the Kernel API Manual, and honestly? she's carrying the whole Android binder refcount situation on her back. let's get into it π«Ά
πΈ NAME πΈ
binder_get_node_refs_for_txn β literally the function that gets the required refs on a node for a txn (yes that's the whole job, and yes she does it flawlessly π
)
π¦ SYNOPSIS π¦
struct binder_node * binder_get_node_refs_for_txn (struct binder_node
*node , struct binder_proc **procp , uint32_t *error );
no cap, that's the whole signature. take it in. β
π ARGUMENTS π
nodeβ thestruct binder_nodeyou want to get refs for. the main character of this whole operation πprocpβ returnsnode->procif it's valid. she's the output param, she's doing her best π¦errorβ if there's noprocp, this bad boy returnsBR_DEAD_REPLYπ
π₯ DESCRIPTION π₯
so like, normally user-space keeps the node alive when it's creating a transaction, because it has a reference to the target. the local strong ref keeps it alive if the sending process dies before the target process even gets around to processing the transaction. that's the happy path, and it slays π
but (and this is the important part, bestie, don't skip it π) β if the source process is malicious, or has a reference counting bug, then relying on that local strong ref can genuinely fail. it's giving "trust issues" fr fr.
and since user-space can cause the local strong ref to justβ¦ go away π we also take a tmpref on the node, so it survives while we're constructing the transaction. we also need a tmpref on the proc while we're constructing the transaction, so we take that here as well. two tmprefs, one construction phase, iconic behavior β¨
π RETURN π
returns the target node with refs taken β or NULL if there's no node->proc. it also sets procp if it's valid. π
and if node->proc is NULL, which means the target proc has died? error gets set to BR_DEAD_REPLY. so likeβ¦ rip to that transaction, but at least you know why π
π SEE ALSO π
she has so many friends, it's honestly a whole group chat. all of these are in the kernel file ./drivers/android/binder.c:
binder_proc_lock(9)binder_proc_unlock(9)binder_inner_proc_lock(9)binder_inner_proc_unlock(9)binder_node_lock(9)binder_node_unlock(9)binder_node_inner_lock(9)binder_node_inner_unlock(9)binder_worklist_empty(9)binder_enqueue_work_ilocked(9)binder_enqueue_deferred_thread_work_ilocked(9)binder_enqueue_thread_work_ilocked(9)binder_enqueue_thread_work(9)binder_dequeue_work(9)binder_select_thread_ilocked(9)binder_wakeup_thread_ilocked(9)binder_inc_node_tmpref(9)binder_dec_node_tmpref(9)binder_get_ref_for_node_olocked(9)binder_inc_ref_olocked(9)binder_dec_ref_olocked(9)binder_get_node_from_ref(9)binder_free_ref(9)binder_update_ref_for_handle(9)binder_dec_ref_for_handle(9)binder_inc_ref_for_node(9)binder_thread_dec_tmpref(9)binder_proc_dec_tmpref(9)binder_get_txn_from(9)binder_get_txn_from_and_acq_inner(9)binder_free_txn_fixups(9)binder_cleanup_transaction(9)binder_get_object(9)binder_validate_ptr(9)binder_validate_fixup(9)struct binder_task_work_cb(9)binder_do_fd_close(9)binder_deferred_fd_close(9)struct binder_ptr_fixup(9)struct binder_sg_copy(9)binder_do_deferred_txn_copies(9)binder_cleanup_deferred_txn_lists(9)binder_defer_copy(9)binder_add_fixup(9)binder_can_update_transaction(9)binder_find_outdated_transaction_ilocked(9)binder_proc_transaction(9)binder_netlink_report(9)binder_free_buf(9)binder_apply_fd_fixups(9)print_next_binder_node_ilocked(9)
iykyk π
ok that's the whole page bestie, go forth and take your refs responsibly π
and that's a wrap! this lil page comes to you from ./drivers/android, dated October 2026, and the title is binder_get_n...refs_for_txn(9) β mwah, bye, ily, don't leak your refs π§ββοΈπ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms