All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: syzbot <syzbot+981b8efffb3d71c46bef@syzkaller.appspotmail.com>
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org, muchun.song@linux.dev,
	roman.gushchin@linux.dev, syzkaller-bugs@googlegroups.com,
	zhengqi.arch@bytedance.com
Subject: Re: [syzbot] [mm?] UBSAN: shift-out-of-bounds in do_shrink_slab
Date: Mon, 3 Jun 2024 10:51:51 +1000	[thread overview]
Message-ID: <Zl0Tp/1PYaIAgJJz@dread.disaster.area> (raw)
In-Reply-To: <0000000000003051770619cec4f8@google.com>

On Sat, Jun 01, 2024 at 12:08:25AM -0700, syzbot wrote:
> Hello,
> 
> syzbot found the following issue on:
> 
> HEAD commit:    6dc544b66971 Add linux-next specific files for 20240528
> git tree:       linux-next
> console output: https://syzkaller.appspot.com/x/log.txt?x=14c7f806980000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=6a363b35598e573d
> dashboard link: https://syzkaller.appspot.com/bug?extid=981b8efffb3d71c46bef
> compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
> 
> Unfortunately, I don't have any reproducer for this issue yet.
> 
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/334699ab67f8/disk-6dc544b6.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/4ca32b2218ce/vmlinux-6dc544b6.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/400bc5f019b3/bzImage-6dc544b6.xz
> 
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+981b8efffb3d71c46bef@syzkaller.appspotmail.com
> 
> ------------[ cut here ]------------
> UBSAN: shift-out-of-bounds in mm/shrinker.c:406:18
> shift exponent -1 is negative
> CPU: 0 PID: 5278 Comm: syz-executor.1 Not tainted 6.10.0-rc1-next-20240528-syzkaller #0
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024
> Call Trace:
>  <TASK>
>  __dump_stack lib/dump_stack.c:88 [inline]
>  dump_stack_lvl+0x241/0x360 lib/dump_stack.c:114
>  ubsan_epilogue lib/ubsan.c:231 [inline]
>  __ubsan_handle_shift_out_of_bounds+0x3c8/0x420 lib/ubsan.c:468
>  do_shrink_slab+0xe26/0x1160 mm/shrinker.c:406

	total_scan = nr >> priority;

Ok, that means the shrinker has been passed a priority of -1 from
the core memory reclaim code. That means it is more likely that
something has gone wrong with the higher level struct scan_control
sc->priority handling, not something in teh shrinker code itself.

>  shrink_slab_memcg mm/shrinker.c:548 [inline]
>  shrink_slab+0x87c/0x14d0 mm/shrinker.c:626
>  shrink_node_memcgs mm/vmscan.c:5923 [inline]
>  shrink_node+0xb82/0x4150 mm/vmscan.c:5961
>  shrink_zones mm/vmscan.c:6205 [inline]
>  do_try_to_free_pages+0x789/0x1cb0 mm/vmscan.c:6267

This has a loop that does:

	do {
	.....
		shrink_zones(zonelist, sc);
	.....
	} while (--sc->priority >= 0);

and all the callers initialise sc->priority to DEF_PRIORITY.  Hence
I can't see how we get shrink_zones() gets called with sc->priority
== -1 from here or anywhere else that decrements sc->priority. This
needs someone with more core mm reclaim expertise than I have to
triage this further.

-Dave.
-- 
Dave Chinner
david@fromorbit.com

  reply	other threads:[~2024-06-03  0:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-01  7:08 [syzbot] [mm?] UBSAN: shift-out-of-bounds in do_shrink_slab syzbot
2024-06-03  0:51 ` Dave Chinner [this message]
2024-06-03  3:25 ` Qi Zheng
2024-06-03 19:22   ` Roman Gushchin

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=Zl0Tp/1PYaIAgJJz@dread.disaster.area \
    --to=david@fromorbit.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=muchun.song@linux.dev \
    --cc=roman.gushchin@linux.dev \
    --cc=syzbot+981b8efffb3d71c46bef@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=zhengqi.arch@bytedance.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.