linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Suren Baghdasaryan <surenb@google.com>
To: Michal Hocko <mhocko@suse.com>
Cc: Yang Shi <shy828301@gmail.com>,
	 syzbot <syzbot+2ccf63a4bd07cf39cab0@syzkaller.appspotmail.com>,
	 Andrew Morton <akpm@linux-foundation.org>,
	Christian Brauner <brauner@kernel.org>,
	 Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux MM <linux-mm@kvack.org>,
	 syzkaller-bugs <syzkaller-bugs@googlegroups.com>
Subject: Re: [syzbot] KASAN: use-after-free Read in __oom_reap_task_mm
Date: Tue, 15 Feb 2022 12:30:12 -0800	[thread overview]
Message-ID: <CAJuCfpF0-xm-RzUmaA6uHQ974tGtg4F8jzTTOFbBLM8iUy4nFA@mail.gmail.com> (raw)
In-Reply-To: <CAJuCfpGixCqZDAqokxCrQ1YjMb+32Y77U5jHkULKM0htnR19MQ@mail.gmail.com>

On Tue, Feb 15, 2022 at 11:43 AM Suren Baghdasaryan <surenb@google.com> wrote:
>
> On Tue, Feb 15, 2022 at 11:36 AM Michal Hocko <mhocko@suse.com> wrote:
> >
> > On Tue 15-02-22 10:10:53, Suren Baghdasaryan wrote:
> > > On Tue, Feb 15, 2022 at 9:53 AM Yang Shi <shy828301@gmail.com> wrote:
> > [...]
> > > > Isn't the below race possible?
> > > >
> > > >           CPU A                                     CPU B
> > > > exiting:
> > > >   mmap_write_lock
> > > >   remove_vma()
> > > >   mmap_write_unlock
> > > >                                                 process_mrelease:
> > > >                                                   mmap_read_lock
> > > >                                                   __oom_reap_task_mm
> > > >                                                   mmap_read_unlock
> > > >
> > >
> > > Sure, that sequence (would not call it a race) is possible but in this
> > > case __oom_reap_task_mm will find no vmas in the mm because exit_mmap
> > > freed and removed all of them.
> >
> > I didn't really have chance to have a closer look but I do not see
> > exit_mmap doing mm->mmap = NULL so the pointer can be a freed vma unless
> > I am missing something. I thought we've had it in your patches? Has this
> > got lost somewhere in the process?
>
> Doh! Yes, it looks like I completely missed the actual pointer. That
> must be it since I don't see any other possibility. Will post a patch
> shortly.

Fix posted at https://lore.kernel.org/all/20220215201922.1908156-1-surenb@google.com/

> Thanks!
>
> > --
> > Michal Hocko
> > SUSE Labs


      reply	other threads:[~2022-02-15 20:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-14 10:44 [syzbot] KASAN: use-after-free Read in __oom_reap_task_mm syzbot
2022-02-14 19:07 ` Yang Shi
2022-02-15  9:59   ` Michal Hocko
2022-02-15 17:34     ` Suren Baghdasaryan
2022-02-15 17:53       ` Yang Shi
2022-02-15 18:10         ` Suren Baghdasaryan
2022-02-15 19:36           ` Michal Hocko
2022-02-15 19:43             ` Suren Baghdasaryan
2022-02-15 20:30               ` Suren Baghdasaryan [this message]

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=CAJuCfpF0-xm-RzUmaA6uHQ974tGtg4F8jzTTOFbBLM8iUy4nFA@mail.gmail.com \
    --to=surenb@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=brauner@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=shy828301@gmail.com \
    --cc=syzbot+2ccf63a4bd07cf39cab0@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.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).