[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <BXTK4ZPTAH1J.TZS34Z5LVHR9@wittgenstein>
Date: Sat, 19 Oct 2019 16:07:02 +0200
From: "Christian Brauner" <christian.brauner@...ntu.com>
To: "Jann Horn" <jannh@...gle.com>,
"Greg Kroah-Hartman" <gregkh@...uxfoundation.org>,
Arve Hjønnevåg <arve@...roid.com>,
"Todd Kjos" <tkjos@...roid.com>,
"Martijn Coenen" <maco@...roid.com>,
"Joel Fernandes" <joel@...lfernandes.org>,
"Christian Brauner" <christian@...uner.io>, <jannh@...gle.com>
Cc: <devel@...verdev.osuosl.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/3] binder: Prevent repeated use of ->mmap() via NULL
mapping
On Fri Oct 18, 2019 at 10:56 PM Jann Horn wrote:
> 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 880211667b20 ("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: 880211667b20 ("binder: remove kernel vm_area for buffer space")
> Cc: stable@...r.kernel.org
> Signed-off-by: Jann Horn <jannh@...gle.com>
Acked-by: Christian Brauner <christian.brauner@...ntu.com>
Powered by blists - more mailing lists