Files
linux/drivers
Jann Horn a7a74d7ff5 binder: Prevent repeated use of ->mmap() via NULL mapping
binder_alloc_mmap_handler() attempts to detect the use of ->mmap() on a
binder_proc whose binder_alloc has already been initialized by checking
whether alloc->buffer is non-zero.

Before commit 880211667b ("binder: remove kernel vm_area for buffer
space"), alloc->buffer was a kernel mapping address, which is always
non-zero, but since that commit, it is a userspace mapping address.

A sufficiently privileged user can map /dev/binder at NULL, tricking
binder_alloc_mmap_handler() into assuming that the binder_proc has not been
mapped yet. This leads to memory unsafety.
Luckily, no context on Android has such privileges, and on a typical Linux
desktop system, you need to be root to do that.

Fix it by using the mapping size instead of the mapping address to
distinguish the mapped case. A valid VMA can't have size zero.

Fixes: 880211667b ("binder: remove kernel vm_area for buffer space")
Cc: stable@vger.kernel.org
Signed-off-by: Jann Horn <jannh@google.com>
Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
Link: https://lore.kernel.org/r/20191018205631.248274-2-jannh@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-14 11:44:47 +08:00
..
2019-11-13 19:08:22 +08:00
2019-11-11 06:24:30 +01:00
2019-11-11 06:24:30 +01:00
2019-11-03 19:54:53 +01:00
2019-11-06 21:48:29 -08:00
2019-09-23 17:20:40 -04:00
2019-11-05 18:35:33 +01:00
2019-10-15 23:51:36 +02:00
2019-10-22 17:55:51 +02:00
2019-10-26 19:47:31 +08:00
2019-11-03 19:54:53 +01:00
2019-10-15 14:07:01 -06:00
2019-10-14 07:36:49 +02:00