Commit 56b468fc authored by Anmol Sarma's avatar Anmol Sarma Committed by Greg Kroah-Hartman

Staging: android: binder: Fixed multi-line strings

Changed all user visible multi-line strings to single line.
Removed 'binder:' prefix on stings.
Signed-off-by: default avatarAnmol Sarma <unmole.in@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e07384ad
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
* *
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <asm/cacheflush.h> #include <asm/cacheflush.h>
#include <linux/fdtable.h> #include <linux/fdtable.h>
#include <linux/file.h> #include <linux/file.h>
...@@ -434,12 +436,12 @@ static void binder_set_nice(long nice) ...@@ -434,12 +436,12 @@ static void binder_set_nice(long nice)
} }
min_nice = 20 - current->signal->rlim[RLIMIT_NICE].rlim_cur; min_nice = 20 - current->signal->rlim[RLIMIT_NICE].rlim_cur;
binder_debug(BINDER_DEBUG_PRIORITY_CAP, binder_debug(BINDER_DEBUG_PRIORITY_CAP,
"binder: %d: nice value %ld not allowed use " "%d: nice value %ld not allowed use %ld instead\n",
"%ld instead\n", current->pid, nice, min_nice); current->pid, nice, min_nice);
set_user_nice(current, min_nice); set_user_nice(current, min_nice);
if (min_nice < 20) if (min_nice < 20)
return; return;
binder_user_error("binder: %d RLIMIT_NICE not set\n", current->pid); binder_user_error("%d RLIMIT_NICE not set\n", current->pid);
} }
static size_t binder_buffer_size(struct binder_proc *proc, static size_t binder_buffer_size(struct binder_proc *proc,
...@@ -466,8 +468,8 @@ static void binder_insert_free_buffer(struct binder_proc *proc, ...@@ -466,8 +468,8 @@ static void binder_insert_free_buffer(struct binder_proc *proc,
new_buffer_size = binder_buffer_size(proc, new_buffer); new_buffer_size = binder_buffer_size(proc, new_buffer);
binder_debug(BINDER_DEBUG_BUFFER_ALLOC, binder_debug(BINDER_DEBUG_BUFFER_ALLOC,
"binder: %d: add free buffer, size %zd, " "%d: add free buffer, size %zd, at %p\n",
"at %p\n", proc->pid, new_buffer_size, new_buffer); proc->pid, new_buffer_size, new_buffer);
while (*p) { while (*p) {
parent = *p; parent = *p;
...@@ -545,7 +547,7 @@ static int binder_update_page_range(struct binder_proc *proc, int allocate, ...@@ -545,7 +547,7 @@ static int binder_update_page_range(struct binder_proc *proc, int allocate,
struct mm_struct *mm; struct mm_struct *mm;
binder_debug(BINDER_DEBUG_BUFFER_ALLOC, binder_debug(BINDER_DEBUG_BUFFER_ALLOC,
"binder: %d: %s pages %p-%p\n", proc->pid, "%d: %s pages %p-%p\n", proc->pid,
allocate ? "allocate" : "free", start, end); allocate ? "allocate" : "free", start, end);
if (end <= start) if (end <= start)
...@@ -562,7 +564,7 @@ static int binder_update_page_range(struct binder_proc *proc, int allocate, ...@@ -562,7 +564,7 @@ static int binder_update_page_range(struct binder_proc *proc, int allocate,
down_write(&mm->mmap_sem); down_write(&mm->mmap_sem);
vma = proc->vma; vma = proc->vma;
if (vma && mm != proc->vma_vm_mm) { if (vma && mm != proc->vma_vm_mm) {
pr_err("binder: %d: vma mm and task mm mismatch\n", pr_err("%d: vma mm and task mm mismatch\n",
proc->pid); proc->pid);
vma = NULL; vma = NULL;
} }
...@@ -572,8 +574,8 @@ static int binder_update_page_range(struct binder_proc *proc, int allocate, ...@@ -572,8 +574,8 @@ static int binder_update_page_range(struct binder_proc *proc, int allocate,
goto free_range; goto free_range;
if (vma == NULL) { if (vma == NULL) {
pr_err("binder: %d: binder_alloc_buf failed to " pr_err("%d: binder_alloc_buf failed to map pages in userspace, no vma\n",
"map pages in userspace, no vma\n", proc->pid); proc->pid);
goto err_no_vma; goto err_no_vma;
} }
...@@ -585,8 +587,8 @@ static int binder_update_page_range(struct binder_proc *proc, int allocate, ...@@ -585,8 +587,8 @@ static int binder_update_page_range(struct binder_proc *proc, int allocate,
BUG_ON(*page); BUG_ON(*page);
*page = alloc_page(GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO); *page = alloc_page(GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO);
if (*page == NULL) { if (*page == NULL) {
pr_err("binder: %d: binder_alloc_buf failed " pr_err("%d: binder_alloc_buf failed for page at %p\n",
"for page at %p\n", proc->pid, page_addr); proc->pid, page_addr);
goto err_alloc_page_failed; goto err_alloc_page_failed;
} }
tmp_area.addr = page_addr; tmp_area.addr = page_addr;
...@@ -594,8 +596,7 @@ static int binder_update_page_range(struct binder_proc *proc, int allocate, ...@@ -594,8 +596,7 @@ static int binder_update_page_range(struct binder_proc *proc, int allocate,
page_array_ptr = page; page_array_ptr = page;
ret = map_vm_area(&tmp_area, PAGE_KERNEL, &page_array_ptr); ret = map_vm_area(&tmp_area, PAGE_KERNEL, &page_array_ptr);
if (ret) { if (ret) {
pr_err("binder: %d: binder_alloc_buf failed " pr_err("%d: binder_alloc_buf failed to map page at %p in kernel\n",
"to map page at %p in kernel\n",
proc->pid, page_addr); proc->pid, page_addr);
goto err_map_kernel_failed; goto err_map_kernel_failed;
} }
...@@ -603,8 +604,7 @@ static int binder_update_page_range(struct binder_proc *proc, int allocate, ...@@ -603,8 +604,7 @@ static int binder_update_page_range(struct binder_proc *proc, int allocate,
(uintptr_t)page_addr + proc->user_buffer_offset; (uintptr_t)page_addr + proc->user_buffer_offset;
ret = vm_insert_page(vma, user_page_addr, page[0]); ret = vm_insert_page(vma, user_page_addr, page[0]);
if (ret) { if (ret) {
pr_err("binder: %d: binder_alloc_buf failed " pr_err("%d: binder_alloc_buf failed to map page at %lx in userspace\n",
"to map page at %lx in userspace\n",
proc->pid, user_page_addr); proc->pid, user_page_addr);
goto err_vm_insert_page_failed; goto err_vm_insert_page_failed;
} }
...@@ -652,7 +652,7 @@ static struct binder_buffer *binder_alloc_buf(struct binder_proc *proc, ...@@ -652,7 +652,7 @@ static struct binder_buffer *binder_alloc_buf(struct binder_proc *proc,
size_t size; size_t size;
if (proc->vma == NULL) { if (proc->vma == NULL) {
pr_err("binder: %d: binder_alloc_buf, no vma\n", pr_err("%d: binder_alloc_buf, no vma\n",
proc->pid); proc->pid);
return NULL; return NULL;
} }
...@@ -661,16 +661,16 @@ static struct binder_buffer *binder_alloc_buf(struct binder_proc *proc, ...@@ -661,16 +661,16 @@ static struct binder_buffer *binder_alloc_buf(struct binder_proc *proc,
ALIGN(offsets_size, sizeof(void *)); ALIGN(offsets_size, sizeof(void *));
if (size < data_size || size < offsets_size) { if (size < data_size || size < offsets_size) {
binder_user_error("binder: %d: got transaction with invalid " binder_user_error("%d: got transaction with invalid size %zd-%zd\n",
"size %zd-%zd\n", proc->pid, data_size, offsets_size); proc->pid, data_size, offsets_size);
return NULL; return NULL;
} }
if (is_async && if (is_async &&
proc->free_async_space < size + sizeof(struct binder_buffer)) { proc->free_async_space < size + sizeof(struct binder_buffer)) {
binder_debug(BINDER_DEBUG_BUFFER_ALLOC, binder_debug(BINDER_DEBUG_BUFFER_ALLOC,
"binder: %d: binder_alloc_buf size %zd" "%d: binder_alloc_buf size %zd failed, no async space left\n",
"failed, no async space left\n", proc->pid, size); proc->pid, size);
return NULL; return NULL;
} }
...@@ -690,8 +690,8 @@ static struct binder_buffer *binder_alloc_buf(struct binder_proc *proc, ...@@ -690,8 +690,8 @@ static struct binder_buffer *binder_alloc_buf(struct binder_proc *proc,
} }
} }
if (best_fit == NULL) { if (best_fit == NULL) {
pr_err("binder: %d: binder_alloc_buf size %zd failed, " pr_err("%d: binder_alloc_buf size %zd failed, no address space\n",
"no address space\n", proc->pid, size); proc->pid, size);
return NULL; return NULL;
} }
if (n == NULL) { if (n == NULL) {
...@@ -700,8 +700,8 @@ static struct binder_buffer *binder_alloc_buf(struct binder_proc *proc, ...@@ -700,8 +700,8 @@ static struct binder_buffer *binder_alloc_buf(struct binder_proc *proc,
} }
binder_debug(BINDER_DEBUG_BUFFER_ALLOC, binder_debug(BINDER_DEBUG_BUFFER_ALLOC,
"binder: %d: binder_alloc_buf size %zd got buff" "%d: binder_alloc_buf size %zd got buffer %p size %zd\n",
"er %p size %zd\n", proc->pid, size, buffer, buffer_size); proc->pid, size, buffer, buffer_size);
has_page_addr = has_page_addr =
(void *)(((uintptr_t)buffer->data + buffer_size) & PAGE_MASK); (void *)(((uintptr_t)buffer->data + buffer_size) & PAGE_MASK);
...@@ -729,17 +729,16 @@ static struct binder_buffer *binder_alloc_buf(struct binder_proc *proc, ...@@ -729,17 +729,16 @@ static struct binder_buffer *binder_alloc_buf(struct binder_proc *proc,
binder_insert_free_buffer(proc, new_buffer); binder_insert_free_buffer(proc, new_buffer);
} }
binder_debug(BINDER_DEBUG_BUFFER_ALLOC, binder_debug(BINDER_DEBUG_BUFFER_ALLOC,
"binder: %d: binder_alloc_buf size %zd got " "%d: binder_alloc_buf size %zd got %p\n",
"%p\n", proc->pid, size, buffer); proc->pid, size, buffer);
buffer->data_size = data_size; buffer->data_size = data_size;
buffer->offsets_size = offsets_size; buffer->offsets_size = offsets_size;
buffer->async_transaction = is_async; buffer->async_transaction = is_async;
if (is_async) { if (is_async) {
proc->free_async_space -= size + sizeof(struct binder_buffer); proc->free_async_space -= size + sizeof(struct binder_buffer);
binder_debug(BINDER_DEBUG_BUFFER_ALLOC_ASYNC, binder_debug(BINDER_DEBUG_BUFFER_ALLOC_ASYNC,
"binder: %d: binder_alloc_buf size %zd " "%d: binder_alloc_buf size %zd async free %zd\n",
"async free %zd\n", proc->pid, size, proc->pid, size, proc->free_async_space);
proc->free_async_space);
} }
return buffer; return buffer;
...@@ -770,8 +769,8 @@ static void binder_delete_free_buffer(struct binder_proc *proc, ...@@ -770,8 +769,8 @@ static void binder_delete_free_buffer(struct binder_proc *proc,
if (buffer_end_page(prev) == buffer_end_page(buffer)) if (buffer_end_page(prev) == buffer_end_page(buffer))
free_page_end = 0; free_page_end = 0;
binder_debug(BINDER_DEBUG_BUFFER_ALLOC, binder_debug(BINDER_DEBUG_BUFFER_ALLOC,
"binder: %d: merge free, buffer %p " "%d: merge free, buffer %p share page with %p\n",
"share page with %p\n", proc->pid, buffer, prev); proc->pid, buffer, prev);
} }
if (!list_is_last(&buffer->entry, &proc->buffers)) { if (!list_is_last(&buffer->entry, &proc->buffers)) {
...@@ -783,16 +782,14 @@ static void binder_delete_free_buffer(struct binder_proc *proc, ...@@ -783,16 +782,14 @@ static void binder_delete_free_buffer(struct binder_proc *proc,
buffer_start_page(buffer)) buffer_start_page(buffer))
free_page_start = 0; free_page_start = 0;
binder_debug(BINDER_DEBUG_BUFFER_ALLOC, binder_debug(BINDER_DEBUG_BUFFER_ALLOC,
"binder: %d: merge free, buffer" "%d: merge free, buffer %p share page with %p\n",
" %p share page with %p\n", proc->pid, proc->pid, buffer, prev);
buffer, prev);
} }
} }
list_del(&buffer->entry); list_del(&buffer->entry);
if (free_page_start || free_page_end) { if (free_page_start || free_page_end) {
binder_debug(BINDER_DEBUG_BUFFER_ALLOC, binder_debug(BINDER_DEBUG_BUFFER_ALLOC,
"binder: %d: merge free, buffer %p do " "%d: merge free, buffer %p do not share page%s%s with with %p or %p\n",
"not share page%s%s with with %p or %p\n",
proc->pid, buffer, free_page_start ? "" : " end", proc->pid, buffer, free_page_start ? "" : " end",
free_page_end ? "" : " start", prev, next); free_page_end ? "" : " start", prev, next);
binder_update_page_range(proc, 0, free_page_start ? binder_update_page_range(proc, 0, free_page_start ?
...@@ -813,8 +810,8 @@ static void binder_free_buf(struct binder_proc *proc, ...@@ -813,8 +810,8 @@ static void binder_free_buf(struct binder_proc *proc,
ALIGN(buffer->offsets_size, sizeof(void *)); ALIGN(buffer->offsets_size, sizeof(void *));
binder_debug(BINDER_DEBUG_BUFFER_ALLOC, binder_debug(BINDER_DEBUG_BUFFER_ALLOC,
"binder: %d: binder_free_buf %p size %zd buffer" "%d: binder_free_buf %p size %zd buffer_size %zd\n",
"_size %zd\n", proc->pid, buffer, size, buffer_size); proc->pid, buffer, size, buffer_size);
BUG_ON(buffer->free); BUG_ON(buffer->free);
BUG_ON(size > buffer_size); BUG_ON(size > buffer_size);
...@@ -826,9 +823,8 @@ static void binder_free_buf(struct binder_proc *proc, ...@@ -826,9 +823,8 @@ static void binder_free_buf(struct binder_proc *proc,
proc->free_async_space += size + sizeof(struct binder_buffer); proc->free_async_space += size + sizeof(struct binder_buffer);
binder_debug(BINDER_DEBUG_BUFFER_ALLOC_ASYNC, binder_debug(BINDER_DEBUG_BUFFER_ALLOC_ASYNC,
"binder: %d: binder_free_buf size %zd " "%d: binder_free_buf size %zd async free %zd\n",
"async free %zd\n", proc->pid, size, proc->pid, size, proc->free_async_space);
proc->free_async_space);
} }
binder_update_page_range(proc, 0, binder_update_page_range(proc, 0,
...@@ -910,7 +906,7 @@ static struct binder_node *binder_new_node(struct binder_proc *proc, ...@@ -910,7 +906,7 @@ static struct binder_node *binder_new_node(struct binder_proc *proc,
INIT_LIST_HEAD(&node->work.entry); INIT_LIST_HEAD(&node->work.entry);
INIT_LIST_HEAD(&node->async_todo); INIT_LIST_HEAD(&node->async_todo);
binder_debug(BINDER_DEBUG_INTERNAL_REFS, binder_debug(BINDER_DEBUG_INTERNAL_REFS,
"binder: %d:%d node %d u%p c%p created\n", "%d:%d node %d u%p c%p created\n",
proc->pid, current->pid, node->debug_id, proc->pid, current->pid, node->debug_id,
node->ptr, node->cookie); node->ptr, node->cookie);
return node; return node;
...@@ -925,8 +921,8 @@ static int binder_inc_node(struct binder_node *node, int strong, int internal, ...@@ -925,8 +921,8 @@ static int binder_inc_node(struct binder_node *node, int strong, int internal,
node->internal_strong_refs == 0 && node->internal_strong_refs == 0 &&
!(node == binder_context_mgr_node && !(node == binder_context_mgr_node &&
node->has_strong_ref)) { node->has_strong_ref)) {
pr_err("binder: invalid inc strong " pr_err("invalid inc strong node for %d\n",
"node for %d\n", node->debug_id); node->debug_id);
return -EINVAL; return -EINVAL;
} }
node->internal_strong_refs++; node->internal_strong_refs++;
...@@ -941,8 +937,8 @@ static int binder_inc_node(struct binder_node *node, int strong, int internal, ...@@ -941,8 +937,8 @@ static int binder_inc_node(struct binder_node *node, int strong, int internal,
node->local_weak_refs++; node->local_weak_refs++;
if (!node->has_weak_ref && list_empty(&node->work.entry)) { if (!node->has_weak_ref && list_empty(&node->work.entry)) {
if (target_list == NULL) { if (target_list == NULL) {
pr_err("binder: invalid inc weak node " pr_err("invalid inc weak node for %d\n",
"for %d\n", node->debug_id); node->debug_id);
return -EINVAL; return -EINVAL;
} }
list_add_tail(&node->work.entry, target_list); list_add_tail(&node->work.entry, target_list);
...@@ -978,12 +974,12 @@ static int binder_dec_node(struct binder_node *node, int strong, int internal) ...@@ -978,12 +974,12 @@ static int binder_dec_node(struct binder_node *node, int strong, int internal)
if (node->proc) { if (node->proc) {
rb_erase(&node->rb_node, &node->proc->nodes); rb_erase(&node->rb_node, &node->proc->nodes);
binder_debug(BINDER_DEBUG_INTERNAL_REFS, binder_debug(BINDER_DEBUG_INTERNAL_REFS,
"binder: refless node %d deleted\n", "refless node %d deleted\n",
node->debug_id); node->debug_id);
} else { } else {
hlist_del(&node->dead_node); hlist_del(&node->dead_node);
binder_debug(BINDER_DEBUG_INTERNAL_REFS, binder_debug(BINDER_DEBUG_INTERNAL_REFS,
"binder: dead node %d deleted\n", "dead node %d deleted\n",
node->debug_id); node->debug_id);
} }
kfree(node); kfree(node);
...@@ -1069,14 +1065,13 @@ static struct binder_ref *binder_get_ref_for_node(struct binder_proc *proc, ...@@ -1069,14 +1065,13 @@ static struct binder_ref *binder_get_ref_for_node(struct binder_proc *proc,
hlist_add_head(&new_ref->node_entry, &node->refs); hlist_add_head(&new_ref->node_entry, &node->refs);
binder_debug(BINDER_DEBUG_INTERNAL_REFS, binder_debug(BINDER_DEBUG_INTERNAL_REFS,
"binder: %d new ref %d desc %d for " "%d new ref %d desc %d for node %d\n",
"node %d\n", proc->pid, new_ref->debug_id, proc->pid, new_ref->debug_id, new_ref->desc,
new_ref->desc, node->debug_id); node->debug_id);
} else { } else {
binder_debug(BINDER_DEBUG_INTERNAL_REFS, binder_debug(BINDER_DEBUG_INTERNAL_REFS,
"binder: %d new ref %d desc %d for " "%d new ref %d desc %d for dead node\n",
"dead node\n", proc->pid, new_ref->debug_id, proc->pid, new_ref->debug_id, new_ref->desc);
new_ref->desc);
} }
return new_ref; return new_ref;
} }
...@@ -1084,9 +1079,9 @@ static struct binder_ref *binder_get_ref_for_node(struct binder_proc *proc, ...@@ -1084,9 +1079,9 @@ static struct binder_ref *binder_get_ref_for_node(struct binder_proc *proc,
static void binder_delete_ref(struct binder_ref *ref) static void binder_delete_ref(struct binder_ref *ref)
{ {
binder_debug(BINDER_DEBUG_INTERNAL_REFS, binder_debug(BINDER_DEBUG_INTERNAL_REFS,
"binder: %d delete ref %d desc %d for " "%d delete ref %d desc %d for node %d\n",
"node %d\n", ref->proc->pid, ref->debug_id, ref->proc->pid, ref->debug_id, ref->desc,
ref->desc, ref->node->debug_id); ref->node->debug_id);
rb_erase(&ref->rb_node_desc, &ref->proc->refs_by_desc); rb_erase(&ref->rb_node_desc, &ref->proc->refs_by_desc);
rb_erase(&ref->rb_node_node, &ref->proc->refs_by_node); rb_erase(&ref->rb_node_node, &ref->proc->refs_by_node);
...@@ -1096,9 +1091,8 @@ static void binder_delete_ref(struct binder_ref *ref) ...@@ -1096,9 +1091,8 @@ static void binder_delete_ref(struct binder_ref *ref)
binder_dec_node(ref->node, 0, 1); binder_dec_node(ref->node, 0, 1);
if (ref->death) { if (ref->death) {
binder_debug(BINDER_DEBUG_DEAD_BINDER, binder_debug(BINDER_DEBUG_DEAD_BINDER,
"binder: %d delete ref %d desc %d " "%d delete ref %d desc %d has death notification\n",
"has death notification\n", ref->proc->pid, ref->proc->pid, ref->debug_id, ref->desc);
ref->debug_id, ref->desc);
list_del(&ref->death->work.entry); list_del(&ref->death->work.entry);
kfree(ref->death); kfree(ref->death);
binder_stats_deleted(BINDER_STAT_DEATH); binder_stats_deleted(BINDER_STAT_DEATH);
...@@ -1134,8 +1128,7 @@ static int binder_dec_ref(struct binder_ref *ref, int strong) ...@@ -1134,8 +1128,7 @@ static int binder_dec_ref(struct binder_ref *ref, int strong)
{ {
if (strong) { if (strong) {
if (ref->strong == 0) { if (ref->strong == 0) {
binder_user_error("binder: %d invalid dec strong, " binder_user_error("%d invalid dec strong, ref %d desc %d s %d w %d\n",
"ref %d desc %d s %d w %d\n",
ref->proc->pid, ref->debug_id, ref->proc->pid, ref->debug_id,
ref->desc, ref->strong, ref->weak); ref->desc, ref->strong, ref->weak);
return -EINVAL; return -EINVAL;
...@@ -1149,8 +1142,7 @@ static int binder_dec_ref(struct binder_ref *ref, int strong) ...@@ -1149,8 +1142,7 @@ static int binder_dec_ref(struct binder_ref *ref, int strong)
} }
} else { } else {
if (ref->weak == 0) { if (ref->weak == 0) {
binder_user_error("binder: %d invalid dec weak, " binder_user_error("%d invalid dec weak, ref %d desc %d s %d w %d\n",
"ref %d desc %d s %d w %d\n",
ref->proc->pid, ref->debug_id, ref->proc->pid, ref->debug_id,
ref->desc, ref->strong, ref->weak); ref->desc, ref->strong, ref->weak);
return -EINVAL; return -EINVAL;
...@@ -1195,8 +1187,7 @@ static void binder_send_failed_reply(struct binder_transaction *t, ...@@ -1195,8 +1187,7 @@ static void binder_send_failed_reply(struct binder_transaction *t,
} }
if (target_thread->return_error == BR_OK) { if (target_thread->return_error == BR_OK) {
binder_debug(BINDER_DEBUG_FAILED_TRANSACTION, binder_debug(BINDER_DEBUG_FAILED_TRANSACTION,
"binder: send failed reply for " "send failed reply for transaction %d to %d:%d\n",
"transaction %d to %d:%d\n",
t->debug_id, target_thread->proc->pid, t->debug_id, target_thread->proc->pid,
target_thread->pid); target_thread->pid);
...@@ -1204,9 +1195,8 @@ static void binder_send_failed_reply(struct binder_transaction *t, ...@@ -1204,9 +1195,8 @@ static void binder_send_failed_reply(struct binder_transaction *t,
target_thread->return_error = error_code; target_thread->return_error = error_code;
wake_up_interruptible(&target_thread->wait); wake_up_interruptible(&target_thread->wait);
} else { } else {
pr_err("binder: reply failed, target " pr_err("reply failed, target thread, %d:%d, has error code %d already\n",
"thread, %d:%d, has error code %d " target_thread->proc->pid,
"already\n", target_thread->proc->pid,
target_thread->pid, target_thread->pid,
target_thread->return_error); target_thread->return_error);
} }
...@@ -1215,21 +1205,19 @@ static void binder_send_failed_reply(struct binder_transaction *t, ...@@ -1215,21 +1205,19 @@ static void binder_send_failed_reply(struct binder_transaction *t,
struct binder_transaction *next = t->from_parent; struct binder_transaction *next = t->from_parent;
binder_debug(BINDER_DEBUG_FAILED_TRANSACTION, binder_debug(BINDER_DEBUG_FAILED_TRANSACTION,
"binder: send failed reply " "send failed reply for transaction %d, target dead\n",
"for transaction %d, target dead\n",
t->debug_id); t->debug_id);
binder_pop_transaction(target_thread, t); binder_pop_transaction(target_thread, t);
if (next == NULL) { if (next == NULL) {
binder_debug(BINDER_DEBUG_DEAD_BINDER, binder_debug(BINDER_DEBUG_DEAD_BINDER,
"binder: reply failed," "reply failed, no target thread at root\n");
" no target thread at root\n");
return; return;
} }
t = next; t = next;
binder_debug(BINDER_DEBUG_DEAD_BINDER, binder_debug(BINDER_DEBUG_DEAD_BINDER,
"binder: reply failed, no target " "reply failed, no target thread -- retry %d\n",
"thread -- retry %d\n", t->debug_id); t->debug_id);
} }
} }
} }
...@@ -1242,7 +1230,7 @@ static void binder_transaction_buffer_release(struct binder_proc *proc, ...@@ -1242,7 +1230,7 @@ static void binder_transaction_buffer_release(struct binder_proc *proc,
int debug_id = buffer->debug_id; int debug_id = buffer->debug_id;
binder_debug(BINDER_DEBUG_TRANSACTION, binder_debug(BINDER_DEBUG_TRANSACTION,
"binder: %d buffer release %d, size %zd-%zd, failed at %p\n", "%d buffer release %d, size %zd-%zd, failed at %p\n",
proc->pid, buffer->debug_id, proc->pid, buffer->debug_id,
buffer->data_size, buffer->offsets_size, failed_at); buffer->data_size, buffer->offsets_size, failed_at);
...@@ -1259,9 +1247,8 @@ static void binder_transaction_buffer_release(struct binder_proc *proc, ...@@ -1259,9 +1247,8 @@ static void binder_transaction_buffer_release(struct binder_proc *proc,
if (*offp > buffer->data_size - sizeof(*fp) || if (*offp > buffer->data_size - sizeof(*fp) ||
buffer->data_size < sizeof(*fp) || buffer->data_size < sizeof(*fp) ||
!IS_ALIGNED(*offp, sizeof(void *))) { !IS_ALIGNED(*offp, sizeof(void *))) {
pr_err("binder: transaction release %d bad" pr_err("transaction release %d bad offset %zd, size %zd\n",
"offset %zd, size %zd\n", debug_id, debug_id, *offp, buffer->data_size);
*offp, buffer->data_size);
continue; continue;
} }
fp = (struct flat_binder_object *)(buffer->data + *offp); fp = (struct flat_binder_object *)(buffer->data + *offp);
...@@ -1270,8 +1257,8 @@ static void binder_transaction_buffer_release(struct binder_proc *proc, ...@@ -1270,8 +1257,8 @@ static void binder_transaction_buffer_release(struct binder_proc *proc,
case BINDER_TYPE_WEAK_BINDER: { case BINDER_TYPE_WEAK_BINDER: {
struct binder_node *node = binder_get_node(proc, fp->binder); struct binder_node *node = binder_get_node(proc, fp->binder);
if (node == NULL) { if (node == NULL) {
pr_err("binder: transaction release %d" pr_err("transaction release %d bad node %p\n",
" bad node %p\n", debug_id, fp->binder); debug_id, fp->binder);
break; break;
} }
binder_debug(BINDER_DEBUG_TRANSACTION, binder_debug(BINDER_DEBUG_TRANSACTION,
...@@ -1283,9 +1270,8 @@ static void binder_transaction_buffer_release(struct binder_proc *proc, ...@@ -1283,9 +1270,8 @@ static void binder_transaction_buffer_release(struct binder_proc *proc,
case BINDER_TYPE_WEAK_HANDLE: { case BINDER_TYPE_WEAK_HANDLE: {
struct binder_ref *ref = binder_get_ref(proc, fp->handle); struct binder_ref *ref = binder_get_ref(proc, fp->handle);
if (ref == NULL) { if (ref == NULL) {
pr_err("binder: transaction release %d" pr_err("transaction release %d bad handle %ld\n",
" bad handle %ld\n", debug_id, debug_id, fp->handle);
fp->handle);
break; break;
} }
binder_debug(BINDER_DEBUG_TRANSACTION, binder_debug(BINDER_DEBUG_TRANSACTION,
...@@ -1302,8 +1288,8 @@ static void binder_transaction_buffer_release(struct binder_proc *proc, ...@@ -1302,8 +1288,8 @@ static void binder_transaction_buffer_release(struct binder_proc *proc,
break; break;
default: default:
pr_err("binder: transaction release %d bad " pr_err("transaction release %d bad object type %lx\n",
"object type %lx\n", debug_id, fp->type); debug_id, fp->type);
break; break;
} }
} }
...@@ -1336,17 +1322,14 @@ static void binder_transaction(struct binder_proc *proc, ...@@ -1336,17 +1322,14 @@ static void binder_transaction(struct binder_proc *proc,
if (reply) { if (reply) {
in_reply_to = thread->transaction_stack; in_reply_to = thread->transaction_stack;
if (in_reply_to == NULL) { if (in_reply_to == NULL) {
binder_user_error("binder: %d:%d got reply transaction " binder_user_error("%d:%d got reply transaction with no transaction stack\n",
"with no transaction stack\n",
proc->pid, thread->pid); proc->pid, thread->pid);
return_error = BR_FAILED_REPLY; return_error = BR_FAILED_REPLY;
goto err_empty_call_stack; goto err_empty_call_stack;
} }
binder_set_nice(in_reply_to->saved_priority); binder_set_nice(in_reply_to->saved_priority);
if (in_reply_to->to_thread != thread) { if (in_reply_to->to_thread != thread) {
binder_user_error("binder: %d:%d got reply transaction " binder_user_error("%d:%d got reply transaction with bad transaction stack, transaction %d has target %d:%d\n",
"with bad transaction stack,"
" transaction %d has target %d:%d\n",
proc->pid, thread->pid, in_reply_to->debug_id, proc->pid, thread->pid, in_reply_to->debug_id,
in_reply_to->to_proc ? in_reply_to->to_proc ?
in_reply_to->to_proc->pid : 0, in_reply_to->to_proc->pid : 0,
...@@ -1363,9 +1346,7 @@ static void binder_transaction(struct binder_proc *proc, ...@@ -1363,9 +1346,7 @@ static void binder_transaction(struct binder_proc *proc,
goto err_dead_binder; goto err_dead_binder;
} }
if (target_thread->transaction_stack != in_reply_to) { if (target_thread->transaction_stack != in_reply_to) {
binder_user_error("binder: %d:%d got reply transaction " binder_user_error("%d:%d got reply transaction with bad target transaction stack %d, expected %d\n",
"with bad target transaction stack %d, "
"expected %d\n",
proc->pid, thread->pid, proc->pid, thread->pid,
target_thread->transaction_stack ? target_thread->transaction_stack ?
target_thread->transaction_stack->debug_id : 0, target_thread->transaction_stack->debug_id : 0,
...@@ -1381,8 +1362,7 @@ static void binder_transaction(struct binder_proc *proc, ...@@ -1381,8 +1362,7 @@ static void binder_transaction(struct binder_proc *proc,
struct binder_ref *ref; struct binder_ref *ref;
ref = binder_get_ref(proc, tr->target.handle); ref = binder_get_ref(proc, tr->target.handle);
if (ref == NULL) { if (ref == NULL) {
binder_user_error("binder: %d:%d got " binder_user_error("%d:%d got transaction to invalid handle\n",
"transaction to invalid handle\n",
proc->pid, thread->pid); proc->pid, thread->pid);
return_error = BR_FAILED_REPLY; return_error = BR_FAILED_REPLY;
goto err_invalid_target_handle; goto err_invalid_target_handle;
...@@ -1405,9 +1385,7 @@ static void binder_transaction(struct binder_proc *proc, ...@@ -1405,9 +1385,7 @@ static void binder_transaction(struct binder_proc *proc,
struct binder_transaction *tmp; struct binder_transaction *tmp;
tmp = thread->transaction_stack; tmp = thread->transaction_stack;
if (tmp->to_thread != thread) { if (tmp->to_thread != thread) {
binder_user_error("binder: %d:%d got new " binder_user_error("%d:%d got new transaction with bad transaction stack, transaction %d has target %d:%d\n",
"transaction with bad transaction stack"
", transaction %d has target %d:%d\n",
proc->pid, thread->pid, tmp->debug_id, proc->pid, thread->pid, tmp->debug_id,
tmp->to_proc ? tmp->to_proc->pid : 0, tmp->to_proc ? tmp->to_proc->pid : 0,
tmp->to_thread ? tmp->to_thread ?
...@@ -1452,16 +1430,14 @@ static void binder_transaction(struct binder_proc *proc, ...@@ -1452,16 +1430,14 @@ static void binder_transaction(struct binder_proc *proc,
if (reply) if (reply)
binder_debug(BINDER_DEBUG_TRANSACTION, binder_debug(BINDER_DEBUG_TRANSACTION,
"binder: %d:%d BC_REPLY %d -> %d:%d, " "%d:%d BC_REPLY %d -> %d:%d, data %p-%p size %zd-%zd\n",
"data %p-%p size %zd-%zd\n",
proc->pid, thread->pid, t->debug_id, proc->pid, thread->pid, t->debug_id,
target_proc->pid, target_thread->pid, target_proc->pid, target_thread->pid,
tr->data.ptr.buffer, tr->data.ptr.offsets, tr->data.ptr.buffer, tr->data.ptr.offsets,
tr->data_size, tr->offsets_size); tr->data_size, tr->offsets_size);
else else
binder_debug(BINDER_DEBUG_TRANSACTION, binder_debug(BINDER_DEBUG_TRANSACTION,
"binder: %d:%d BC_TRANSACTION %d -> " "%d:%d BC_TRANSACTION %d -> %d - node %d, data %p-%p size %zd-%zd\n",
"%d - node %d, data %p-%p size %zd-%zd\n",
proc->pid, thread->pid, t->debug_id, proc->pid, thread->pid, t->debug_id,
target_proc->pid, target_node->debug_id, target_proc->pid, target_node->debug_id,
tr->data.ptr.buffer, tr->data.ptr.offsets, tr->data.ptr.buffer, tr->data.ptr.offsets,
...@@ -1497,21 +1473,20 @@ static void binder_transaction(struct binder_proc *proc, ...@@ -1497,21 +1473,20 @@ static void binder_transaction(struct binder_proc *proc,
offp = (size_t *)(t->buffer->data + ALIGN(tr->data_size, sizeof(void *))); offp = (size_t *)(t->buffer->data + ALIGN(tr->data_size, sizeof(void *)));
if (copy_from_user(t->buffer->data, tr->data.ptr.buffer, tr->data_size)) { if (copy_from_user(t->buffer->data, tr->data.ptr.buffer, tr->data_size)) {
binder_user_error("binder: %d:%d got transaction with invalid " binder_user_error("%d:%d got transaction with invalid data ptr\n",
"data ptr\n", proc->pid, thread->pid); proc->pid, thread->pid);
return_error = BR_FAILED_REPLY; return_error = BR_FAILED_REPLY;
goto err_copy_data_failed; goto err_copy_data_failed;
} }
if (copy_from_user(offp, tr->data.ptr.offsets, tr->offsets_size)) { if (copy_from_user(offp, tr->data.ptr.offsets, tr->offsets_size)) {
binder_user_error("binder: %d:%d got transaction with invalid " binder_user_error("%d:%d got transaction with invalid offsets ptr\n",
"offsets ptr\n", proc->pid, thread->pid); proc->pid, thread->pid);
return_error = BR_FAILED_REPLY; return_error = BR_FAILED_REPLY;
goto err_copy_data_failed; goto err_copy_data_failed;
} }
if (!IS_ALIGNED(tr->offsets_size, sizeof(size_t))) { if (!IS_ALIGNED(tr->offsets_size, sizeof(size_t))) {
binder_user_error("binder: %d:%d got transaction with " binder_user_error("%d:%d got transaction with invalid offsets size, %zd\n",
"invalid offsets size, %zd\n", proc->pid, thread->pid, tr->offsets_size);
proc->pid, thread->pid, tr->offsets_size);
return_error = BR_FAILED_REPLY; return_error = BR_FAILED_REPLY;
goto err_bad_offset; goto err_bad_offset;
} }
...@@ -1521,9 +1496,8 @@ static void binder_transaction(struct binder_proc *proc, ...@@ -1521,9 +1496,8 @@ static void binder_transaction(struct binder_proc *proc,
if (*offp > t->buffer->data_size - sizeof(*fp) || if (*offp > t->buffer->data_size - sizeof(*fp) ||
t->buffer->data_size < sizeof(*fp) || t->buffer->data_size < sizeof(*fp) ||
!IS_ALIGNED(*offp, sizeof(void *))) { !IS_ALIGNED(*offp, sizeof(void *))) {
binder_user_error("binder: %d:%d got transaction with " binder_user_error("%d:%d got transaction with invalid offset, %zd\n",
"invalid offset, %zd\n", proc->pid, thread->pid, *offp);
proc->pid, thread->pid, *offp);
return_error = BR_FAILED_REPLY; return_error = BR_FAILED_REPLY;
goto err_bad_offset; goto err_bad_offset;
} }
...@@ -1543,8 +1517,7 @@ static void binder_transaction(struct binder_proc *proc, ...@@ -1543,8 +1517,7 @@ static void binder_transaction(struct binder_proc *proc,
node->accept_fds = !!(fp->flags & FLAT_BINDER_FLAG_ACCEPTS_FDS); node->accept_fds = !!(fp->flags & FLAT_BINDER_FLAG_ACCEPTS_FDS);
} }
if (fp->cookie != node->cookie) { if (fp->cookie != node->cookie) {
binder_user_error("binder: %d:%d sending u%p " binder_user_error("%d:%d sending u%p node %d, cookie mismatch %p != %p\n",
"node %d, cookie mismatch %p != %p\n",
proc->pid, thread->pid, proc->pid, thread->pid,
fp->binder, node->debug_id, fp->binder, node->debug_id,
fp->cookie, node->cookie); fp->cookie, node->cookie);
...@@ -1573,10 +1546,9 @@ static void binder_transaction(struct binder_proc *proc, ...@@ -1573,10 +1546,9 @@ static void binder_transaction(struct binder_proc *proc,
case BINDER_TYPE_WEAK_HANDLE: { case BINDER_TYPE_WEAK_HANDLE: {
struct binder_ref *ref = binder_get_ref(proc, fp->handle); struct binder_ref *ref = binder_get_ref(proc, fp->handle);
if (ref == NULL) { if (ref == NULL) {
binder_user_error("binder: %d:%d got " binder_user_error("%d:%d got transaction with invalid handle, %ld\n",
"transaction with invalid " proc->pid,
"handle, %ld\n", proc->pid, thread->pid, fp->handle);
thread->pid, fp->handle);
return_error = BR_FAILED_REPLY; return_error = BR_FAILED_REPLY;
goto err_binder_get_ref_failed; goto err_binder_get_ref_failed;
} }
...@@ -1617,13 +1589,13 @@ static void binder_transaction(struct binder_proc *proc, ...@@ -1617,13 +1589,13 @@ static void binder_transaction(struct binder_proc *proc,
if (reply) { if (reply) {
if (!(in_reply_to->flags & TF_ACCEPT_FDS)) { if (!(in_reply_to->flags & TF_ACCEPT_FDS)) {
binder_user_error("binder: %d:%d got reply with fd, %ld, but target does not allow fds\n", binder_user_error("%d:%d got reply with fd, %ld, but target does not allow fds\n",
proc->pid, thread->pid, fp->handle); proc->pid, thread->pid, fp->handle);
return_error = BR_FAILED_REPLY; return_error = BR_FAILED_REPLY;
goto err_fd_not_allowed; goto err_fd_not_allowed;
} }
} else if (!target_node->accept_fds) { } else if (!target_node->accept_fds) {
binder_user_error("binder: %d:%d got transaction with fd, %ld, but target does not allow fds\n", binder_user_error("%d:%d got transaction with fd, %ld, but target does not allow fds\n",
proc->pid, thread->pid, fp->handle); proc->pid, thread->pid, fp->handle);
return_error = BR_FAILED_REPLY; return_error = BR_FAILED_REPLY;
goto err_fd_not_allowed; goto err_fd_not_allowed;
...@@ -1631,7 +1603,7 @@ static void binder_transaction(struct binder_proc *proc, ...@@ -1631,7 +1603,7 @@ static void binder_transaction(struct binder_proc *proc,
file = fget(fp->handle); file = fget(fp->handle);
if (file == NULL) { if (file == NULL) {
binder_user_error("binder: %d:%d got transaction with invalid fd, %ld\n", binder_user_error("%d:%d got transaction with invalid fd, %ld\n",
proc->pid, thread->pid, fp->handle); proc->pid, thread->pid, fp->handle);
return_error = BR_FAILED_REPLY; return_error = BR_FAILED_REPLY;
goto err_fget_failed; goto err_fget_failed;
...@@ -1651,8 +1623,7 @@ static void binder_transaction(struct binder_proc *proc, ...@@ -1651,8 +1623,7 @@ static void binder_transaction(struct binder_proc *proc,
} break; } break;
default: default:
binder_user_error("binder: %d:%d got transactio" binder_user_error("%d:%d got transaction with invalid object type, %lx\n",
"n with invalid object type, %lx\n",
proc->pid, thread->pid, fp->type); proc->pid, thread->pid, fp->type);
return_error = BR_FAILED_REPLY; return_error = BR_FAILED_REPLY;
goto err_bad_object_type; goto err_bad_object_type;
...@@ -1709,7 +1680,7 @@ static void binder_transaction(struct binder_proc *proc, ...@@ -1709,7 +1680,7 @@ static void binder_transaction(struct binder_proc *proc,
err_invalid_target_handle: err_invalid_target_handle:
err_no_context_mgr_node: err_no_context_mgr_node:
binder_debug(BINDER_DEBUG_FAILED_TRANSACTION, binder_debug(BINDER_DEBUG_FAILED_TRANSACTION,
"binder: %d:%d transaction failed %d, size %zd-%zd\n", "%d:%d transaction failed %d, size %zd-%zd\n",
proc->pid, thread->pid, return_error, proc->pid, thread->pid, return_error,
tr->data_size, tr->offsets_size); tr->data_size, tr->offsets_size);
...@@ -1761,18 +1732,14 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread, ...@@ -1761,18 +1732,14 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
ref = binder_get_ref_for_node(proc, ref = binder_get_ref_for_node(proc,
binder_context_mgr_node); binder_context_mgr_node);
if (ref->desc != target) { if (ref->desc != target) {
binder_user_error("binder: %d:" binder_user_error("%d:%d tried to acquire reference to desc 0, got %d instead\n",
"%d tried to acquire "
"reference to desc 0, "
"got %d instead\n",
proc->pid, thread->pid, proc->pid, thread->pid,
ref->desc); ref->desc);
} }
} else } else
ref = binder_get_ref(proc, target); ref = binder_get_ref(proc, target);
if (ref == NULL) { if (ref == NULL) {
binder_user_error("binder: %d:%d refcou" binder_user_error("%d:%d refcount change on invalid ref %d\n",
"nt change on invalid ref %d\n",
proc->pid, thread->pid, target); proc->pid, thread->pid, target);
break; break;
} }
...@@ -1796,7 +1763,7 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread, ...@@ -1796,7 +1763,7 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
break; break;
} }
binder_debug(BINDER_DEBUG_USER_REFS, binder_debug(BINDER_DEBUG_USER_REFS,
"binder: %d:%d %s ref %d desc %d s %d w %d for node %d\n", "%d:%d %s ref %d desc %d s %d w %d for node %d\n",
proc->pid, thread->pid, debug_string, ref->debug_id, proc->pid, thread->pid, debug_string, ref->debug_id,
ref->desc, ref->strong, ref->weak, ref->node->debug_id); ref->desc, ref->strong, ref->weak, ref->node->debug_id);
break; break;
...@@ -1815,8 +1782,7 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread, ...@@ -1815,8 +1782,7 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
ptr += sizeof(void *); ptr += sizeof(void *);
node = binder_get_node(proc, node_ptr); node = binder_get_node(proc, node_ptr);
if (node == NULL) { if (node == NULL) {
binder_user_error("binder: %d:%d " binder_user_error("%d:%d %s u%p no match\n",
"%s u%p no match\n",
proc->pid, thread->pid, proc->pid, thread->pid,
cmd == BC_INCREFS_DONE ? cmd == BC_INCREFS_DONE ?
"BC_INCREFS_DONE" : "BC_INCREFS_DONE" :
...@@ -1825,8 +1791,7 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread, ...@@ -1825,8 +1791,7 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
break; break;
} }
if (cookie != node->cookie) { if (cookie != node->cookie) {
binder_user_error("binder: %d:%d %s u%p node %d" binder_user_error("%d:%d %s u%p node %d cookie mismatch %p != %p\n",
" cookie mismatch %p != %p\n",
proc->pid, thread->pid, proc->pid, thread->pid,
cmd == BC_INCREFS_DONE ? cmd == BC_INCREFS_DONE ?
"BC_INCREFS_DONE" : "BC_ACQUIRE_DONE", "BC_INCREFS_DONE" : "BC_ACQUIRE_DONE",
...@@ -1836,9 +1801,7 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread, ...@@ -1836,9 +1801,7 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
} }
if (cmd == BC_ACQUIRE_DONE) { if (cmd == BC_ACQUIRE_DONE) {
if (node->pending_strong_ref == 0) { if (node->pending_strong_ref == 0) {
binder_user_error("binder: %d:%d " binder_user_error("%d:%d BC_ACQUIRE_DONE node %d has no pending acquire request\n",
"BC_ACQUIRE_DONE node %d has "
"no pending acquire request\n",
proc->pid, thread->pid, proc->pid, thread->pid,
node->debug_id); node->debug_id);
break; break;
...@@ -1846,9 +1809,7 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread, ...@@ -1846,9 +1809,7 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
node->pending_strong_ref = 0; node->pending_strong_ref = 0;
} else { } else {
if (node->pending_weak_ref == 0) { if (node->pending_weak_ref == 0) {
binder_user_error("binder: %d:%d " binder_user_error("%d:%d BC_INCREFS_DONE node %d has no pending increfs request\n",
"BC_INCREFS_DONE node %d has "
"no pending increfs request\n",
proc->pid, thread->pid, proc->pid, thread->pid,
node->debug_id); node->debug_id);
break; break;
...@@ -1857,17 +1818,17 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread, ...@@ -1857,17 +1818,17 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
} }
binder_dec_node(node, cmd == BC_ACQUIRE_DONE, 0); binder_dec_node(node, cmd == BC_ACQUIRE_DONE, 0);
binder_debug(BINDER_DEBUG_USER_REFS, binder_debug(BINDER_DEBUG_USER_REFS,
"binder: %d:%d %s node %d ls %d lw %d\n", "%d:%d %s node %d ls %d lw %d\n",
proc->pid, thread->pid, proc->pid, thread->pid,
cmd == BC_INCREFS_DONE ? "BC_INCREFS_DONE" : "BC_ACQUIRE_DONE", cmd == BC_INCREFS_DONE ? "BC_INCREFS_DONE" : "BC_ACQUIRE_DONE",
node->debug_id, node->local_strong_refs, node->local_weak_refs); node->debug_id, node->local_strong_refs, node->local_weak_refs);
break; break;
} }
case BC_ATTEMPT_ACQUIRE: case BC_ATTEMPT_ACQUIRE:
pr_err("binder: BC_ATTEMPT_ACQUIRE not supported\n"); pr_err("BC_ATTEMPT_ACQUIRE not supported\n");
return -EINVAL; return -EINVAL;
case BC_ACQUIRE_RESULT: case BC_ACQUIRE_RESULT:
pr_err("binder: BC_ACQUIRE_RESULT not supported\n"); pr_err("BC_ACQUIRE_RESULT not supported\n");
return -EINVAL; return -EINVAL;
case BC_FREE_BUFFER: { case BC_FREE_BUFFER: {
...@@ -1880,20 +1841,17 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread, ...@@ -1880,20 +1841,17 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
buffer = binder_buffer_lookup(proc, data_ptr); buffer = binder_buffer_lookup(proc, data_ptr);
if (buffer == NULL) { if (buffer == NULL) {
binder_user_error("binder: %d:%d " binder_user_error("%d:%d BC_FREE_BUFFER u%p no match\n",
"BC_FREE_BUFFER u%p no match\n",
proc->pid, thread->pid, data_ptr); proc->pid, thread->pid, data_ptr);
break; break;
} }
if (!buffer->allow_user_free) { if (!buffer->allow_user_free) {
binder_user_error("binder: %d:%d " binder_user_error("%d:%d BC_FREE_BUFFER u%p matched unreturned buffer\n",
"BC_FREE_BUFFER u%p matched "
"unreturned buffer\n",
proc->pid, thread->pid, data_ptr); proc->pid, thread->pid, data_ptr);
break; break;
} }
binder_debug(BINDER_DEBUG_FREE_BUFFER, binder_debug(BINDER_DEBUG_FREE_BUFFER,
"binder: %d:%d BC_FREE_BUFFER u%p found buffer %d for %s transaction\n", "%d:%d BC_FREE_BUFFER u%p found buffer %d for %s transaction\n",
proc->pid, thread->pid, data_ptr, buffer->debug_id, proc->pid, thread->pid, data_ptr, buffer->debug_id,
buffer->transaction ? "active" : "finished"); buffer->transaction ? "active" : "finished");
...@@ -1927,19 +1885,15 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread, ...@@ -1927,19 +1885,15 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
case BC_REGISTER_LOOPER: case BC_REGISTER_LOOPER:
binder_debug(BINDER_DEBUG_THREADS, binder_debug(BINDER_DEBUG_THREADS,
"binder: %d:%d BC_REGISTER_LOOPER\n", "%d:%d BC_REGISTER_LOOPER\n",
proc->pid, thread->pid); proc->pid, thread->pid);
if (thread->looper & BINDER_LOOPER_STATE_ENTERED) { if (thread->looper & BINDER_LOOPER_STATE_ENTERED) {
thread->looper |= BINDER_LOOPER_STATE_INVALID; thread->looper |= BINDER_LOOPER_STATE_INVALID;
binder_user_error("binder: %d:%d ERROR:" binder_user_error("%d:%d ERROR: BC_REGISTER_LOOPER called after BC_ENTER_LOOPER\n",
" BC_REGISTER_LOOPER called "
"after BC_ENTER_LOOPER\n",
proc->pid, thread->pid); proc->pid, thread->pid);
} else if (proc->requested_threads == 0) { } else if (proc->requested_threads == 0) {
thread->looper |= BINDER_LOOPER_STATE_INVALID; thread->looper |= BINDER_LOOPER_STATE_INVALID;
binder_user_error("binder: %d:%d ERROR:" binder_user_error("%d:%d ERROR: BC_REGISTER_LOOPER called without request\n",
" BC_REGISTER_LOOPER called "
"without request\n",
proc->pid, thread->pid); proc->pid, thread->pid);
} else { } else {
proc->requested_threads--; proc->requested_threads--;
...@@ -1949,20 +1903,18 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread, ...@@ -1949,20 +1903,18 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
break; break;
case BC_ENTER_LOOPER: case BC_ENTER_LOOPER:
binder_debug(BINDER_DEBUG_THREADS, binder_debug(BINDER_DEBUG_THREADS,
"binder: %d:%d BC_ENTER_LOOPER\n", "%d:%d BC_ENTER_LOOPER\n",
proc->pid, thread->pid); proc->pid, thread->pid);
if (thread->looper & BINDER_LOOPER_STATE_REGISTERED) { if (thread->looper & BINDER_LOOPER_STATE_REGISTERED) {
thread->looper |= BINDER_LOOPER_STATE_INVALID; thread->looper |= BINDER_LOOPER_STATE_INVALID;
binder_user_error("binder: %d:%d ERROR:" binder_user_error("%d:%d ERROR: BC_ENTER_LOOPER called after BC_REGISTER_LOOPER\n",
" BC_ENTER_LOOPER called after "
"BC_REGISTER_LOOPER\n",
proc->pid, thread->pid); proc->pid, thread->pid);
} }
thread->looper |= BINDER_LOOPER_STATE_ENTERED; thread->looper |= BINDER_LOOPER_STATE_ENTERED;
break; break;
case BC_EXIT_LOOPER: case BC_EXIT_LOOPER:
binder_debug(BINDER_DEBUG_THREADS, binder_debug(BINDER_DEBUG_THREADS,
"binder: %d:%d BC_EXIT_LOOPER\n", "%d:%d BC_EXIT_LOOPER\n",
proc->pid, thread->pid); proc->pid, thread->pid);
thread->looper |= BINDER_LOOPER_STATE_EXITED; thread->looper |= BINDER_LOOPER_STATE_EXITED;
break; break;
...@@ -1982,8 +1934,7 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread, ...@@ -1982,8 +1934,7 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
ptr += sizeof(void *); ptr += sizeof(void *);
ref = binder_get_ref(proc, target); ref = binder_get_ref(proc, target);
if (ref == NULL) { if (ref == NULL) {
binder_user_error("binder: %d:%d %s " binder_user_error("%d:%d %s invalid ref %d\n",
"invalid ref %d\n",
proc->pid, thread->pid, proc->pid, thread->pid,
cmd == BC_REQUEST_DEATH_NOTIFICATION ? cmd == BC_REQUEST_DEATH_NOTIFICATION ?
"BC_REQUEST_DEATH_NOTIFICATION" : "BC_REQUEST_DEATH_NOTIFICATION" :
...@@ -1993,7 +1944,7 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread, ...@@ -1993,7 +1944,7 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
} }
binder_debug(BINDER_DEBUG_DEATH_NOTIFICATION, binder_debug(BINDER_DEBUG_DEATH_NOTIFICATION,
"binder: %d:%d %s %p ref %d desc %d s %d w %d for node %d\n", "%d:%d %s %p ref %d desc %d s %d w %d for node %d\n",
proc->pid, thread->pid, proc->pid, thread->pid,
cmd == BC_REQUEST_DEATH_NOTIFICATION ? cmd == BC_REQUEST_DEATH_NOTIFICATION ?
"BC_REQUEST_DEATH_NOTIFICATION" : "BC_REQUEST_DEATH_NOTIFICATION" :
...@@ -2003,10 +1954,7 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread, ...@@ -2003,10 +1954,7 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
if (cmd == BC_REQUEST_DEATH_NOTIFICATION) { if (cmd == BC_REQUEST_DEATH_NOTIFICATION) {
if (ref->death) { if (ref->death) {
binder_user_error("binder: %d:%" binder_user_error("%d:%d BC_REQUEST_DEATH_NOTIFICATION death notification already set\n",
"d BC_REQUEST_DEATH_NOTI"
"FICATION death notific"
"ation already set\n",
proc->pid, thread->pid); proc->pid, thread->pid);
break; break;
} }
...@@ -2014,8 +1962,7 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread, ...@@ -2014,8 +1962,7 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
if (death == NULL) { if (death == NULL) {
thread->return_error = BR_ERROR; thread->return_error = BR_ERROR;
binder_debug(BINDER_DEBUG_FAILED_TRANSACTION, binder_debug(BINDER_DEBUG_FAILED_TRANSACTION,
"binder: %d:%d " "%d:%d BC_REQUEST_DEATH_NOTIFICATION failed\n",
"BC_REQUEST_DEATH_NOTIFICATION failed\n",
proc->pid, thread->pid); proc->pid, thread->pid);
break; break;
} }
...@@ -2034,20 +1981,13 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread, ...@@ -2034,20 +1981,13 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
} }
} else { } else {
if (ref->death == NULL) { if (ref->death == NULL) {
binder_user_error("binder: %d:%" binder_user_error("%d:%d BC_CLEAR_DEATH_NOTIFICATION death notification not active\n",
"d BC_CLEAR_DEATH_NOTIFI"
"CATION death notificat"
"ion not active\n",
proc->pid, thread->pid); proc->pid, thread->pid);
break; break;
} }
death = ref->death; death = ref->death;
if (death->cookie != cookie) { if (death->cookie != cookie) {
binder_user_error("binder: %d:%" binder_user_error("%d:%d BC_CLEAR_DEATH_NOTIFICATION death notification cookie mismatch %p != %p\n",
"d BC_CLEAR_DEATH_NOTIFI"
"CATION death notificat"
"ion cookie mismatch "
"%p != %p\n",
proc->pid, thread->pid, proc->pid, thread->pid,
death->cookie, cookie); death->cookie, cookie);
break; break;
...@@ -2083,11 +2023,10 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread, ...@@ -2083,11 +2023,10 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
} }
} }
binder_debug(BINDER_DEBUG_DEAD_BINDER, binder_debug(BINDER_DEBUG_DEAD_BINDER,
"binder: %d:%d BC_DEAD_BINDER_DONE %p found %p\n", "%d:%d BC_DEAD_BINDER_DONE %p found %p\n",
proc->pid, thread->pid, cookie, death); proc->pid, thread->pid, cookie, death);
if (death == NULL) { if (death == NULL) {
binder_user_error("binder: %d:%d BC_DEAD" binder_user_error("%d:%d BC_DEAD_BINDER_DONE %p not found\n",
"_BINDER_DONE %p not found\n",
proc->pid, thread->pid, cookie); proc->pid, thread->pid, cookie);
break; break;
} }
...@@ -2105,7 +2044,7 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread, ...@@ -2105,7 +2044,7 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
} break; } break;
default: default:
pr_err("binder: %d:%d unknown command %d\n", pr_err("%d:%d unknown command %d\n",
proc->pid, thread->pid, cmd); proc->pid, thread->pid, cmd);
return -EINVAL; return -EINVAL;
} }
...@@ -2190,9 +2129,7 @@ static int binder_thread_read(struct binder_proc *proc, ...@@ -2190,9 +2129,7 @@ static int binder_thread_read(struct binder_proc *proc,
if (wait_for_proc_work) { if (wait_for_proc_work) {
if (!(thread->looper & (BINDER_LOOPER_STATE_REGISTERED | if (!(thread->looper & (BINDER_LOOPER_STATE_REGISTERED |
BINDER_LOOPER_STATE_ENTERED))) { BINDER_LOOPER_STATE_ENTERED))) {
binder_user_error("binder: %d:%d ERROR: Thread waiting " binder_user_error("%d:%d ERROR: Thread waiting for process work before calling BC_REGISTER_LOOPER or BC_ENTER_LOOPER (state %x)\n",
"for process work before calling BC_REGISTER_"
"LOOPER or BC_ENTER_LOOPER (state %x)\n",
proc->pid, thread->pid, thread->looper); proc->pid, thread->pid, thread->looper);
wait_event_interruptible(binder_user_error_wait, wait_event_interruptible(binder_user_error_wait,
binder_stop_on_user_error < 2); binder_stop_on_user_error < 2);
...@@ -2251,7 +2188,7 @@ static int binder_thread_read(struct binder_proc *proc, ...@@ -2251,7 +2188,7 @@ static int binder_thread_read(struct binder_proc *proc,
binder_stat_br(proc, thread, cmd); binder_stat_br(proc, thread, cmd);
binder_debug(BINDER_DEBUG_TRANSACTION_COMPLETE, binder_debug(BINDER_DEBUG_TRANSACTION_COMPLETE,
"binder: %d:%d BR_TRANSACTION_COMPLETE\n", "%d:%d BR_TRANSACTION_COMPLETE\n",
proc->pid, thread->pid); proc->pid, thread->pid);
list_del(&w->entry); list_del(&w->entry);
...@@ -2298,13 +2235,13 @@ static int binder_thread_read(struct binder_proc *proc, ...@@ -2298,13 +2235,13 @@ static int binder_thread_read(struct binder_proc *proc,
binder_stat_br(proc, thread, cmd); binder_stat_br(proc, thread, cmd);
binder_debug(BINDER_DEBUG_USER_REFS, binder_debug(BINDER_DEBUG_USER_REFS,
"binder: %d:%d %s %d u%p c%p\n", "%d:%d %s %d u%p c%p\n",
proc->pid, thread->pid, cmd_name, node->debug_id, node->ptr, node->cookie); proc->pid, thread->pid, cmd_name, node->debug_id, node->ptr, node->cookie);
} else { } else {
list_del_init(&w->entry); list_del_init(&w->entry);
if (!weak && !strong) { if (!weak && !strong) {
binder_debug(BINDER_DEBUG_INTERNAL_REFS, binder_debug(BINDER_DEBUG_INTERNAL_REFS,
"binder: %d:%d node %d u%p c%p deleted\n", "%d:%d node %d u%p c%p deleted\n",
proc->pid, thread->pid, node->debug_id, proc->pid, thread->pid, node->debug_id,
node->ptr, node->cookie); node->ptr, node->cookie);
rb_erase(&node->rb_node, &proc->nodes); rb_erase(&node->rb_node, &proc->nodes);
...@@ -2312,7 +2249,7 @@ static int binder_thread_read(struct binder_proc *proc, ...@@ -2312,7 +2249,7 @@ static int binder_thread_read(struct binder_proc *proc,
binder_stats_deleted(BINDER_STAT_NODE); binder_stats_deleted(BINDER_STAT_NODE);
} else { } else {
binder_debug(BINDER_DEBUG_INTERNAL_REFS, binder_debug(BINDER_DEBUG_INTERNAL_REFS,
"binder: %d:%d node %d u%p c%p state unchanged\n", "%d:%d node %d u%p c%p state unchanged\n",
proc->pid, thread->pid, node->debug_id, node->ptr, proc->pid, thread->pid, node->debug_id, node->ptr,
node->cookie); node->cookie);
} }
...@@ -2337,7 +2274,7 @@ static int binder_thread_read(struct binder_proc *proc, ...@@ -2337,7 +2274,7 @@ static int binder_thread_read(struct binder_proc *proc,
ptr += sizeof(void *); ptr += sizeof(void *);
binder_stat_br(proc, thread, cmd); binder_stat_br(proc, thread, cmd);
binder_debug(BINDER_DEBUG_DEATH_NOTIFICATION, binder_debug(BINDER_DEBUG_DEATH_NOTIFICATION,
"binder: %d:%d %s %p\n", "%d:%d %s %p\n",
proc->pid, thread->pid, proc->pid, thread->pid,
cmd == BR_DEAD_BINDER ? cmd == BR_DEAD_BINDER ?
"BR_DEAD_BINDER" : "BR_DEAD_BINDER" :
...@@ -2406,8 +2343,7 @@ static int binder_thread_read(struct binder_proc *proc, ...@@ -2406,8 +2343,7 @@ static int binder_thread_read(struct binder_proc *proc,
trace_binder_transaction_received(t); trace_binder_transaction_received(t);
binder_stat_br(proc, thread, cmd); binder_stat_br(proc, thread, cmd);
binder_debug(BINDER_DEBUG_TRANSACTION, binder_debug(BINDER_DEBUG_TRANSACTION,
"binder: %d:%d %s %d %d:%d, cmd %d" "%d:%d %s %d %d:%d, cmd %d size %zd-%zd ptr %p-%p\n",
"size %zd-%zd ptr %p-%p\n",
proc->pid, thread->pid, proc->pid, thread->pid,
(cmd == BR_TRANSACTION) ? "BR_TRANSACTION" : (cmd == BR_TRANSACTION) ? "BR_TRANSACTION" :
"BR_REPLY", "BR_REPLY",
...@@ -2440,7 +2376,7 @@ static int binder_thread_read(struct binder_proc *proc, ...@@ -2440,7 +2376,7 @@ static int binder_thread_read(struct binder_proc *proc,
/*spawn a new thread if we leave this out */) { /*spawn a new thread if we leave this out */) {
proc->requested_threads++; proc->requested_threads++;
binder_debug(BINDER_DEBUG_THREADS, binder_debug(BINDER_DEBUG_THREADS,
"binder: %d:%d BR_SPAWN_LOOPER\n", "%d:%d BR_SPAWN_LOOPER\n",
proc->pid, thread->pid); proc->pid, thread->pid);
if (put_user(BR_SPAWN_LOOPER, (uint32_t __user *)buffer)) if (put_user(BR_SPAWN_LOOPER, (uint32_t __user *)buffer))
return -EFAULT; return -EFAULT;
...@@ -2465,7 +2401,7 @@ static void binder_release_work(struct list_head *list) ...@@ -2465,7 +2401,7 @@ static void binder_release_work(struct list_head *list)
binder_send_failed_reply(t, BR_DEAD_REPLY); binder_send_failed_reply(t, BR_DEAD_REPLY);
} else { } else {
binder_debug(BINDER_DEBUG_DEAD_TRANSACTION, binder_debug(BINDER_DEBUG_DEAD_TRANSACTION,
"binder: undelivered transaction %d\n", "undelivered transaction %d\n",
t->debug_id); t->debug_id);
t->buffer->transaction = NULL; t->buffer->transaction = NULL;
kfree(t); kfree(t);
...@@ -2474,7 +2410,7 @@ static void binder_release_work(struct list_head *list) ...@@ -2474,7 +2410,7 @@ static void binder_release_work(struct list_head *list)
} break; } break;
case BINDER_WORK_TRANSACTION_COMPLETE: { case BINDER_WORK_TRANSACTION_COMPLETE: {
binder_debug(BINDER_DEBUG_DEAD_TRANSACTION, binder_debug(BINDER_DEBUG_DEAD_TRANSACTION,
"binder: undelivered TRANSACTION_COMPLETE\n"); "undelivered TRANSACTION_COMPLETE\n");
kfree(w); kfree(w);
binder_stats_deleted(BINDER_STAT_TRANSACTION_COMPLETE); binder_stats_deleted(BINDER_STAT_TRANSACTION_COMPLETE);
} break; } break;
...@@ -2484,13 +2420,13 @@ static void binder_release_work(struct list_head *list) ...@@ -2484,13 +2420,13 @@ static void binder_release_work(struct list_head *list)
death = container_of(w, struct binder_ref_death, work); death = container_of(w, struct binder_ref_death, work);
binder_debug(BINDER_DEBUG_DEAD_TRANSACTION, binder_debug(BINDER_DEBUG_DEAD_TRANSACTION,
"binder: undelivered death notification, %p\n", "undelivered death notification, %p\n",
death->cookie); death->cookie);
kfree(death); kfree(death);
binder_stats_deleted(BINDER_STAT_DEATH); binder_stats_deleted(BINDER_STAT_DEATH);
} break; } break;
default: default:
pr_err("binder: unexpected work type, %d, not freed\n", pr_err("unexpected work type, %d, not freed\n",
w->type); w->type);
break; break;
} }
...@@ -2547,8 +2483,8 @@ static int binder_free_thread(struct binder_proc *proc, ...@@ -2547,8 +2483,8 @@ static int binder_free_thread(struct binder_proc *proc,
while (t) { while (t) {
active_transactions++; active_transactions++;
binder_debug(BINDER_DEBUG_DEAD_TRANSACTION, binder_debug(BINDER_DEBUG_DEAD_TRANSACTION,
"binder: release %d:%d transaction %d " "release %d:%d transaction %d %s, still active\n",
"%s, still active\n", proc->pid, thread->pid, proc->pid, thread->pid,
t->debug_id, t->debug_id,
(t->to_thread == thread) ? "in" : "out"); (t->to_thread == thread) ? "in" : "out");
...@@ -2641,9 +2577,9 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -2641,9 +2577,9 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
goto err; goto err;
} }
binder_debug(BINDER_DEBUG_READ_WRITE, binder_debug(BINDER_DEBUG_READ_WRITE,
"binder: %d:%d write %ld at %08lx, read %ld at %08lx\n", "%d:%d write %ld at %08lx, read %ld at %08lx\n",
proc->pid, thread->pid, bwr.write_size, bwr.write_buffer, proc->pid, thread->pid, bwr.write_size,
bwr.read_size, bwr.read_buffer); bwr.write_buffer, bwr.read_size, bwr.read_buffer);
if (bwr.write_size > 0) { if (bwr.write_size > 0) {
ret = binder_thread_write(proc, thread, (void __user *)bwr.write_buffer, bwr.write_size, &bwr.write_consumed); ret = binder_thread_write(proc, thread, (void __user *)bwr.write_buffer, bwr.write_size, &bwr.write_consumed);
...@@ -2667,7 +2603,7 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -2667,7 +2603,7 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
} }
} }
binder_debug(BINDER_DEBUG_READ_WRITE, binder_debug(BINDER_DEBUG_READ_WRITE,
"binder: %d:%d wrote %ld of %ld, read return %ld of %ld\n", "%d:%d wrote %ld of %ld, read return %ld of %ld\n",
proc->pid, thread->pid, bwr.write_consumed, bwr.write_size, proc->pid, thread->pid, bwr.write_consumed, bwr.write_size,
bwr.read_consumed, bwr.read_size); bwr.read_consumed, bwr.read_size);
if (copy_to_user(ubuf, &bwr, sizeof(bwr))) { if (copy_to_user(ubuf, &bwr, sizeof(bwr))) {
...@@ -2684,14 +2620,13 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -2684,14 +2620,13 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
break; break;
case BINDER_SET_CONTEXT_MGR: case BINDER_SET_CONTEXT_MGR:
if (binder_context_mgr_node != NULL) { if (binder_context_mgr_node != NULL) {
pr_err("binder: BINDER_SET_CONTEXT_MGR already set\n"); pr_err("BINDER_SET_CONTEXT_MGR already set\n");
ret = -EBUSY; ret = -EBUSY;
goto err; goto err;
} }
if (uid_valid(binder_context_mgr_uid)) { if (uid_valid(binder_context_mgr_uid)) {
if (!uid_eq(binder_context_mgr_uid, current->cred->euid)) { if (!uid_eq(binder_context_mgr_uid, current->cred->euid)) {
pr_err("binder: BINDER_SET_" pr_err("BINDER_SET_CONTEXT_MGR bad uid %d != %d\n",
"CONTEXT_MGR bad uid %d != %d\n",
from_kuid(&init_user_ns, current->cred->euid), from_kuid(&init_user_ns, current->cred->euid),
from_kuid(&init_user_ns, binder_context_mgr_uid)); from_kuid(&init_user_ns, binder_context_mgr_uid));
ret = -EPERM; ret = -EPERM;
...@@ -2710,7 +2645,7 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -2710,7 +2645,7 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
binder_context_mgr_node->has_weak_ref = 1; binder_context_mgr_node->has_weak_ref = 1;
break; break;
case BINDER_THREAD_EXIT: case BINDER_THREAD_EXIT:
binder_debug(BINDER_DEBUG_THREADS, "binder: %d:%d exit\n", binder_debug(BINDER_DEBUG_THREADS, "%d:%d exit\n",
proc->pid, thread->pid); proc->pid, thread->pid);
binder_free_thread(proc, thread); binder_free_thread(proc, thread);
thread = NULL; thread = NULL;
...@@ -2736,7 +2671,7 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -2736,7 +2671,7 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
binder_unlock(__func__); binder_unlock(__func__);
wait_event_interruptible(binder_user_error_wait, binder_stop_on_user_error < 2); wait_event_interruptible(binder_user_error_wait, binder_stop_on_user_error < 2);
if (ret && ret != -ERESTARTSYS) if (ret && ret != -ERESTARTSYS)
pr_info("binder: %d:%d ioctl %x %lx returned %d\n", proc->pid, current->pid, cmd, arg, ret); pr_info("%d:%d ioctl %x %lx returned %d\n", proc->pid, current->pid, cmd, arg, ret);
err_unlocked: err_unlocked:
trace_binder_ioctl_done(ret); trace_binder_ioctl_done(ret);
return ret; return ret;
...@@ -2746,7 +2681,7 @@ static void binder_vma_open(struct vm_area_struct *vma) ...@@ -2746,7 +2681,7 @@ static void binder_vma_open(struct vm_area_struct *vma)
{ {
struct binder_proc *proc = vma->vm_private_data; struct binder_proc *proc = vma->vm_private_data;
binder_debug(BINDER_DEBUG_OPEN_CLOSE, binder_debug(BINDER_DEBUG_OPEN_CLOSE,
"binder: %d open vm area %lx-%lx (%ld K) vma %lx pagep %lx\n", "%d open vm area %lx-%lx (%ld K) vma %lx pagep %lx\n",
proc->pid, vma->vm_start, vma->vm_end, proc->pid, vma->vm_start, vma->vm_end,
(vma->vm_end - vma->vm_start) / SZ_1K, vma->vm_flags, (vma->vm_end - vma->vm_start) / SZ_1K, vma->vm_flags,
(unsigned long)pgprot_val(vma->vm_page_prot)); (unsigned long)pgprot_val(vma->vm_page_prot));
...@@ -2756,7 +2691,7 @@ static void binder_vma_close(struct vm_area_struct *vma) ...@@ -2756,7 +2691,7 @@ static void binder_vma_close(struct vm_area_struct *vma)
{ {
struct binder_proc *proc = vma->vm_private_data; struct binder_proc *proc = vma->vm_private_data;
binder_debug(BINDER_DEBUG_OPEN_CLOSE, binder_debug(BINDER_DEBUG_OPEN_CLOSE,
"binder: %d close vm area %lx-%lx (%ld K) vma %lx pagep %lx\n", "%d close vm area %lx-%lx (%ld K) vma %lx pagep %lx\n",
proc->pid, vma->vm_start, vma->vm_end, proc->pid, vma->vm_start, vma->vm_end,
(vma->vm_end - vma->vm_start) / SZ_1K, vma->vm_flags, (vma->vm_end - vma->vm_start) / SZ_1K, vma->vm_flags,
(unsigned long)pgprot_val(vma->vm_page_prot)); (unsigned long)pgprot_val(vma->vm_page_prot));
...@@ -3001,9 +2936,8 @@ static void binder_deferred_release(struct binder_proc *proc) ...@@ -3001,9 +2936,8 @@ static void binder_deferred_release(struct binder_proc *proc)
} }
} }
binder_debug(BINDER_DEBUG_DEAD_BINDER, binder_debug(BINDER_DEBUG_DEAD_BINDER,
"binder: node %d now dead, " "node %d now dead, refs %d, death %d\n",
"refs %d, death %d\n", node->debug_id, node->debug_id, incoming_refs, death);
incoming_refs, death);
} }
} }
outgoing_refs = 0; outgoing_refs = 0;
...@@ -3024,8 +2958,7 @@ static void binder_deferred_release(struct binder_proc *proc) ...@@ -3024,8 +2958,7 @@ static void binder_deferred_release(struct binder_proc *proc)
if (t) { if (t) {
t->buffer = NULL; t->buffer = NULL;
buffer->transaction = NULL; buffer->transaction = NULL;
pr_err("binder: release proc %d, " pr_err("release proc %d, transaction %d, not freed\n",
"transaction %d, not freed\n",
proc->pid, t->debug_id); proc->pid, t->debug_id);
/*BUG();*/ /*BUG();*/
} }
...@@ -3042,8 +2975,7 @@ static void binder_deferred_release(struct binder_proc *proc) ...@@ -3042,8 +2975,7 @@ static void binder_deferred_release(struct binder_proc *proc)
if (proc->pages[i]) { if (proc->pages[i]) {
void *page_addr = proc->buffer + i * PAGE_SIZE; void *page_addr = proc->buffer + i * PAGE_SIZE;
binder_debug(BINDER_DEBUG_BUFFER_ALLOC, binder_debug(BINDER_DEBUG_BUFFER_ALLOC,
"binder_release: %d: " "binder_release: %d: page %d at %p not freed\n",
"page %d at %p not freed\n",
proc->pid, i, proc->pid, i,
page_addr); page_addr);
unmap_kernel_range((unsigned long)page_addr, unmap_kernel_range((unsigned long)page_addr,
...@@ -3059,9 +2991,7 @@ static void binder_deferred_release(struct binder_proc *proc) ...@@ -3059,9 +2991,7 @@ static void binder_deferred_release(struct binder_proc *proc)
put_task_struct(proc->tsk); put_task_struct(proc->tsk);
binder_debug(BINDER_DEBUG_OPEN_CLOSE, binder_debug(BINDER_DEBUG_OPEN_CLOSE,
"binder_release: %d threads %d, nodes %d (ref %d), " "binder_release: %d threads %d, nodes %d (ref %d), refs %d, active transactions %d, buffers %d, pages %d\n",
"refs %d, active transactions %d, buffers %d, "
"pages %d\n",
proc->pid, threads, nodes, incoming_refs, outgoing_refs, proc->pid, threads, nodes, incoming_refs, outgoing_refs,
active_transactions, buffers, page_count); active_transactions, buffers, page_count);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment