From: Carlos Llamas <cmllamas@google.com>
To: Suren Baghdasaryan <surenb@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
"Liam R. Howlett" <Liam.Howlett@oracle.com>,
Michal Hocko <mhocko@suse.com>,
Guenter Roeck <groeck@chromium.org>,
Douglas Anderson <dianders@chromium.org>,
Christian Brauner <brauner@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-mm@kvack.org
Subject: Re: BUG in binder_vma_close() at mmap_assert_locked() in stable v5.15
Date: Fri, 9 Sep 2022 19:35:35 +0000 [thread overview]
Message-ID: <YxuVh9lhMKKO0qW+@google.com> (raw)
In-Reply-To: <CAJuCfpEtQKb3UKuWBxE+S=PrcYyLRe1jF8ashjAXm+9kxAuERg@mail.gmail.com>
On Thu, Sep 08, 2022 at 03:33:52PM -0700, Suren Baghdasaryan wrote:
> > However, mmap_locking was only added to the exit_mmap() path in commit
> > f798a1d4f94d ("mm: fix use-after-free bug when mm->mmap is reused after
> > being freed") and since this patch doesn't exist in v5.15 stable tree
Sorry, I meant 64591e8605d6 ("mm: protect free_pgtables with mmap_lock
write lock in exit_mmap") here, that's when protection was added.
> IIUC, the binder patches are backported to 5.15 kernel and they expect
> mmap_lock to be held during remove_vma() operation in exit_mmap().
Correct!
> However in 5.15 kernel that assumption is incorrect. In that case IMHO
> the backport needs to drop that invalid expectation.
Does this mean that users of async calls such as find_vma() can't rely
on mmap_lock to avoid racing with remove_vma()? I see the following
pattern is used quite often:
mmap_read_lock(mm);
vma = find_vma(mm, addr);
[...]
mmap_read_unlock(mm);
Is this not a real concern? I'd drop the asserts from binder and call it
a day. However, we would also need to fix our race with vm_ops->close().
next prev parent reply other threads:[~2022-09-09 19:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-08 20:28 BUG in binder_vma_close() at mmap_assert_locked() in stable v5.15 Carlos Llamas
2022-09-08 22:33 ` Suren Baghdasaryan
2022-09-09 19:35 ` Carlos Llamas [this message]
2022-09-09 20:03 ` Suren Baghdasaryan
2022-09-12 19:11 ` Carlos Llamas
2022-09-13 6:36 ` Liam Howlett
2022-09-23 20:50 ` Carlos Llamas
2022-09-28 23:21 ` Suren Baghdasaryan
2022-09-29 14:39 ` Carlos Llamas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YxuVh9lhMKKO0qW+@google.com \
--to=cmllamas@google.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=brauner@kernel.org \
--cc=dianders@chromium.org \
--cc=gregkh@linuxfoundation.org \
--cc=groeck@chromium.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=surenb@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).