syzbot


KASAN: stack-out-of-bounds Write in mpol_to_str

Status: fixed on 2020/05/10 10:42
Subsystems: mm
[Documentation on labels]
Reported-by: syzbot+b055b1a6b2b958707a21@syzkaller.appspotmail.com
Fix commit: aa9f7d5172fa mm: mempolicy: require at least one nodeid for MPOL_PREFERRED
First crash: 1348d, last: 1344d
Cause bisection: introduced by (bisect log) [merge commit]:
commit e786741ff1b52769b044b7f4407f39cd13ee5d2d
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date: Thu Jul 11 22:36:02 2019 +0000

  Merge tag 'staging-5.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging

Crash: general protection fault in send_hsr_supervision_frame (log)
Repro: C syz .config
  
Duplicate bugs (1)
duplicates (1):
Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
kernel panic: stack is corrupted in mpol_to_str mm C done 11 1340d 1348d 0/25 closed as dup on 2020/03/26 11:21
Discussions (7)
Title Replies (including bot) Last reply
[PATCH 4.19 00/54] 4.19.115-rc1 review 70 (70) 2020/05/27 20:33
[PATCH 3.16 000/245] 3.16.83-rc1 review 260 (260) 2020/04/24 17:54
[PATCH 4.4 00/29] 4.4.219-rc1 review 35 (35) 2020/04/14 10:57
[PATCH 4.14 00/38] 4.14.176-rc1 review 44 (44) 2020/04/14 10:36
[PATCH 4.9 00/32] 4.9.219-rc1 review 36 (36) 2020/04/14 10:35
[patch 137/155] mm: mempolicy: require at least one nodeid for MPOL_PREFERRED 1 (1) 2020/04/02 04:10
KASAN: stack-out-of-bounds Write in mpol_to_str 1 (2) 2020/03/26 03:47
Last patch testing requests (1)
Created Duration User Patch Repo Result
2020/03/26 10:36 17m penguin-kernel@i-love.sakura.ne.jp patch upstream OK

Sample crash report:
==================================================================
BUG: KASAN: stack-out-of-bounds in set_bit include/asm-generic/bitops/instrumented-atomic.h:28 [inline]
BUG: KASAN: stack-out-of-bounds in __node_set include/linux/nodemask.h:130 [inline]
BUG: KASAN: stack-out-of-bounds in mpol_to_str+0x377/0x3be mm/mempolicy.c:2962
Write of size 8 at addr ffffc90000c7fb60 by task systemd/1

CPU: 0 PID: 1 Comm: systemd Not tainted 5.6.0-rc7-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x188/0x20d lib/dump_stack.c:118
 print_address_description.constprop.0.cold+0x5/0x315 mm/kasan/report.c:374
 __kasan_report.cold+0x1a/0x32 mm/kasan/report.c:506
 kasan_report+0xe/0x20 mm/kasan/common.c:641
 check_memory_region_inline mm/kasan/generic.c:185 [inline]
 check_memory_region+0x128/0x190 mm/kasan/generic.c:192
 set_bit include/asm-generic/bitops/instrumented-atomic.h:28 [inline]
 __node_set include/linux/nodemask.h:130 [inline]
 mpol_to_str+0x377/0x3be mm/mempolicy.c:2962
 shmem_show_mpol mm/shmem.c:1406 [inline]
 shmem_show_options+0x418/0x630 mm/shmem.c:3609
 show_mountinfo+0x616/0x900 fs/proc_namespace.c:187
 seq_read+0xad0/0x1160 fs/seq_file.c:268
 __vfs_read+0x76/0x100 fs/read_write.c:425
 vfs_read+0x1ea/0x430 fs/read_write.c:461
 ksys_read+0x127/0x250 fs/read_write.c:587
 do_syscall_64+0xf6/0x7d0 arch/x86/entry/common.c:294
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x7f17892db92d
Code: 2d 2c 00 00 75 10 b8 00 00 00 00 0f 05 48 3d 01 f0 ff ff 73 31 c3 48 83 ec 08 e8 de 9b 01 00 48 89 04 24 b8 00 00 00 00 0f 05 <48> 8b 3c 24 48 89 c2 e8 27 9c 01 00 48 89 d0 48 83 c4 08 48 3d 01
RSP: 002b:00007ffc058b86b0 EFLAGS: 00000293 ORIG_RAX: 0000000000000000
RAX: ffffffffffffffda RBX: 0000556657fec630 RCX: 00007f17892db92d
RDX: 0000000000000400 RSI: 0000556657fec860 RDI: 000000000000002c
RBP: 0000000000000d68 R08: 00007f178ad11500 R09: 00000000000000e0
R10: 0000556657fecc47 R11: 0000000000000293 R12: 00007f1789596440
R13: 00007f1789595900 R14: 0000000000000019 R15: 0000000000000000


addr ffffc90000c7fb60 is located in stack of task systemd/1 at offset 40 in frame:
 mpol_to_str+0x0/0x3be mm/mempolicy.c:2924

this frame has 1 object:
 [32, 40) 'nodes'

Memory state around the buggy address:
 ffffc90000c7fa00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffffc90000c7fa80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffffc90000c7fb00: 00 00 00 00 00 00 00 f1 f1 f1 f1 00 f3 f3 f3 00
                                                       ^
 ffffc90000c7fb80: 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1 00 00
 ffffc90000c7fc00: 00 00 00 00 00 00 f3 f3 f3 f3 00 00 00 00 00 00
==================================================================

Crashes (23):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/03/25 20:37 upstream e2cf67f6689a 41f049cc .config console log report syz C ci-upstream-kasan-gce-root
2020/03/25 20:29 upstream e2cf67f6689a 41f049cc .config console log report syz C ci-upstream-kasan-gce-selinux-root
2020/03/29 22:02 upstream e595dd94515e 05736b29 .config console log report ci-upstream-kasan-gce-selinux-root
2020/03/29 21:52 upstream e595dd94515e 05736b29 .config console log report ci-upstream-kasan-gce-root
2020/03/28 19:47 upstream 69c5eea3128e f1ebdfba .config console log report ci-upstream-kasan-gce-selinux-root
2020/03/28 19:38 upstream 69c5eea3128e f1ebdfba .config console log report ci-upstream-kasan-gce-root
2020/03/28 19:19 upstream 69c5eea3128e f1ebdfba .config console log report ci-upstream-kasan-gce-root
2020/03/28 19:19 upstream 69c5eea3128e f1ebdfba .config console log report ci-upstream-kasan-gce-root
2020/03/28 19:16 upstream 69c5eea3128e f1ebdfba .config console log report ci-upstream-kasan-gce-selinux-root
2020/03/27 01:41 upstream 9420e8ade435 6d25c5a0 .config console log report ci-upstream-kasan-gce-root
2020/03/27 01:40 upstream 9420e8ade435 6d25c5a0 .config console log report ci-upstream-kasan-gce-root
2020/03/27 01:36 upstream 9420e8ade435 6d25c5a0 .config console log report ci-upstream-kasan-gce-selinux-root
2020/03/27 01:35 upstream 9420e8ade435 6d25c5a0 .config console log report ci-upstream-kasan-gce-selinux-root
2020/03/26 12:01 upstream 1b649e0bcae7 e8e6c7d2 .config console log report ci-upstream-kasan-gce-root
2020/03/26 11:58 upstream 1b649e0bcae7 e8e6c7d2 .config console log report ci-upstream-kasan-gce-selinux-root
2020/03/26 11:42 upstream 1b649e0bcae7 e8e6c7d2 .config console log report ci-upstream-kasan-gce-root
2020/03/26 11:41 upstream 1b649e0bcae7 e8e6c7d2 .config console log report ci-upstream-kasan-gce-root
2020/03/26 11:37 upstream 1b649e0bcae7 e8e6c7d2 .config console log report ci-upstream-kasan-gce-selinux-root
2020/03/26 11:37 upstream 1b649e0bcae7 e8e6c7d2 .config console log report ci-upstream-kasan-gce-selinux-root
2020/03/26 08:14 upstream 1b649e0bcae7 e8e6c7d2 .config console log report ci-upstream-kasan-gce-selinux-root
2020/03/25 22:47 upstream e2cf67f6689a 41f049cc .config console log report ci-upstream-kasan-gce-root
2020/03/25 18:49 upstream e2cf67f6689a 41f049cc .config console log report ci-upstream-kasan-gce-selinux-root
2020/03/25 18:47 upstream e2cf67f6689a 41f049cc .config console log report ci-upstream-kasan-gce-root
* Struck through repros no longer work on HEAD.