syzbot


KMSAN: uninit-value in mpol_rebind_mm

Status: fixed on 2019/03/28 12:00
Subsystems: mm
[Documentation on labels]
Reported-by: syzbot+b19c2dc2c990ea657a71@syzkaller.appspotmail.com
Fix commit: 2e25644e8da4 mm, mempolicy: fix uninit memory access
First crash: 1974d, last: 1885d
Discussions (10)
Title Replies (including bot) Last reply
[PATCH 4.19 000/187] 4.19.34-stable review 196 (196) 2019/05/23 17:47
[PATCH 5.0 000/246] 5.0.7-stable review 264 (264) 2019/04/18 04:46
[PATCH 4.14 000/121] 4.14.111-stable review 127 (127) 2019/04/05 18:30
[PATCH AUTOSEL 5.0 001/262] CIFS: fix POSIX lock leak and invalid ptr deref 284 (284) 2019/04/04 13:22
[PATCH AUTOSEL 4.14 001/123] CIFS: fix POSIX lock leak and invalid ptr deref 123 (123) 2019/03/27 18:16
[PATCH AUTOSEL 4.19 001/192] CIFS: fix POSIX lock leak and invalid ptr deref 192 (192) 2019/03/27 18:10
[PATCH 5.0 00/52] 5.0.5-stable review 61 (61) 2019/03/27 05:06
[PATCH 4.19 00/45] 4.19.32-stable review 51 (51) 2019/03/27 04:04
[PATCH 4.14 00/41] 4.14.109-stable review 47 (47) 2019/03/26 23:15
KMSAN: uninit-value in mpol_rebind_mm 8 (9) 2019/01/15 10:06
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KMSAN: uninit-value in mpol_rebind_mm (2) mm C 11 708d 832d 22/26 fixed on 2023/02/24 13:51

Sample crash report:
==================================================================
BUG: KMSAN: uninit-value in mpol_rebind_policy mm/mempolicy.c:353 [inline]
BUG: KMSAN: uninit-value in mpol_rebind_mm+0x249/0x370 mm/mempolicy.c:384
CPU: 1 PID: 12562 Comm: syz-executor.2 Not tainted 5.0.0+ #17
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+0x173/0x1d0 lib/dump_stack.c:113
 kmsan_report+0x131/0x2a0 mm/kmsan/kmsan.c:624
 __msan_warning+0x7a/0xf0 mm/kmsan/kmsan_instr.c:310
 mpol_rebind_policy mm/mempolicy.c:353 [inline]
 mpol_rebind_mm+0x249/0x370 mm/mempolicy.c:384
 cpuset_attach+0xc50/0x12c0 kernel/cgroup/cpuset.c:2170
 cgroup_migrate_execute+0xbbd/0x1b00 kernel/cgroup/cgroup.c:2378
 cgroup_migrate kernel/cgroup/cgroup.c:2637 [inline]
 cgroup_attach_task+0x642/0x10d0 kernel/cgroup/cgroup.c:2674
 __cgroup1_procs_write+0x53b/0x670 kernel/cgroup/cgroup-v1.c:553
 cgroup1_procs_write+0x9b/0xb0 kernel/cgroup/cgroup-v1.c:566
 cgroup_file_write+0x44a/0x8e0 kernel/cgroup/cgroup.c:3507
 kernfs_fop_write+0x569/0x840 fs/kernfs/file.c:316
 __vfs_write+0x1e2/0xc20 fs/read_write.c:485
 vfs_write+0x481/0x920 fs/read_write.c:549
 ksys_write fs/read_write.c:598 [inline]
 __do_sys_write fs/read_write.c:610 [inline]
 __se_sys_write+0x17a/0x370 fs/read_write.c:607
 __x64_sys_write+0x4a/0x70 fs/read_write.c:607
 do_syscall_64+0xbc/0xf0 arch/x86/entry/common.c:291
 entry_SYSCALL_64_after_hwframe+0x63/0xe7
RIP: 0033:0x458209
Code: ad b8 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 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 0f 83 7b b8 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f42db515c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000458209
RDX: 0000000000000006 RSI: 0000000020000240 RDI: 0000000000000004
RBP: 000000000073bf00 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f42db5166d4
R13: 00000000004c761d R14: 00000000004dd210 R15: 00000000ffffffff

Uninit was stored to memory at:
 kmsan_save_stack_with_flags mm/kmsan/kmsan.c:205 [inline]
 kmsan_save_stack mm/kmsan/kmsan.c:220 [inline]
 kmsan_internal_chain_origin+0x134/0x230 mm/kmsan/kmsan.c:426
 kmsan_memcpy_memmove_metadata+0xb5b/0xfe0 mm/kmsan/kmsan.c:304
 kmsan_memcpy_metadata+0xb/0x10 mm/kmsan/kmsan.c:324
 __msan_memcpy+0x58/0x70 mm/kmsan/kmsan_instr.c:139
 __mpol_dup+0x146/0x470 mm/mempolicy.c:2149
 mpol_dup include/linux/mempolicy.h:91 [inline]
 vma_replace_policy mm/mempolicy.c:656 [inline]
 mbind_range mm/mempolicy.c:728 [inline]
 do_mbind mm/mempolicy.c:1223 [inline]
 kernel_mbind+0x254c/0x31a0 mm/mempolicy.c:1347
 __do_sys_mbind mm/mempolicy.c:1354 [inline]
 __se_sys_mbind+0x11c/0x130 mm/mempolicy.c:1350
 __x64_sys_mbind+0x6e/0x90 mm/mempolicy.c:1350
 do_syscall_64+0xbc/0xf0 arch/x86/entry/common.c:291
 entry_SYSCALL_64_after_hwframe+0x63/0xe7

Uninit was created at:
 kmsan_save_stack_with_flags mm/kmsan/kmsan.c:205 [inline]
 kmsan_internal_poison_shadow+0x92/0x150 mm/kmsan/kmsan.c:159
 kmsan_kmalloc+0xa6/0x130 mm/kmsan/kmsan_hooks.c:173
 kmem_cache_alloc+0x585/0xb60 mm/slub.c:2791
 mpol_new mm/mempolicy.c:276 [inline]
 do_mbind mm/mempolicy.c:1180 [inline]
 kernel_mbind+0x8a7/0x31a0 mm/mempolicy.c:1347
 __do_sys_mbind mm/mempolicy.c:1354 [inline]
 __se_sys_mbind+0x11c/0x130 mm/mempolicy.c:1350
 __x64_sys_mbind+0x6e/0x90 mm/mempolicy.c:1350
 do_syscall_64+0xbc/0xf0 arch/x86/entry/common.c:291
 entry_SYSCALL_64_after_hwframe+0x63/0xe7
==================================================================

Crashes (6):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/03/26 01:24 https://github.com/google/kmsan.git master 3c26d882e695 55684ce1 .config console log report ci-upstream-kmsan-gce
2019/03/24 11:14 https://github.com/google/kmsan.git master c10a026b8dee acbc5b7d .config console log report ci-upstream-kmsan-gce
2019/03/09 16:40 https://github.com/google/kmsan.git master a695dc5e929e 12365b99 .config console log report ci-upstream-kmsan-gce
2019/03/05 15:35 https://github.com/google/kmsan.git master 6c55aa96dcda bb91cf81 .config console log report ci-upstream-kmsan-gce
2019/01/08 01:04 https://github.com/google/kmsan.git master 48128c3ca084 69d69aa9 .config console log report ci-upstream-kmsan-gce
2018/12/26 23:29 https://github.com/google/kmsan.git master 79fc24ff6184 e747ec98 .config console log report ci-upstream-kmsan-gce
* Struck through repros no longer work on HEAD.