How to debug Android Binder to track struct binder_node reference count changes?

2026-07-04

Stack Overflow: View Question

Tags: debugging, kernel, android-binder

Score: 0 | Views: 39

The asker is doing Android Binder vulnerability research and wants to observe the reference count on struct binder_node as it changes at runtime. The concern is real: Binder refcount bugs (UAF via binder_inc_ref/binder_dec_ref mismatches) have produced some of the most impactful Android LPEs of the last decade (CVE-2019-2215, CVE-2022-20421). Verifying that strong and weak counters increment/decrement symmetrically is exactly the kind of question that separates a curious researcher from a shipped exploit.

Why it's hard: Binder is hot. Every IPC on Android touches it, so naive instrumentation floods your logs and changes timing enough to hide races. binder_node lives inside binder_proc, guarded by proc->inner_lock, and refs come in four flavors (strong/weak, internal/user-visible). You have to distinguish them or your data is noise.

Approach — layered, from cheapest to heaviest:

Gotchas:

The challenge: Binder refcount bugs are exploitable and famous, but instrumenting a hot IPC path without perturbing the timing (or drowning in noise) is a real craft problem in kernel observability.

All newsletters