OpenCloudOS-Kernel/drivers/android
Todd Kjos 7bada55ab5 binder: fix race that allows malicious free of live buffer
Malicious code can attempt to free buffers using the BC_FREE_BUFFER
ioctl to binder. There are protections against a user freeing a buffer
while in use by the kernel, however there was a window where
BC_FREE_BUFFER could be used to free a recently allocated buffer that
was not completely initialized. This resulted in a use-after-free
detected by KASAN with a malicious test program.

This window is closed by setting the buffer's allow_user_free attribute
to 0 when the buffer is allocated or when the user has previously freed
it instead of waiting for the caller to set it. The problem was that
when the struct buffer was recycled, allow_user_free was stale and set
to 1 allowing a free to go through.

Signed-off-by: Todd Kjos <tkjos@google.com>
Acked-by: Arve Hjønnevåg <arve@android.com>
Cc: stable <stable@vger.kernel.org> # 4.14
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-26 20:01:47 +01:00
..
Kconfig binder: use standard functions to allocate fds 2018-09-14 15:22:36 +02:00
Makefile android: binder: Add allocator selftest 2017-08-28 16:47:17 +02:00
binder.c binder: fix race that allows malicious free of live buffer 2018-11-26 20:01:47 +01:00
binder_alloc.c binder: fix race that allows malicious free of live buffer 2018-11-26 20:01:47 +01:00
binder_alloc.h binder: fix race that allows malicious free of live buffer 2018-11-26 20:01:47 +01:00
binder_alloc_selftest.c android: binder: Add global lru shrinker to binder 2017-08-28 16:47:17 +02:00
binder_trace.h binder: use standard functions to allocate fds 2018-09-14 15:22:36 +02:00