All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: syzbot <syzbot+b591856e0f0139f83023@syzkaller.appspotmail.com>
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org, syzkaller-bugs@googlegroups.com,
	Suren Baghdasaryan <surenb@google.com>
Subject: Re: [syzbot] [mm?] kernel BUG in vma_replace_policy
Date: Tue, 12 Sep 2023 15:55:36 +0100	[thread overview]
Message-ID: <ZQB76G/6NxVgoE9u@casper.infradead.org> (raw)
In-Reply-To: <ZP/3hgDCXeceE9uU@casper.infradead.org>

On Tue, Sep 12, 2023 at 06:30:46AM +0100, Matthew Wilcox wrote:
> On Tue, Sep 05, 2023 at 06:03:49PM -0700, syzbot wrote:
> > Hello,
> > 
> > syzbot found the following issue on:
> > 
> > HEAD commit:    a47fc304d2b6 Add linux-next specific files for 20230831
> > git tree:       linux-next
> > console+strace: https://syzkaller.appspot.com/x/log.txt?x=16502ddba80000
> > kernel config:  https://syzkaller.appspot.com/x/.config?x=6ecd2a74f20953b9
> > dashboard link: https://syzkaller.appspot.com/bug?extid=b591856e0f0139f83023
> > compiler:       gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
> > syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=120e7d70680000
> > C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=1523f9c0680000
> > 
> > Downloadable assets:
> > disk image: https://storage.googleapis.com/syzbot-assets/b2e8f4217527/disk-a47fc304.raw.xz
> > vmlinux: https://storage.googleapis.com/syzbot-assets/ed6cdcc09339/vmlinux-a47fc304.xz
> > kernel image: https://storage.googleapis.com/syzbot-assets/bd9b2475bf5a/bzImage-a47fc304.xz
> > 
> > IMPORTANT: if you fix the issue, please add the following tag to the commit:
> > Reported-by: syzbot+b591856e0f0139f83023@syzkaller.appspotmail.com
> 
> #syz test
> 
> diff --git a/mm/mempolicy.c b/mm/mempolicy.c
> index 42b5567e3773..90ad5fe60824 100644
> --- a/mm/mempolicy.c
> +++ b/mm/mempolicy.c
> @@ -1342,6 +1342,7 @@ static long do_mbind(unsigned long start, unsigned long len,
>  	vma_iter_init(&vmi, mm, start);
>  	prev = vma_prev(&vmi);
>  	for_each_vma_range(vmi, vma, end) {
> +		vma_start_write(vma);
>  		err = mbind_range(&vmi, vma, &prev, start, end, new);
>  		if (err)
>  			break;

Suren, can you take a look at this?  The VMA should be locked by the
call to queue_pages_range(), but by the time we get to here, the VMA
isn't locked.  I don't see anywhere that we cycle the mmap_lock (which
would unlock the VMA), but I could have missed something.  The two
VMA walks should walk over the same set of VMAs.  Certainly the VMA
being dumped should have been locked by the pagewalk:

 vma ffff888077381a00 start 0000000020c2a000 end 0000000021000000 mm ffff8880258a8980
 prot 25 anon_vma 0000000000000000 vm_ops 0000000000000000
 pgoff 20c2a file 0000000000000000 private_data 0000000000000000
 flags: 0x8100077(read|write|exec|mayread|maywrite|mayexec|account|softdirty)

  syscall(__NR_mbind, /*addr=*/0x20400000ul, /*len=*/0xc00000ul, /*mode=*/4ul,
          /*nodemask=*/0ul, /*maxnode=*/0ul, /*flags=*/3ul);

20400000 + c00000 should overlap 20c2a000-21000000

  parent reply	other threads:[~2023-09-12 14:55 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-06  1:03 [syzbot] [mm?] kernel BUG in vma_replace_policy syzbot
2023-09-06  6:19 ` [PATCH] mm: as the same logic with queue_pages_range Edward AD
2023-09-06 12:06   ` Matthew Wilcox
2023-09-12  5:20   ` kernel test robot
2023-09-12  5:20     ` [LTP] " kernel test robot
2023-09-13  9:10     ` Cyril Hrubis
2023-09-13  9:10       ` Cyril Hrubis
2023-09-14  5:53     ` [PATCH] mm: extpand queue_pages_range() to find and lock the vma range Edward AD
2023-09-14  5:53       ` [LTP] " Edward AD
2023-09-08 18:04 ` [syzbot] [mm?] kernel BUG in vma_replace_policy syzbot
2023-09-08 18:04   ` syzbot
2023-09-08 18:04   ` syzbot
2023-09-12  5:30 ` Matthew Wilcox
2023-09-12  6:09   ` syzbot
2023-09-12 14:55   ` Matthew Wilcox [this message]
2023-09-12 15:03     ` Suren Baghdasaryan
2023-09-12 16:00       ` Suren Baghdasaryan
2023-09-13 16:05         ` Suren Baghdasaryan
2023-09-13 16:46           ` Suren Baghdasaryan
2023-09-14 18:20             ` Suren Baghdasaryan
2023-09-14 19:09               ` Matthew Wilcox
2023-09-14 20:00                 ` Suren Baghdasaryan
2023-09-14 20:53                   ` Suren Baghdasaryan
2023-09-14 21:24                     ` Matthew Wilcox
2023-09-14 22:21                       ` Suren Baghdasaryan
2023-09-15  4:26                         ` Hugh Dickins
2023-09-15 16:09                           ` Suren Baghdasaryan
2023-09-15 18:05                             ` Suren Baghdasaryan
2023-09-16  2:43                               ` Hugh Dickins
2023-09-18 21:20                                 ` Suren Baghdasaryan
2023-09-15 18:26                           ` Matthew Wilcox
2023-09-16  2:54                             ` Hugh Dickins
2023-09-16  1:35                           ` Yang Shi
2023-09-16  3:57                             ` Hugh Dickins
2023-09-18 22:34                               ` Yang Shi
2023-09-19  0:34                                 ` Hugh Dickins
     [not found] <20230909034207.5816-1-hdanton@sina.com>
2023-09-09  4:43 ` syzbot

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=ZQB76G/6NxVgoE9u@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=surenb@google.com \
    --cc=syzbot+b591856e0f0139f83023@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.