[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Y4dwgn5JgatoIP1+@google.com>
Date: Wed, 30 Nov 2022 15:02:26 +0000
From: Carlos Llamas <cmllamas@...gle.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: 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>,
Hridya Valsaraju <hridya@...gle.com>,
Suren Baghdasaryan <surenb@...gle.com>,
"Liam R. Howlett" <Liam.Howlett@...cle.com>,
linux-kernel@...r.kernel.org, kernel-team@...roid.com,
Jann Horn <jannh@...gle.com>, stable@...r.kernel.org,
Todd Kjos <tkjos@...gle.com>
Subject: Re: [PATCH 5.15] binder: validate alloc->mm in ->mmap() handler
On Wed, Nov 30, 2022 at 01:40:58PM +0100, Greg Kroah-Hartman wrote:
> On Wed, Nov 23, 2022 at 06:09:21PM +0000, Carlos Llamas wrote:
> > commit 3ce00bb7e91cf57d723905371507af57182c37ef upstream.
> >
> > Since commit 1da52815d5f1 ("binder: fix alloc->vma_vm_mm null-ptr
> > dereference") binder caches a pointer to the current->mm during open().
> > This fixes a null-ptr dereference reported by syzkaller. Unfortunately,
> > it also opens the door for a process to update its mm after the open(),
> > (e.g. via execve) making the cached alloc->mm pointer invalid.
> >
> > Things get worse when the process continues to mmap() a vma. From this
> > point forward, binder will attempt to find this vma using an obsolete
> > alloc->mm reference. Such as in binder_update_page_range(), where the
> > wrong vma is obtained via vma_lookup(), yet binder proceeds to happily
> > insert new pages into it.
> >
> > To avoid this issue fail the ->mmap() callback if we detect a mismatch
> > between the vma->vm_mm and the original alloc->mm pointer. This prevents
> > alloc->vm_addr from getting set, so that any subsequent vma_lookup()
> > calls fail as expected.
> >
> > Fixes: 1da52815d5f1 ("binder: fix alloc->vma_vm_mm null-ptr dereference")
> > Reported-by: Jann Horn <jannh@...gle.com>
> > Cc: <stable@...r.kernel.org> # 5.15+
> > Signed-off-by: Carlos Llamas <cmllamas@...gle.com>
> > Acked-by: Todd Kjos <tkjos@...gle.com>
> > Link: https://lore.kernel.org/r/20221104231235.348958-1-cmllamas@google.com
> > Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> > [cmllamas: renamed alloc->mm since missing e66b77e50522]
> > Signed-off-by: Carlos Llamas <cmllamas@...gle.com>
> > ---
> > drivers/android/binder_alloc.c | 7 +++++++
> > 1 file changed, 7 insertions(+)
> >
>
> This too is already in the 5.15 queue, is this a different version?
>
> thanks,
>
> greg k-h
It's the same version, please ignore this one too. Thanks.
Powered by blists - more mailing lists