All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <edumazet@google.com>
To: Dongliang Mu <mudongliangabcd@gmail.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	linux-mm <linux-mm@kvack.org>,
	syzbot <syzkaller@googlegroups.com>,
	"Huang, Ying" <ying.huang@intel.com>,
	Mel Gorman <mgorman@suse.de>
Subject: Re: [PATCH] mm/mempolicy: do not allow illegal MPOL_F_NUMA_BALANCING | MPOL_LOCAL in mbind()
Date: Fri, 8 Oct 2021 09:20:43 -0700	[thread overview]
Message-ID: <CANn89iL2qqVNFVUjSOnq52Aw+k5=Hcv1dSO-PSjgGKt0yxB0FQ@mail.gmail.com> (raw)
In-Reply-To: <CAD-N9QVtBrWrtAFQkyd=zRwnA4AjnBBeqhD_P-QFXz-QtUOzog@mail.gmail.com>

On Thu, Oct 7, 2021 at 10:26 PM Dongliang Mu <mudongliangabcd@gmail.com> wrote:
>
> On Sat, Oct 2, 2021 at 1:49 AM Eric Dumazet <eric.dumazet@gmail.com> wrote:
> >
> > From: Eric Dumazet <edumazet@google.com>
> >
> > syzbot reported access to unitialized memory in mbind() [1]
> >
> > Issue came with commit bda420b98505 ("numa balancing: migrate on
> > fault among multiple bound nodes")
> >
> > This commit added a new bit in MPOL_MODE_FLAGS, but only checked
> > valid combination (MPOL_F_NUMA_BALANCING can only be used with MPOL_BIND)
> > in do_set_mempolicy()
> >
> > This patch moves the check in sanitize_mpol_flags() so that it
> > is also used by mbind()
> >
> > [1]
> > BUG: KMSAN: uninit-value in __mpol_equal+0x567/0x590 mm/mempolicy.c:2260
> >  __mpol_equal+0x567/0x590 mm/mempolicy.c:2260
> >  mpol_equal include/linux/mempolicy.h:105 [inline]
> >  vma_merge+0x4a1/0x1e60 mm/mmap.c:1190
> >  mbind_range+0xcc8/0x1e80 mm/mempolicy.c:811
> >  do_mbind+0xf42/0x15f0 mm/mempolicy.c:1333
> >  kernel_mbind mm/mempolicy.c:1483 [inline]
> >  __do_sys_mbind mm/mempolicy.c:1490 [inline]
> >  __se_sys_mbind+0x437/0xb80 mm/mempolicy.c:1486
> >  __x64_sys_mbind+0x19d/0x200 mm/mempolicy.c:1486
> >  do_syscall_x64 arch/x86/entry/common.c:51 [inline]
> >  do_syscall_64+0x54/0xd0 arch/x86/entry/common.c:82
> >  entry_SYSCALL_64_after_hwframe+0x44/0xae
> >
> > Uninit was created at:
> >  slab_alloc_node mm/slub.c:3221 [inline]
> >  slab_alloc mm/slub.c:3230 [inline]
> >  kmem_cache_alloc+0x751/0xff0 mm/slub.c:3235
> >  mpol_new mm/mempolicy.c:293 [inline]
> >  do_mbind+0x912/0x15f0 mm/mempolicy.c:1289
> >  kernel_mbind mm/mempolicy.c:1483 [inline]
> >  __do_sys_mbind mm/mempolicy.c:1490 [inline]
> >  __se_sys_mbind+0x437/0xb80 mm/mempolicy.c:1486
> >  __x64_sys_mbind+0x19d/0x200 mm/mempolicy.c:1486
> >  do_syscall_x64 arch/x86/entry/common.c:51 [inline]
> >  do_syscall_64+0x54/0xd0 arch/x86/entry/common.c:82
> >  entry_SYSCALL_64_after_hwframe+0x44/0xae
> > =====================================================
> > Kernel panic - not syncing: panic_on_kmsan set ...
> > CPU: 0 PID: 15049 Comm: syz-executor.0 Tainted: G    B             5.15.0-rc2-syzkaller #0
> > Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
> > Call Trace:
> >  __dump_stack lib/dump_stack.c:88 [inline]
> >  dump_stack_lvl+0x1ff/0x28e lib/dump_stack.c:106
> >  dump_stack+0x25/0x28 lib/dump_stack.c:113
> >  panic+0x44f/0xdeb kernel/panic.c:232
> >  kmsan_report+0x2ee/0x300 mm/kmsan/report.c:186
> >  __msan_warning+0xd7/0x150 mm/kmsan/instrumentation.c:208
> >  __mpol_equal+0x567/0x590 mm/mempolicy.c:2260
> >  mpol_equal include/linux/mempolicy.h:105 [inline]
> >  vma_merge+0x4a1/0x1e60 mm/mmap.c:1190
> >  mbind_range+0xcc8/0x1e80 mm/mempolicy.c:811
> >  do_mbind+0xf42/0x15f0 mm/mempolicy.c:1333
> >  kernel_mbind mm/mempolicy.c:1483 [inline]
> >  __do_sys_mbind mm/mempolicy.c:1490 [inline]
> >  __se_sys_mbind+0x437/0xb80 mm/mempolicy.c:1486
> >  __x64_sys_mbind+0x19d/0x200 mm/mempolicy.c:1486
> >  do_syscall_x64 arch/x86/entry/common.c:51 [inline]
> >  do_syscall_64+0x54/0xd0 arch/x86/entry/common.c:82
> >  entry_SYSCALL_64_after_hwframe+0x44/0xae
> > RIP: 0033:0x7f4a41b2c709
> > Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48
> > RSP: 002b:00007f4a3f0a3188 EFLAGS: 00000246 ORIG_RAX: 00000000000000ed
> > RAX: ffffffffffffffda RBX: 00007f4a41c30f60 RCX: 00007f4a41b2c709
> > RDX: 0000000000002001 RSI: 0000000000c00007 RDI: 0000000020012000
> > RBP: 00007f4a41b86cb4 R08: 0000000000000000 R09: 0000010000000002
> > R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
> > R13: 00007f4a42164b2f R14: 00007f4a3f0a3300 R15: 0000000000022000
> >
>
> Hi Eric,
>
> this crash seems like the bug report [1] on Syzbot dashboard.
>
> [1] https://syzkaller.appspot.com/bug?id=028833194204bb15c2c43d822b8f7401360d57f5
>
> If yes, maybe you can push a patch testing request.
>

No, it was a different syzbot report, currently held in our queue.

(Andrew Morton has access to our internal bug, I CC him (b/201266830))

I can release it, at the expense of more noise to various mailing
lists, but really the bug is trivial.

  reply	other threads:[~2021-10-08 16:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-01 17:49 [PATCH] mm/mempolicy: do not allow illegal MPOL_F_NUMA_BALANCING | MPOL_LOCAL in mbind() Eric Dumazet
2021-10-01 20:24 ` kernel test robot
2021-10-01 20:24   ` kernel test robot
2021-10-01 21:52   ` Eric Dumazet
2021-10-01 21:52     ` Eric Dumazet
2021-10-01 21:52     ` Eric Dumazet
2021-10-08  5:25 ` Dongliang Mu
2021-10-08 16:20   ` Eric Dumazet [this message]
2021-10-11 10:22 ` Mel Gorman

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='CANn89iL2qqVNFVUjSOnq52Aw+k5=Hcv1dSO-PSjgGKt0yxB0FQ@mail.gmail.com' \
    --to=edumazet@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=eric.dumazet@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=mudongliangabcd@gmail.com \
    --cc=syzkaller@googlegroups.com \
    --cc=ying.huang@intel.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.