Annotated. Every entry says why you would open it, not just what it is called.
No line numbers appear anywhere in this chapter. They move every release, and a confident wrong
line number is worse than none at all. File paths in AOSP and in the Linux tree are stable and are
cited freely.
The whole driver. binder_ioctl dispatches; binder_thread_write consumes the BC_ stream; binder_thread_read produces the BR_ stream; binder_transaction() is the function that matters — it allocates in the target's mapping, copies the parcel, translates every embedded object, and assigns t->sender_euid = task_euid(proc->tsk). That one assignment is why README §3.11 is true
drivers/android/binder_alloc.c
binder_alloc_mmap_handler() records the mapping and sets free_async_space to half of it; binder_alloc_new_buf() is the best-fit allocator whose failure becomes BR_FAILED_REPLY and eventually TransactionTooLargeException. Read this before arguing about the 1 MB limit
drivers/android/binder_alloc.h
The free-list and buffer structures the allocator manages
drivers/android/binderfs.c
Why /dev/binder is a symlink on modern devices, and where binder_logs went
include/uapi/linux/android/binder.h
The user-space ABI: every structure and constant transcribed in README §3 and in examples/binder-probe.c. This is the authoritative list of BC_, BR_, TF_ and BINDER_TYPE_ values
include/uapi/linux/android/binderfs.h
binderfs mount options and device control
security/selinux/hooks.c
selinux_binder_transaction and selinux_binder_transfer_binder — the LSM hooks behind the binder:call and binder:transfer checks. The policy side is 22 — SELinux
Browse at https://android.googlesource.com/kernel/common/ or, for the mainline versions,
https://git.kernel.org/. The Android common kernels are the ones that ship on devices.
open("/dev/binder"), BINDER_VERSION, BINDER_SET_MAX_THREADS, and the mmap of BINDER_VM_SIZE. The definition of that constant is the answer to "why 1040384 bytes"
frameworks/native/libs/binder/IPCThreadState.cpp
transact(), writeTransactionData(), waitForResponse(), talkWithDriver() — the single place the ioctl happens — and executeCommand(), where mCallingUid and mCallingPid are set from the kernel's fields. Also clearCallingIdentity() and restoreCallingIdentity(), which are ten lines and worth reading in full
frameworks/native/libs/binder/Parcel.cpp
writeInterfaceToken() and enforceInterface() — the four-field header measured in README §3.16; writeString16(); flattenBinder()/unflattenBinder(), which is where the BC_ACQUIRE-before-BC_FREE_BUFFER rule lives; ipcSetDataReference(), the "single copy"
frameworks/native/libs/binder/Binder.cpp
BBinder::transact and the default onTransact that answers '_NTF', '_PNG', '_DMP' and '_CMD' on every object in the system. Also BBinder::shellCommand
frameworks/native/libs/binder/BpBinder.cpp
The client-side proxy: the handle number, transact(), and death-recipient bookkeeping
frameworks/native/libs/binder/Stability.cpp
The trailing int32 that appears after every writeStrongBinder — the 0c000000 in the measured dump in README §3.7.3
frameworks/native/libs/binder/IServiceManager.cpp
The client side of name resolution, including the retry loop that makes getService different from checkService
addService's two gates — the AID_APP numeric refusal and the SELinux service_manager:add check — plus getService, checkService, listServices and getServiceDebugInfo
frameworks/native/cmds/servicemanager/Access.cpp
canAdd, canFind, canList.the caller's context comes from IPCThreadState, i.e. from the kernel, not from the parcel
frameworks/native/cmds/servicemanager/main.cpp
Where BINDER_SET_CONTEXT_MGR is issued, making this process handle 0
Method order equals transaction code. getService is 1, checkService is 2, addService is 3, listServices is 4
frameworks/native/cmds/service/service.cpp
What service list and service call actually send. Crucially, it calls data.writeInterfaceToken(service->getInterfaceDescriptor()) for you — see FAQ 13 — and its argument vocabulary (i32, s16, afd, …) is the whole of what the tool can express
frameworks/native/cmds/dumpsys/dumpsys.cpp
dumpsys is '_DMP' plus a file descriptor and an argument array. Nothing more
frameworks/native/cmds/cmd/cmd.cpp
cmd is '_CMD' plus three real descriptors, an argument array, a ShellCallback and a ResultReceiver
frameworks/native/cmds/lshal/
The hwbinder equivalent of service list, and unlike it, lshal reports pids
writeException/readException and the exception-code table; writeStackTrace, which appends the remote trace that makes a refusal so informative; writeInterfaceToken
frameworks/base/core/jni/android_util_Binder.cpp
The JNI bridge. android_os_Binder_getCallingUid returns the IPCThreadState value straight through. signalExceptionForError is where the 200 KiB heuristic lives that decides whether FAILED_TRANSACTION becomes TransactionTooLargeException or DeadObjectException — and its comment admits the driver cannot distinguish the causes
A raw /dev/binder client in C: no libbinder, no Java. Builds a checkService transaction by hand, decodes the reply's flat_binder_object, and demonstrates that sender_euid cannot be forged. Compiles clean with -Wall -Wextra and was run on a physical device
Owns the IPC attack surface — what is reachable, abstract sockets, localhost, providers, and the enumeration methodology. It tells you what to attack; this chapter explains how the transport works. Its §3.21.2 catalogues the four clearCallingIdentity misuse patterns at application level; §3.12 here owns the mechanism underneath them
Owns the two-stage service_manager:find plus binder:call decision, which runs in the kernel before delivery. Cited throughout this chapter and deliberately not restaged
Owns Intents, implicit resolution and redirection. Every Intent travels inside a Binder transaction, and an IBinder in an extra is a delegated capability