linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Yang Shi <shy828301@gmail.com>
Cc: syzbot <syzbot+b90df26038d1d5d85c97@syzkaller.appspotmail.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux MM <linux-mm@kvack.org>,
	syzkaller-bugs@googlegroups.com, Jan Kara <jack@suse.cz>
Subject: Re: KASAN: use-after-free Read in do_madvise
Date: Fri, 21 Aug 2020 13:03:37 -0700	[thread overview]
Message-ID: <20200821130337.f4d1f5cd665ab149e1f43ed5@linux-foundation.org> (raw)
In-Reply-To: <CAHbLzkqM-x0aD59z0mFRW37JsxRPL+5xKRRfU1qY18LKksQ3ZQ@mail.gmail.com>

On Fri, 21 Aug 2020 10:15:45 -0700 Yang Shi <shy828301@gmail.com> wrote:

> It looks the vma is gone. The below patch should be able to fix it:
> 
> diff --git a/mm/madvise.c b/mm/madvise.c
> index dd1d43cf026d..d4aa5f776543 100644
> --- a/mm/madvise.c
> +++ b/mm/madvise.c
> @@ -289,9 +289,9 @@ static long madvise_willneed(struct vm_area_struct *vma,
>          */
>         *prev = NULL;   /* tell sys_madvise we drop mmap_lock */
>         get_file(file);
> -       mmap_read_unlock(current->mm);
>         offset = (loff_t)(start - vma->vm_start)
>                         + ((loff_t)vma->vm_pgoff << PAGE_SHIFT);
> +       mmap_read_unlock(current->mm);
>         vfs_fadvise(file, offset, end - start, POSIX_FADV_WILLNEED);
>         fput(file);
>         mmap_read_lock(current->mm);

Oh geeze.  Can you please send this along as a real patch, cc:stable,
Fixes: 692fe62433d4c?  Please cc Jan!


  reply	other threads:[~2020-08-21 20:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <000000000000e44b7d05ad6624df@google.com>
2020-08-21 17:15 ` Yang Shi
2020-08-21 20:03   ` Andrew Morton [this message]
2020-08-21 20:34     ` Yang Shi

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=20200821130337.f4d1f5cd665ab149e1f43ed5@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=jack@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=shy828301@gmail.com \
    --cc=syzbot+b90df26038d1d5d85c97@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