android_kernel_sony_sdm845/drivers/android
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Todd Kjos 1903801ee4 binder: fix UAF when releasing todo list
When releasing a thread todo list when tearing down
a binder_proc, the following race was possible which
could result in a use-after-free:

1.  Thread 1: enter binder_release_work from binder_thread_release
2.  Thread 2: binder_update_ref_for_handle() calls binder_dec_node_ilocked()
3.  Thread 2: dec nodeA --> 0 (will free node)
4.  Thread 1: ACQ inner_proc_lock
5.  Thread 2: block on inner_proc_lock
6.  Thread 1: dequeue work (BINDER_WORK_NODE, part of nodeA)
7.  Thread 1: REL inner_proc_lock
8.  Thread 2: ACQ inner_proc_lock
9.  Thread 2: todo list cleanup, but work was already dequeued
10. Thread 2: free node
11. Thread 2: REL inner_proc_lock
12. Thread 1: deref w->type (UAF)

The problem was that for a BINDER_WORK_NODE, the binder_work element
must not be accessed after releasing the inner_proc_lock while
processing the todo list elements since another thread might be
handling a deref on the node containing the binder_work element
leading to the node being freed.

Bug: 161151868
Signed-off-by: Todd Kjos <tkjos@google.com>
Change-Id: I4ae752abfe1aa38872be6f266ddd271802952625
Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Git-commit: cebe72f19bebdee8fc9f1b31dd21a88a259ff419
Signed-off-by: Alam Md Danish <amddan@codeaurora.org>
Signed-off-by: Rahul Shahare <rshaha@codeaurora.org>
2020-11-06 07:19:36 -08:00
..
binder.c binder: fix UAF when releasing todo list 2020-11-06 07:19:36 -08:00
binder_alloc.c ANDROID: fix binder change in merge of 4.9.188 2019-08-12 21:12:43 +02:00
binder_alloc.h android: binder: Fix the binder transaction fail issue for 32bit target 2019-07-12 08:45:39 +08:00
binder_alloc_selftest.c UPSTREAM: binder: fix sparse issue in binder_alloc_selftest.c 2019-03-25 17:00:44 -07:00
binder_trace.h BACKPORT: binder: use userspace pointer as base of buffer space 2019-03-25 17:00:44 -07:00
Kconfig Revert "UPSTREAM: ANDROID: binder: remove 32-bit binder interface." 2018-09-18 03:54:59 -07:00
Makefile FROMLIST: android: binder: Add allocator selftest 2017-08-31 17:06:00 -07:00