From 8e18f834cceb52e6243d81b1f8f299ac0d7513fe Mon Sep 17 00:00:00 2001 From: Yunji Kim Date: Thu, 10 May 2018 13:54:11 +0900 Subject: [PATCH] [COMMON] binder: add to print process name in the log and debugfs Change-Id: I0715f5c8a6296d80a3bb8e55c7fa0f5060141f6e Signed-off-by: Yunji Kim --- drivers/android/binder.c | 419 ++++++++++++++++++++++----------------- 1 file changed, 232 insertions(+), 187 deletions(-) diff --git a/drivers/android/binder.c b/drivers/android/binder.c index f25ca2f9cd84..5d3f1ac11b95 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -230,6 +230,10 @@ struct binder_transaction_log_entry { uint32_t return_error; uint32_t return_error_param; const char *context_name; + const char *from_proc_name; + const char *from_thread_name; + const char *to_proc_name; + const char *to_thread_name; }; struct binder_transaction_log { atomic_t cur; @@ -1289,8 +1293,8 @@ static void binder_do_set_priority(struct task_struct *task, long min_nice = rlimit_to_nice(task_rlimit(task, RLIMIT_NICE)); if (min_nice > MAX_NICE) { - binder_user_error("%d RLIMIT_NICE not set\n", - task->pid); + binder_user_error("%d(%s) RLIMIT_NICE not set\n", + task->pid, task->comm); return; } else if (priority < min_nice) { priority = min_nice; @@ -1300,8 +1304,8 @@ static void binder_do_set_priority(struct task_struct *task, if (policy != desired.sched_policy || to_kernel_prio(policy, priority) != desired.prio) binder_debug(BINDER_DEBUG_PRIORITY_CAP, - "%d: priority %d not allowed, using %d instead\n", - task->pid, desired.prio, + "%d(%s): priority %d not allowed, using %d instead\n", + task->pid, task->comm, desired.prio, to_kernel_prio(policy, priority)); trace_binder_set_priority(task->tgid, task->pid, task->normal_prio, @@ -1463,8 +1467,8 @@ static struct binder_node *binder_init_node_ilocked( INIT_LIST_HEAD(&node->work.entry); INIT_LIST_HEAD(&node->async_todo); binder_debug(BINDER_DEBUG_INTERNAL_REFS, - "%d:%d node %d u%016llx c%016llx created\n", - proc->pid, current->pid, node->debug_id, + "%d:%d(%s:%s) node %d u%016llx c%016llx created\n", + proc->pid, current->pid, proc->tsk->comm, current->comm, node->debug_id, (u64)node->ptr, (u64)node->cookie); return node; @@ -1807,8 +1811,8 @@ static struct binder_ref *binder_get_ref_for_node_olocked( hlist_add_head(&new_ref->node_entry, &node->refs); binder_debug(BINDER_DEBUG_INTERNAL_REFS, - "%d new ref %d desc %d for node %d\n", - proc->pid, new_ref->data.debug_id, new_ref->data.desc, + "%d(%s) new ref %d desc %d for node %d\n", + proc->pid, proc->tsk->comm, new_ref->data.debug_id, new_ref->data.desc, node->debug_id); binder_node_unlock(node); return new_ref; @@ -1819,8 +1823,8 @@ static void binder_cleanup_ref_olocked(struct binder_ref *ref) bool delete_node = false; binder_debug(BINDER_DEBUG_INTERNAL_REFS, - "%d delete ref %d desc %d for node %d\n", - ref->proc->pid, ref->data.debug_id, ref->data.desc, + "%d(%s) delete ref %d desc %d for node %d\n", + ref->proc->pid, ref->proc->tsk->comm, ref->data.debug_id, ref->data.desc, ref->node->debug_id); rb_erase(&ref->rb_node_desc, &ref->proc->refs_by_desc); @@ -1847,8 +1851,8 @@ static void binder_cleanup_ref_olocked(struct binder_ref *ref) if (ref->death) { binder_debug(BINDER_DEBUG_DEAD_BINDER, - "%d delete ref %d desc %d has death notification\n", - ref->proc->pid, ref->data.debug_id, + "%d(%s) delete ref %d desc %d has death notification\n", + ref->proc->pid, ref->proc->tsk->comm, ref->data.debug_id, ref->data.desc); binder_dequeue_work(ref->proc, &ref->death->work); binder_stats_deleted(BINDER_STAT_DEATH); @@ -1902,8 +1906,8 @@ static bool binder_dec_ref_olocked(struct binder_ref *ref, int strong) { if (strong) { if (ref->data.strong == 0) { - binder_user_error("%d invalid dec strong, ref %d desc %d s %d w %d\n", - ref->proc->pid, ref->data.debug_id, + binder_user_error("%d(%s) invalid dec strong, ref %d desc %d s %d w %d\n", + ref->proc->pid, ref->proc->tsk->comm, ref->data.debug_id, ref->data.desc, ref->data.strong, ref->data.weak); return false; @@ -1913,8 +1917,8 @@ static bool binder_dec_ref_olocked(struct binder_ref *ref, int strong) binder_dec_node(ref->node, strong, 1); } else { if (ref->data.weak == 0) { - binder_user_error("%d invalid dec weak, ref %d desc %d s %d w %d\n", - ref->proc->pid, ref->data.debug_id, + binder_user_error("%d(%s) invalid dec weak, ref %d desc %d s %d w %d\n", + ref->proc->pid, ref->proc->tsk->comm, ref->data.debug_id, ref->data.desc, ref->data.strong, ref->data.weak); return false; @@ -2249,10 +2253,12 @@ static void binder_send_failed_reply(struct binder_transaction *t, target_thread = binder_get_txn_from_and_acq_inner(t); if (target_thread) { binder_debug(BINDER_DEBUG_FAILED_TRANSACTION, - "send failed reply for transaction %d to %d:%d\n", + "send failed reply for transaction %d to %d:%d(%s:%s)\n", t->debug_id, target_thread->proc->pid, - target_thread->pid); + target_thread->pid, + target_thread->proc->tsk->comm, + target_thread->task->comm); binder_pop_transaction_ilocked(target_thread, t); if (target_thread->reply_error.cmd == BR_OK) { @@ -2507,8 +2513,8 @@ static void binder_transaction_buffer_release(struct binder_proc *proc, binder_size_t off_start_offset, buffer_offset, off_end_offset; binder_debug(BINDER_DEBUG_TRANSACTION, - "%d buffer release %d, size %zd-%zd, failed at %llx\n", - proc->pid, buffer->debug_id, + "%d(%s) buffer release %d, size %zd-%zd, failed at %llx\n", + proc->pid, proc->tsk->comm, buffer->debug_id, buffer->data_size, buffer->offsets_size, (unsigned long long)failed_at); @@ -2674,8 +2680,8 @@ static int binder_translate_binder(struct flat_binder_object *fp, return -ENOMEM; } if (fp->cookie != node->cookie) { - binder_user_error("%d:%d sending u%016llx node %d, cookie mismatch %016llx != %016llx\n", - proc->pid, thread->pid, (u64)fp->binder, + binder_user_error("%d:%d(%s:%s) sending u%016llx node %d, cookie mismatch %016llx != %016llx\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm, (u64)fp->binder, node->debug_id, (u64)fp->cookie, (u64)node->cookie); ret = -EINVAL; @@ -2723,8 +2729,8 @@ static int binder_translate_handle(struct flat_binder_object *fp, node = binder_get_node_from_ref(proc, fp->handle, fp->hdr.type == BINDER_TYPE_HANDLE, &src_rdata); if (!node) { - binder_user_error("%d:%d got transaction with invalid handle, %d\n", - proc->pid, thread->pid, fp->handle); + binder_user_error("%d:%d(%s:%s) got transaction with invalid handle, %d\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm, fp->handle); return -EINVAL; } if (security_binder_transfer_binder(proc->cred, target_proc->cred)) { @@ -2796,8 +2802,8 @@ static int binder_translate_fd(int fd, else target_allows_fd = t->buffer->target_node->accept_fds; if (!target_allows_fd) { - binder_user_error("%d:%d got %s with fd, %d, but target does not allow fds\n", - proc->pid, thread->pid, + binder_user_error("%d:%d(%s:%s) got %s with fd, %d, but target does not allow fds\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm, in_reply_to ? "reply" : "transaction", fd); ret = -EPERM; @@ -2806,8 +2812,8 @@ static int binder_translate_fd(int fd, file = fget(fd); if (!file) { - binder_user_error("%d:%d got transaction with invalid fd, %d\n", - proc->pid, thread->pid, fd); + binder_user_error("%d:%d(%s:%s) got transaction with invalid fd, %d\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm, fd); ret = -EBADF; goto err_fget; } @@ -2851,15 +2857,15 @@ static int binder_translate_fd_array(struct binder_fd_array_object *fda, fd_buf_size = sizeof(u32) * fda->num_fds; if (fda->num_fds >= SIZE_MAX / sizeof(u32)) { - binder_user_error("%d:%d got transaction with invalid number of fds (%lld)\n", - proc->pid, thread->pid, (u64)fda->num_fds); + binder_user_error("%d:%d(%s:%s) got transaction with invalid number of fds (%lld)\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm, (u64)fda->num_fds); return -EINVAL; } if (fd_buf_size > parent->length || fda->parent_offset > parent->length - fd_buf_size) { /* No space for all file descriptors here. */ - binder_user_error("%d:%d not enough space to store %lld fds in buffer\n", - proc->pid, thread->pid, (u64)fda->num_fds); + binder_user_error("%d:%d(%s:%s) not enough space to store %lld fds in buffer\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm, (u64)fda->num_fds); return -EINVAL; } /* @@ -2872,8 +2878,8 @@ static int binder_translate_fd_array(struct binder_fd_array_object *fda, fda_offset = (parent->buffer - (uintptr_t)t->buffer->user_data) + fda->parent_offset; if (!IS_ALIGNED((unsigned long)fda_offset, sizeof(u32))) { - binder_user_error("%d:%d parent offset not aligned correctly.\n", - proc->pid, thread->pid); + binder_user_error("%d:%d(%s:%s) parent offset not aligned correctly.\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm); return -EINVAL; } for (fdi = 0; fdi < fda->num_fds; fdi++) { @@ -2933,8 +2939,8 @@ static int binder_fixup_parent(struct binder_transaction *t, off_start_offset, &parent_offset, num_valid); if (!parent) { - binder_user_error("%d:%d got transaction with invalid parent offset or type\n", - proc->pid, thread->pid); + binder_user_error("%d:%d(%s:%s) got transaction with invalid parent offset or type\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm); return -EINVAL; } @@ -2942,16 +2948,16 @@ static int binder_fixup_parent(struct binder_transaction *t, parent_offset, bp->parent_offset, last_fixup_obj_off, last_fixup_min_off)) { - binder_user_error("%d:%d got transaction with out-of-order buffer fixup\n", - proc->pid, thread->pid); + binder_user_error("%d:%d(%s:%s) got transaction with out-of-order buffer fixup\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm); return -EINVAL; } if (parent->length < sizeof(binder_uintptr_t) || bp->parent_offset > parent->length - sizeof(binder_uintptr_t)) { /* No space for a pointer here! */ - binder_user_error("%d:%d got transaction with invalid parent offset\n", - proc->pid, thread->pid); + binder_user_error("%d:%d(%s:%s) got transaction with invalid parent offset\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm); return -EINVAL; } buffer_offset = bp->parent_offset + @@ -3110,14 +3116,16 @@ static void binder_transaction(struct binder_proc *proc, e->data_size = tr->data_size; e->offsets_size = tr->offsets_size; e->context_name = proc->context->name; + e->from_proc_name = proc->tsk->comm; + e->from_thread_name = thread->task->comm; if (reply) { binder_inner_proc_lock(proc); in_reply_to = thread->transaction_stack; if (in_reply_to == NULL) { binder_inner_proc_unlock(proc); - binder_user_error("%d:%d got reply transaction with no transaction stack\n", - proc->pid, thread->pid); + binder_user_error("%d:%d(%s:%s) got reply transaction with no transaction stack\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm); return_error = BR_FAILED_REPLY; return_error_param = -EPROTO; return_error_line = __LINE__; @@ -3125,12 +3133,17 @@ static void binder_transaction(struct binder_proc *proc, } if (in_reply_to->to_thread != thread) { spin_lock(&in_reply_to->lock); - binder_user_error("%d:%d got reply transaction with bad transaction stack, transaction %d has target %d:%d\n", - proc->pid, thread->pid, in_reply_to->debug_id, + binder_user_error("%d:%d(%s:%s) got reply transaction with bad transaction stack, "\ + "transaction %d has target %d:%d(%s:%s)\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm, in_reply_to->debug_id, in_reply_to->to_proc ? in_reply_to->to_proc->pid : 0, in_reply_to->to_thread ? - in_reply_to->to_thread->pid : 0); + in_reply_to->to_thread->pid : 0, + in_reply_to->to_proc ? + in_reply_to->to_proc->tsk->comm : "", + in_reply_to->to_thread ? + in_reply_to->to_thread->task->comm : ""); spin_unlock(&in_reply_to->lock); binder_inner_proc_unlock(proc); return_error = BR_FAILED_REPLY; @@ -3148,8 +3161,9 @@ static void binder_transaction(struct binder_proc *proc, goto err_dead_binder; } if (target_thread->transaction_stack != in_reply_to) { - binder_user_error("%d:%d got reply transaction with bad target transaction stack %d, expected %d\n", - proc->pid, thread->pid, + binder_user_error("%d:%d(%s:%s) got reply transaction with bad target transaction "\ + "stack %d, expected %d\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm, target_thread->transaction_stack ? target_thread->transaction_stack->debug_id : 0, in_reply_to->debug_id); @@ -3183,8 +3197,8 @@ static void binder_transaction(struct binder_proc *proc, ref->node, &target_proc, &return_error); } else { - binder_user_error("%d:%d got transaction to invalid handle\n", - proc->pid, thread->pid); + binder_user_error("%d:%d(%s:%s) got transaction to invalid handle\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm); return_error = BR_FAILED_REPLY; } binder_proc_unlock(proc); @@ -3236,11 +3250,14 @@ static void binder_transaction(struct binder_proc *proc, tmp = thread->transaction_stack; if (tmp->to_thread != thread) { spin_lock(&tmp->lock); - binder_user_error("%d:%d got new transaction with bad transaction stack, transaction %d has target %d:%d\n", - proc->pid, thread->pid, tmp->debug_id, + binder_user_error("%d:%d(%s:%s) got new transaction with bad transaction stack, "\ + "transaction %d has target %d:%d(%s:%s)\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm, tmp->debug_id, tmp->to_proc ? tmp->to_proc->pid : 0, tmp->to_thread ? - tmp->to_thread->pid : 0); + tmp->to_thread->pid : 0, + tmp->to_proc ? tmp->to_proc->tsk->comm : "", + tmp->to_thread ? tmp->to_thread->task->comm : ""); spin_unlock(&tmp->lock); binder_inner_proc_unlock(proc); return_error = BR_FAILED_REPLY; @@ -3265,9 +3282,12 @@ static void binder_transaction(struct binder_proc *proc, } binder_inner_proc_unlock(proc); } - if (target_thread) + if (target_thread) { e->to_thread = target_thread->pid; + e->to_thread_name = target_thread->task->comm; + } e->to_proc = target_proc->pid; + e->to_proc_name = target_proc->tsk->comm; /* TODO: reuse incoming transaction for reply */ t = kzalloc(sizeof(*t), GFP_KERNEL); @@ -3293,18 +3313,18 @@ static void binder_transaction(struct binder_proc *proc, if (reply) binder_debug(BINDER_DEBUG_TRANSACTION, - "%d:%d BC_REPLY %d -> %d:%d, data %016llx-%016llx size %lld-%lld-%lld\n", - proc->pid, thread->pid, t->debug_id, - target_proc->pid, target_thread->pid, + "%d:%d(%s:%s) BC_REPLY %d -> %d:%d (%s:%s), data %016llx-%016llx size %lld-%lld-%lld\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm, t->debug_id, + target_proc->pid, target_thread->pid, target_proc->tsk->comm, target_thread->task->comm, (u64)tr->data.ptr.buffer, (u64)tr->data.ptr.offsets, (u64)tr->data_size, (u64)tr->offsets_size, (u64)extra_buffers_size); else binder_debug(BINDER_DEBUG_TRANSACTION, - "%d:%d BC_TRANSACTION %d -> %d - node %d, data %016llx-%016llx size %lld-%lld-%lld\n", - proc->pid, thread->pid, t->debug_id, - target_proc->pid, target_node->debug_id, + "%d:%d(%s:%s) BC_TRANSACTION %d -> %d (%s) - node %d, data %016llx-%016llx size %lld-%lld-%lld\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm, t->debug_id, + target_proc->pid, target_proc->tsk->comm, target_node->debug_id, (u64)tr->data.ptr.buffer, (u64)tr->data.ptr.offsets, (u64)tr->data_size, (u64)tr->offsets_size, @@ -3395,8 +3415,8 @@ static void binder_transaction(struct binder_proc *proc, (const void __user *) (uintptr_t)tr->data.ptr.buffer, tr->data_size)) { - binder_user_error("%d:%d got transaction with invalid data ptr\n", - proc->pid, thread->pid); + binder_user_error("%d:%d(%s:%s) got transaction with invalid data ptr\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm); return_error = BR_FAILED_REPLY; return_error_param = -EFAULT; return_error_line = __LINE__; @@ -3409,24 +3429,24 @@ static void binder_transaction(struct binder_proc *proc, (const void __user *) (uintptr_t)tr->data.ptr.offsets, tr->offsets_size)) { - binder_user_error("%d:%d got transaction with invalid offsets ptr\n", - proc->pid, thread->pid); + binder_user_error("%d:%d(%s:%s) got transaction with invalid offsets ptr\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm); return_error = BR_FAILED_REPLY; return_error_param = -EFAULT; return_error_line = __LINE__; goto err_copy_data_failed; } if (!IS_ALIGNED(tr->offsets_size, sizeof(binder_size_t))) { - binder_user_error("%d:%d got transaction with invalid offsets size, %lld\n", - proc->pid, thread->pid, (u64)tr->offsets_size); + binder_user_error("%d:%d(%s:%s) got transaction with invalid offsets size, %lld\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm, (u64)tr->offsets_size); return_error = BR_FAILED_REPLY; return_error_param = -EINVAL; return_error_line = __LINE__; goto err_bad_offset; } if (!IS_ALIGNED(extra_buffers_size, sizeof(u64))) { - binder_user_error("%d:%d got transaction with unaligned buffers size, %lld\n", - proc->pid, thread->pid, + binder_user_error("%d:%d(%s:%s) got transaction with unaligned buffers size, %lld\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm, (u64)extra_buffers_size); return_error = BR_FAILED_REPLY; return_error_param = -EINVAL; @@ -3455,8 +3475,8 @@ static void binder_transaction(struct binder_proc *proc, object_size = binder_get_object(target_proc, t->buffer, object_offset, &object); if (object_size == 0 || object_offset < off_min) { - binder_user_error("%d:%d got transaction with invalid offset (%lld, min %lld max %lld) or object.\n", - proc->pid, thread->pid, + binder_user_error("%d:%d(%s:%s) got transaction with invalid offset (%lld, min %lld max %lld) or object.\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm, (u64)object_offset, (u64)off_min, (u64)t->buffer->data_size); @@ -3533,8 +3553,8 @@ static void binder_transaction(struct binder_proc *proc, &parent_offset, num_valid); if (!parent) { - binder_user_error("%d:%d got transaction with invalid parent offset or type\n", - proc->pid, thread->pid); + binder_user_error("%d:%d(%s:%s) got transaction with invalid parent offset or type\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm); return_error = BR_FAILED_REPLY; return_error_param = -EINVAL; return_error_line = __LINE__; @@ -3546,8 +3566,8 @@ static void binder_transaction(struct binder_proc *proc, fda->parent_offset, last_fixup_obj_off, last_fixup_min_off)) { - binder_user_error("%d:%d got transaction with out-of-order buffer fixup\n", - proc->pid, thread->pid); + binder_user_error("%d:%d(%s:%s) got transaction with out-of-order buffer fixup\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm); return_error = BR_FAILED_REPLY; return_error_param = -EINVAL; return_error_line = __LINE__; @@ -3572,8 +3592,8 @@ static void binder_transaction(struct binder_proc *proc, size_t num_valid; if (bp->length > buf_left) { - binder_user_error("%d:%d got transaction with too large buffer\n", - proc->pid, thread->pid); + binder_user_error("%d:%d(%s:%s) got transaction with too large buffer\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm); return_error = BR_FAILED_REPLY; return_error_param = -EINVAL; return_error_line = __LINE__; @@ -3586,8 +3606,8 @@ static void binder_transaction(struct binder_proc *proc, (const void __user *) (uintptr_t)bp->buffer, bp->length)) { - binder_user_error("%d:%d got transaction with invalid offsets ptr\n", - proc->pid, thread->pid); + binder_user_error("%d:%d(%s:%s) got transaction with invalid offsets ptr\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm); return_error_param = -EFAULT; return_error = BR_FAILED_REPLY; return_error_line = __LINE__; @@ -3618,8 +3638,8 @@ static void binder_transaction(struct binder_proc *proc, last_fixup_min_off = 0; } break; default: - binder_user_error("%d:%d got transaction with invalid object type, %x\n", - proc->pid, thread->pid, hdr->type); + binder_user_error("%d:%d(%s:%s) got transaction with invalid object type, %x\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm, hdr->type); return_error = BR_FAILED_REPLY; return_error_param = -EINVAL; return_error_line = __LINE__; @@ -3726,8 +3746,9 @@ err_invalid_target_handle: } binder_debug(BINDER_DEBUG_FAILED_TRANSACTION, - "%d:%d transaction failed %d/%d, size %lld-%lld line %d\n", - proc->pid, thread->pid, return_error, return_error_param, + "%d:%d(%s:%s) transaction failed %d/%d, size %lld-%lld line %d\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm, + return_error, return_error_param, (u64)tr->data_size, (u64)tr->offsets_size, return_error_line); @@ -3824,8 +3845,9 @@ static int binder_thread_write(struct binder_proc *proc, proc, target, increment, strong, &rdata); if (!ret && rdata.desc != target) { - binder_user_error("%d:%d tried to acquire reference to desc %d, got %d instead\n", - proc->pid, thread->pid, + binder_user_error("%d:%d(%s:%s) tried to acquire reference to"\ + " desc %d, got %d instead\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm, target, rdata.desc); } switch (cmd) { @@ -3844,15 +3866,15 @@ static int binder_thread_write(struct binder_proc *proc, break; } if (ret) { - binder_user_error("%d:%d %s %d refcount change on invalid ref %d ret %d\n", - proc->pid, thread->pid, debug_string, - strong, target, ret); + binder_user_error("%d:%d(%s:%s) %s %d refcount change on invalid ref %d ret %d\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm, + debug_string, strong, target, ret); break; } binder_debug(BINDER_DEBUG_USER_REFS, - "%d:%d %s ref %d desc %d s %d w %d\n", - proc->pid, thread->pid, debug_string, - rdata.debug_id, rdata.desc, rdata.strong, + "%d:%d(%s:%s) %s ref %d desc %d s %d w %d\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm, + debug_string, rdata.debug_id, rdata.desc, rdata.strong, rdata.weak); break; } @@ -3871,8 +3893,8 @@ static int binder_thread_write(struct binder_proc *proc, ptr += sizeof(binder_uintptr_t); node = binder_get_node(proc, node_ptr); if (node == NULL) { - binder_user_error("%d:%d %s u%016llx no match\n", - proc->pid, thread->pid, + binder_user_error("%d:%d(%s:%s) %s u%016llx no match\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm, cmd == BC_INCREFS_DONE ? "BC_INCREFS_DONE" : "BC_ACQUIRE_DONE", @@ -3880,8 +3902,9 @@ static int binder_thread_write(struct binder_proc *proc, break; } if (cookie != node->cookie) { - binder_user_error("%d:%d %s u%016llx node %d cookie mismatch %016llx != %016llx\n", - proc->pid, thread->pid, + binder_user_error("%d:%d(%s:%s) %s u%016llx node %d cookie mismatch"\ + " %016llx != %016llx\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm, cmd == BC_INCREFS_DONE ? "BC_INCREFS_DONE" : "BC_ACQUIRE_DONE", (u64)node_ptr, node->debug_id, @@ -3892,8 +3915,9 @@ static int binder_thread_write(struct binder_proc *proc, binder_node_inner_lock(node); if (cmd == BC_ACQUIRE_DONE) { if (node->pending_strong_ref == 0) { - binder_user_error("%d:%d BC_ACQUIRE_DONE node %d has no pending acquire request\n", - proc->pid, thread->pid, + binder_user_error("%d:%d(%s:%s) BC_ACQUIRE_DONE node %d"\ + " has no pending acquire request\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm, node->debug_id); binder_node_inner_unlock(node); binder_put_node(node); @@ -3902,8 +3926,9 @@ static int binder_thread_write(struct binder_proc *proc, node->pending_strong_ref = 0; } else { if (node->pending_weak_ref == 0) { - binder_user_error("%d:%d BC_INCREFS_DONE node %d has no pending increfs request\n", - proc->pid, thread->pid, + binder_user_error("%d:%d(%s:%s) BC_INCREFS_DONE node %d"\ + " has no pending increfs request\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm, node->debug_id); binder_node_inner_unlock(node); binder_put_node(node); @@ -3915,8 +3940,8 @@ static int binder_thread_write(struct binder_proc *proc, cmd == BC_ACQUIRE_DONE, 0); WARN_ON(free_node); binder_debug(BINDER_DEBUG_USER_REFS, - "%d:%d %s node %d ls %d lw %d tr %d\n", - proc->pid, thread->pid, + "%d:%d(%s:%s) %s node %d ls %d lw %d tr %d\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm, cmd == BC_INCREFS_DONE ? "BC_INCREFS_DONE" : "BC_ACQUIRE_DONE", node->debug_id, node->local_strong_refs, node->local_weak_refs, node->tmp_refs); @@ -3944,20 +3969,20 @@ static int binder_thread_write(struct binder_proc *proc, if (IS_ERR_OR_NULL(buffer)) { if (PTR_ERR(buffer) == -EPERM) { binder_user_error( - "%d:%d BC_FREE_BUFFER u%016llx matched unreturned or currently freeing buffer\n", - proc->pid, thread->pid, + "%d:%d(%s:%s) BC_FREE_BUFFER u%016llx matched unreturned or currently freeing buffer\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm, (u64)data_ptr); } else { binder_user_error( - "%d:%d BC_FREE_BUFFER u%016llx no match\n", - proc->pid, thread->pid, + "%d:%d(%s:%s) BC_FREE_BUFFER u%016llx no match\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm, (u64)data_ptr); } break; } binder_debug(BINDER_DEBUG_FREE_BUFFER, - "%d:%d BC_FREE_BUFFER u%016llx found buffer %d for %s transaction\n", - proc->pid, thread->pid, (u64)data_ptr, + "%d:%d(%s:%s) BC_FREE_BUFFER u%016llx found buffer %d for %s transaction\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm, (u64)data_ptr, buffer->debug_id, buffer->transaction ? "active" : "finished"); @@ -4017,17 +4042,18 @@ static int binder_thread_write(struct binder_proc *proc, case BC_REGISTER_LOOPER: binder_debug(BINDER_DEBUG_THREADS, - "%d:%d BC_REGISTER_LOOPER\n", - proc->pid, thread->pid); + "%d:%d(%s:%s) BC_REGISTER_LOOPER\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm); binder_inner_proc_lock(proc); if (thread->looper & BINDER_LOOPER_STATE_ENTERED) { thread->looper |= BINDER_LOOPER_STATE_INVALID; - binder_user_error("%d:%d ERROR: BC_REGISTER_LOOPER called after BC_ENTER_LOOPER\n", - proc->pid, thread->pid); + binder_user_error("%d:%d(%s:%s) ERROR: BC_REGISTER_LOOPER"\ + " called after BC_ENTER_LOOPER\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm); } else if (proc->requested_threads == 0) { thread->looper |= BINDER_LOOPER_STATE_INVALID; - binder_user_error("%d:%d ERROR: BC_REGISTER_LOOPER called without request\n", - proc->pid, thread->pid); + binder_user_error("%d:%d(%s:%s) ERROR: BC_REGISTER_LOOPER called without request\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm); } else { proc->requested_threads--; proc->requested_threads_started++; @@ -4037,19 +4063,20 @@ static int binder_thread_write(struct binder_proc *proc, break; case BC_ENTER_LOOPER: binder_debug(BINDER_DEBUG_THREADS, - "%d:%d BC_ENTER_LOOPER\n", - proc->pid, thread->pid); + "%d:%d(%s:%s) BC_ENTER_LOOPER\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm); if (thread->looper & BINDER_LOOPER_STATE_REGISTERED) { thread->looper |= BINDER_LOOPER_STATE_INVALID; - binder_user_error("%d:%d ERROR: BC_ENTER_LOOPER called after BC_REGISTER_LOOPER\n", - proc->pid, thread->pid); + binder_user_error("%d:%d(%s:%s) ERROR: BC_ENTER_LOOPER"\ + " called after BC_REGISTER_LOOPER\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm); } thread->looper |= BINDER_LOOPER_STATE_ENTERED; break; case BC_EXIT_LOOPER: binder_debug(BINDER_DEBUG_THREADS, - "%d:%d BC_EXIT_LOOPER\n", - proc->pid, thread->pid); + "%d:%d(%s:%s) BC_EXIT_LOOPER\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm); thread->looper |= BINDER_LOOPER_STATE_EXITED; break; @@ -4081,16 +4108,16 @@ static int binder_thread_write(struct binder_proc *proc, &thread->return_error.work); binder_debug( BINDER_DEBUG_FAILED_TRANSACTION, - "%d:%d BC_REQUEST_DEATH_NOTIFICATION failed\n", - proc->pid, thread->pid); + "%d:%d(%s:%s) BC_REQUEST_DEATH_NOTIFICATION failed\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm); break; } } binder_proc_lock(proc); ref = binder_get_ref_olocked(proc, target, false); if (ref == NULL) { - binder_user_error("%d:%d %s invalid ref %d\n", - proc->pid, thread->pid, + binder_user_error("%d:%d(%s:%s) %s invalid ref %d\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm, cmd == BC_REQUEST_DEATH_NOTIFICATION ? "BC_REQUEST_DEATH_NOTIFICATION" : "BC_CLEAR_DEATH_NOTIFICATION", @@ -4101,8 +4128,8 @@ static int binder_thread_write(struct binder_proc *proc, } binder_debug(BINDER_DEBUG_DEATH_NOTIFICATION, - "%d:%d %s %016llx ref %d desc %d s %d w %d for node %d\n", - proc->pid, thread->pid, + "%d:%d(%s:%s) %s %016llx ref %d desc %d s %d w %d for node %d\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm, cmd == BC_REQUEST_DEATH_NOTIFICATION ? "BC_REQUEST_DEATH_NOTIFICATION" : "BC_CLEAR_DEATH_NOTIFICATION", @@ -4113,8 +4140,9 @@ static int binder_thread_write(struct binder_proc *proc, binder_node_lock(ref->node); if (cmd == BC_REQUEST_DEATH_NOTIFICATION) { if (ref->death) { - binder_user_error("%d:%d BC_REQUEST_DEATH_NOTIFICATION death notification already set\n", - proc->pid, thread->pid); + binder_user_error("%d:%d(%s:%s) BC_REQUEST_DEATH_NOTIFICATION"\ + " death notification already set\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm); binder_node_unlock(ref->node); binder_proc_unlock(proc); kfree(death); @@ -4135,16 +4163,18 @@ static int binder_thread_write(struct binder_proc *proc, } } else { if (ref->death == NULL) { - binder_user_error("%d:%d BC_CLEAR_DEATH_NOTIFICATION death notification not active\n", - proc->pid, thread->pid); + binder_user_error("%d:%d(%s:%s) BC_CLEAR_DEATH_NOTIFICATION"\ + " death notification not active\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm); binder_node_unlock(ref->node); binder_proc_unlock(proc); break; } death = ref->death; if (death->cookie != cookie) { - binder_user_error("%d:%d BC_CLEAR_DEATH_NOTIFICATION death notification cookie mismatch %016llx != %016llx\n", - proc->pid, thread->pid, + binder_user_error("%d:%d(%s:%s) BC_CLEAR_DEATH_NOTIFICATION"\ + " death notification cookie mismatch %016llx != %016llx\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm, (u64)death->cookie, (u64)cookie); binder_node_unlock(ref->node); @@ -4200,12 +4230,12 @@ static int binder_thread_write(struct binder_proc *proc, } } binder_debug(BINDER_DEBUG_DEAD_BINDER, - "%d:%d BC_DEAD_BINDER_DONE %016llx found %pK\n", - proc->pid, thread->pid, (u64)cookie, + "%d:%d(%s:%s) BC_DEAD_BINDER_DONE %016llx found %pK\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm, (u64)cookie, death); if (death == NULL) { - binder_user_error("%d:%d BC_DEAD_BINDER_DONE %016llx not found\n", - proc->pid, thread->pid, (u64)cookie); + binder_user_error("%d:%d(%s:%s) BC_DEAD_BINDER_DONE %016llx not found\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm, (u64)cookie); binder_inner_proc_unlock(proc); break; } @@ -4228,8 +4258,8 @@ static int binder_thread_write(struct binder_proc *proc, } break; default: - pr_err("%d:%d unknown command %d\n", - proc->pid, thread->pid, cmd); + pr_err("%d:%d(%s:%s) unknown command %d\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm, cmd); return -EINVAL; } *consumed = ptr - buffer; @@ -4271,8 +4301,9 @@ static int binder_put_node_cmd(struct binder_proc *proc, ptr += sizeof(binder_uintptr_t); binder_stat_br(proc, thread, cmd); - binder_debug(BINDER_DEBUG_USER_REFS, "%d:%d %s %d u%016llx c%016llx\n", - proc->pid, thread->pid, cmd_name, node_debug_id, + binder_debug(BINDER_DEBUG_USER_REFS, "%d:%d(%s:%s) %s %d u%016llx c%016llx\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm, + cmd_name, node_debug_id, (u64)node_ptr, (u64)node_cookie); *ptrp = ptr; @@ -4342,8 +4373,9 @@ retry: if (wait_for_proc_work) { if (!(thread->looper & (BINDER_LOOPER_STATE_REGISTERED | BINDER_LOOPER_STATE_ENTERED))) { - binder_user_error("%d:%d ERROR: Thread waiting for process work before calling BC_REGISTER_LOOPER or BC_ENTER_LOOPER (state %x)\n", - proc->pid, thread->pid, thread->looper); + binder_user_error("%d:%d(%s:%s) ERROR: Thread waiting for process work"\ + " before calling BC_REGISTER_LOOPER or BC_ENTER_LOOPER (state %x)\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm, thread->looper); wait_event_interruptible(binder_user_error_wait, binder_stop_on_user_error < 2); } @@ -4425,8 +4457,8 @@ retry: binder_stat_br(proc, thread, cmd); binder_debug(BINDER_DEBUG_TRANSACTION_COMPLETE, - "%d:%d BR_TRANSACTION_COMPLETE\n", - proc->pid, thread->pid); + "%d:%d(%s:%s) BR_TRANSACTION_COMPLETE\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm); } break; case BINDER_WORK_NODE: { struct binder_node *node = container_of(w, struct binder_node, work); @@ -4463,8 +4495,8 @@ retry: node->has_weak_ref = 0; if (!weak && !strong) { binder_debug(BINDER_DEBUG_INTERNAL_REFS, - "%d:%d node %d u%016llx c%016llx deleted\n", - proc->pid, thread->pid, + "%d:%d(%s:%s) node %d u%016llx c%016llx deleted\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm, node_debug_id, (u64)node_ptr, (u64)node_cookie); @@ -4507,8 +4539,8 @@ retry: BR_DECREFS, "BR_DECREFS"); if (orig_ptr == ptr) binder_debug(BINDER_DEBUG_INTERNAL_REFS, - "%d:%d node %d u%016llx c%016llx state unchanged\n", - proc->pid, thread->pid, + "%d:%d(%s:%s) node %d u%016llx c%016llx state unchanged\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm, node_debug_id, (u64)node_ptr, (u64)node_cookie); @@ -4530,8 +4562,8 @@ retry: cookie = death->cookie; binder_debug(BINDER_DEBUG_DEATH_NOTIFICATION, - "%d:%d %s %016llx\n", - proc->pid, thread->pid, + "%d:%d(%s:%s) %s %016llx\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm, cmd == BR_DEAD_BINDER ? "BR_DEAD_BINDER" : "BR_CLEAR_DEATH_NOTIFICATION_DONE", @@ -4632,13 +4664,16 @@ retry: trace_binder_transaction_received(t); binder_stat_br(proc, thread, cmd); binder_debug(BINDER_DEBUG_TRANSACTION, - "%d:%d %s %d %d:%d, cmd %d size %zd-%zd ptr %016llx-%016llx\n", - proc->pid, thread->pid, + "%d:%d(%s:%s) %s %d %d:%d(%s:%s), cmd %d size %zd-%zd ptr %016llx-%016llx\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm, (cmd == BR_TRANSACTION) ? "BR_TRANSACTION" : (cmd == BR_TRANSACTION_SEC_CTX) ? "BR_TRANSACTION_SEC_CTX" : "BR_REPLY", t->debug_id, t_from ? t_from->proc->pid : 0, - t_from ? t_from->pid : 0, cmd, + t_from ? t_from->pid : 0, + t_from ? t_from->proc->tsk->comm : "", + t_from ? t_from->task->comm : "", + cmd, t->buffer->data_size, t->buffer->offsets_size, (u64)trd->data.ptr.buffer, (u64)trd->data.ptr.offsets); @@ -4671,8 +4706,8 @@ done: proc->requested_threads++; binder_inner_proc_unlock(proc); binder_debug(BINDER_DEBUG_THREADS, - "%d:%d BR_SPAWN_LOOPER\n", - proc->pid, thread->pid); + "%d:%d(%s:%s) BR_SPAWN_LOOPER\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm); if (put_user(BR_SPAWN_LOOPER, (uint32_t __user *)buffer)) return -EFAULT; binder_stat_br(proc, thread, BR_SPAWN_LOOPER); @@ -4855,8 +4890,8 @@ static int binder_thread_release(struct binder_proc *proc, last_t = t; active_transactions++; binder_debug(BINDER_DEBUG_DEAD_TRANSACTION, - "release %d:%d transaction %d %s, still active\n", - proc->pid, thread->pid, + "release %d:%d(%s:%s) transaction %d %s, still active\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm, t->debug_id, (t->to_thread == thread) ? "in" : "out"); @@ -4948,8 +4983,8 @@ static int binder_ioctl_write_read(struct file *filp, goto out; } binder_debug(BINDER_DEBUG_READ_WRITE, - "%d:%d write %lld at %016llx, read %lld at %016llx\n", - proc->pid, thread->pid, + "%d:%d(%s:%s) write %lld at %016llx, read %lld at %016llx\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm, (u64)bwr.write_size, (u64)bwr.write_buffer, (u64)bwr.read_size, (u64)bwr.read_buffer); @@ -4983,8 +5018,8 @@ static int binder_ioctl_write_read(struct file *filp, } } binder_debug(BINDER_DEBUG_READ_WRITE, - "%d:%d wrote %lld of %lld, read return %lld of %lld\n", - proc->pid, thread->pid, + "%d:%d(%s:%s) wrote %lld of %lld, read return %lld of %lld\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm, (u64)bwr.write_consumed, (u64)bwr.write_size, (u64)bwr.read_consumed, (u64)bwr.read_size); if (copy_to_user(ubuf, &bwr, sizeof(bwr))) { @@ -5166,8 +5201,8 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) goto err; break; case BINDER_THREAD_EXIT: - binder_debug(BINDER_DEBUG_THREADS, "%d:%d exit\n", - proc->pid, thread->pid); + binder_debug(BINDER_DEBUG_THREADS, "%d:%d(%s:%s) exit\n", + proc->pid, thread->pid, proc->tsk->comm, thread->task->comm); binder_thread_release(proc, thread); thread = NULL; break; @@ -5232,7 +5267,8 @@ err: thread->looper_need_return = false; wait_event_interruptible(binder_user_error_wait, binder_stop_on_user_error < 2); if (ret && ret != -ERESTARTSYS) - pr_info("%d:%d ioctl %x %lx returned %d\n", proc->pid, current->pid, cmd, arg, ret); + pr_info("%d:%d(%s:%s) ioctl %x %lx returned %d\n", proc->pid, current->pid, + proc->tsk->comm, current->comm, cmd, arg, ret); err_unlocked: trace_binder_ioctl_done(ret); return ret; @@ -5243,8 +5279,8 @@ static void binder_vma_open(struct vm_area_struct *vma) struct binder_proc *proc = vma->vm_private_data; binder_debug(BINDER_DEBUG_OPEN_CLOSE, - "%d open vm area %lx-%lx (%ld K) vma %lx pagep %lx\n", - proc->pid, vma->vm_start, vma->vm_end, + "%d(%s) open vm area %lx-%lx (%ld K) vma %lx pagep %lx\n", + proc->pid, proc->tsk->comm, vma->vm_start, vma->vm_end, (vma->vm_end - vma->vm_start) / SZ_1K, vma->vm_flags, (unsigned long)pgprot_val(vma->vm_page_prot)); } @@ -5254,8 +5290,8 @@ static void binder_vma_close(struct vm_area_struct *vma) struct binder_proc *proc = vma->vm_private_data; binder_debug(BINDER_DEBUG_OPEN_CLOSE, - "%d close vm area %lx-%lx (%ld K) vma %lx pagep %lx\n", - proc->pid, vma->vm_start, vma->vm_end, + "%d(%s) close vm area %lx-%lx (%ld K) vma %lx pagep %lx\n", + proc->pid, proc->tsk->comm, vma->vm_start, vma->vm_end, (vma->vm_end - vma->vm_start) / SZ_1K, vma->vm_flags, (unsigned long)pgprot_val(vma->vm_page_prot)); binder_alloc_vma_close(&proc->alloc); @@ -5286,8 +5322,8 @@ static int binder_mmap(struct file *filp, struct vm_area_struct *vma) vma->vm_end = vma->vm_start + SZ_4M; binder_debug(BINDER_DEBUG_OPEN_CLOSE, - "%s: %d %lx-%lx (%ld K) vma %lx pagep %lx\n", - __func__, proc->pid, vma->vm_start, vma->vm_end, + "%s: %d(%s) %lx-%lx (%ld K) vma %lx pagep %lx\n", + __func__, proc->pid, proc->tsk->comm, vma->vm_start, vma->vm_end, (vma->vm_end - vma->vm_start) / SZ_1K, vma->vm_flags, (unsigned long)pgprot_val(vma->vm_page_prot)); @@ -5303,16 +5339,18 @@ static int binder_mmap(struct file *filp, struct vm_area_struct *vma) vma->vm_private_data = proc; ret = binder_alloc_mmap_handler(&proc->alloc, vma); - if (ret) - return ret; + if (ret) { + failure_string = ""; + goto err_bad_arg; + } mutex_lock(&proc->files_lock); proc->files = get_files_struct(current); mutex_unlock(&proc->files_lock); return 0; err_bad_arg: - pr_err("%s: %d %lx-%lx %s failed %d\n", __func__, - proc->pid, vma->vm_start, vma->vm_end, failure_string, ret); + pr_err("%s: %d(%s) %lx-%lx %s failed %d\n", __func__, + proc->pid, proc->tsk->comm, vma->vm_start, vma->vm_end, failure_string, ret); return ret; } @@ -5321,8 +5359,9 @@ static int binder_open(struct inode *nodp, struct file *filp) struct binder_proc *proc; struct binder_device *binder_dev; - binder_debug(BINDER_DEBUG_OPEN_CLOSE, "%s: %d:%d\n", __func__, - current->group_leader->pid, current->pid); + binder_debug(BINDER_DEBUG_OPEN_CLOSE, "%s: %d:%d (%s:%s)\n", __func__, + current->group_leader->pid, current->pid, + current->group_leader->comm, current->comm); proc = kzalloc(sizeof(*proc), GFP_KERNEL); if (proc == NULL) @@ -5404,7 +5443,7 @@ static void binder_deferred_flush(struct binder_proc *proc) binder_inner_proc_unlock(proc); binder_debug(BINDER_DEBUG_OPEN_CLOSE, - "binder_flush: %d woke %d threads\n", proc->pid, + "binder_flush: %d(%s) woke %d threads\n", proc->pid, proc->tsk->comm, wake_count); } @@ -5499,8 +5538,8 @@ static void binder_deferred_release(struct binder_proc *proc) if (context->binder_context_mgr_node && context->binder_context_mgr_node->proc == proc) { binder_debug(BINDER_DEBUG_DEAD_BINDER, - "%s: %d context_mgr_node gone\n", - __func__, proc->pid); + "%s: %d(%s) context_mgr_node gone\n", + __func__, proc->pid, proc->tsk->comm); context->binder_context_mgr_node = NULL; } mutex_unlock(&context->context_mgr_node_lock); @@ -5562,8 +5601,8 @@ static void binder_deferred_release(struct binder_proc *proc) binder_release_work(proc, &proc->delivered_death); binder_debug(BINDER_DEBUG_OPEN_CLOSE, - "%s: %d threads %d, nodes %d (ref %d), refs %d, active transactions %d\n", - __func__, proc->pid, threads, nodes, incoming_refs, + "%s: %d(%s) threads %d, nodes %d (ref %d), refs %d, active transactions %d\n", + __func__, proc->pid, proc->tsk->comm, threads, nodes, incoming_refs, outgoing_refs, active_transactions); binder_proc_dec_tmpref(proc); @@ -5635,12 +5674,16 @@ static void print_binder_transaction_ilocked(struct seq_file *m, spin_lock(&t->lock); to_proc = t->to_proc; seq_printf(m, - "%s %d: %pK from %d:%d to %d:%d code %x flags %x pri %d:%d r%d", + "%s %d: %pK from %d:%d(%s:%s) to %d:%d(%s:%s) code %x flags %x pri %d:%d r%d", prefix, t->debug_id, t, t->from ? t->from->proc->pid : 0, t->from ? t->from->pid : 0, + t->from ? t->from->proc->tsk->comm : "", + t->from ? t->from->task->comm : "", to_proc ? to_proc->pid : 0, t->to_thread ? t->to_thread->pid : 0, + to_proc ? to_proc->tsk->comm : "", + t->to_thread ? t->to_thread->task->comm : "", t->code, t->flags, t->priority.sched_policy, t->priority.prio, t->need_reply); spin_unlock(&t->lock); @@ -5720,8 +5763,8 @@ static void print_binder_thread_ilocked(struct seq_file *m, size_t start_pos = m->count; size_t header_pos; - seq_printf(m, " thread %d: l %02x need_return %d tr %d\n", - thread->pid, thread->looper, + seq_printf(m, " thread %d %s: l %02x need_return %d tr %d\n", + thread->pid, thread->task->comm, thread->looper, thread->looper_need_return, atomic_read(&thread->tmp_ref)); header_pos = m->count; @@ -5769,7 +5812,7 @@ static void print_binder_node_nilocked(struct seq_file *m, if (count) { seq_puts(m, " proc"); hlist_for_each_entry(ref, &node->refs, node_entry) - seq_printf(m, " %d", ref->proc->pid); + seq_printf(m, " %d %s", ref->proc->pid, ref->proc->tsk->comm); } seq_puts(m, "\n"); if (node->proc) { @@ -5800,7 +5843,7 @@ static void print_binder_proc(struct seq_file *m, size_t header_pos; struct binder_node *last_node = NULL; - seq_printf(m, "proc %d\n", proc->pid); + seq_printf(m, "proc %d %s\n", proc->pid, proc->tsk->comm); seq_printf(m, "context %s\n", proc->context->name); header_pos = m->count; @@ -5964,7 +6007,7 @@ static void print_binder_proc_stats(struct seq_file *m, size_t free_async_space = binder_alloc_get_free_async_space(&proc->alloc); - seq_printf(m, "proc %d\n", proc->pid); + seq_printf(m, "proc %d %s\n", proc->pid, proc->tsk->comm); seq_printf(m, "context %s\n", proc->context->name); count = 0; ready_threads = 0; @@ -6114,10 +6157,12 @@ static void print_binder_transaction_log_entry(struct seq_file *m, */ smp_rmb(); seq_printf(m, - "%d: %s from %d:%d to %d:%d context %s node %d handle %d size %d:%d ret %d/%d l=%d", + "%d: %s from %d:%d(%s:%s) to %d:%d(%s:%s) context %s node %d handle %d size %d:%d ret %d/%d l=%d", e->debug_id, (e->call_type == 2) ? "reply" : - ((e->call_type == 1) ? "async" : "call "), e->from_proc, - e->from_thread, e->to_proc, e->to_thread, e->context_name, + ((e->call_type == 1) ? "async" : "call "), + e->from_proc, e->from_thread, e->from_proc_name, e->from_thread_name, + e->to_proc, e->to_thread, e->to_proc_name, e->to_thread_name, + e->context_name, e->to_node, e->target_handle, e->data_size, e->offsets_size, e->return_error, e->return_error_param, e->return_error_line); -- 2.20.1