syzbot


KASAN: use-after-free Read in shrink_slab

Status: closed as invalid on 2018/07/19 10:27
Subsystems: mm
[Documentation on labels]
Reported-by: syzbot+6a3cf57dddcf4e4ea443@syzkaller.appspotmail.com
First crash: 2121d, last: 2111d
Discussions (1)
Title Replies (including bot) Last reply
KASAN: use-after-free Read in shrink_slab 1 (2) 2018/07/19 10:27

Sample crash report:
proc: unrecognized mount option "Ó" or missing value
EXT4-fs (loop2): ext4_check_descriptors: Block bitmap for group 0 overlaps superblock
EXT4-fs (loop2): group descriptors corrupted!
==================================================================
kasan: CONFIG_KASAN_INLINE enabled
BUG: KASAN: use-after-free in __read_once_size include/linux/compiler.h:188 [inline]
BUG: KASAN: use-after-free in list_empty include/linux/list.h:203 [inline]
BUG: KASAN: use-after-free in shrink_slab_memcg mm/vmscan.c:595 [inline]
BUG: KASAN: use-after-free in shrink_slab+0xa04/0xa60 mm/vmscan.c:671
Read of size 8 at addr ffff8801974de858 by task syz-executor3/4483

kasan: GPF could be caused by NULL-ptr deref or user memory access
CPU: 1 PID: 4483 Comm: syz-executor3 Not tainted 4.18.0-rc4-next-20180713+ #7
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+0x1c9/0x2b4 lib/dump_stack.c:113
general protection fault: 0000 [#1] SMP KASAN
CPU: 0 PID: 20961 Comm: syz-executor3 Not tainted 4.18.0-rc4-next-20180713+ #7
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:__read_once_size include/linux/compiler.h:188 [inline]
RIP: 0010:list_lru_from_memcg_idx mm/list_lru.c:56 [inline]
RIP: 0010:list_lru_count_one+0x156/0x460 mm/list_lru.c:201
Code: 
08 
 print_address_description+0x6c/0x20b mm/kasan/report.c:256
3c 
03 
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report.cold.7+0x242/0x30d mm/kasan/report.c:412
0f 
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:433
8e 
 __read_once_size include/linux/compiler.h:188 [inline]
 list_empty include/linux/list.h:203 [inline]
 shrink_slab_memcg mm/vmscan.c:595 [inline]
 shrink_slab+0xa04/0xa60 mm/vmscan.c:671
b5 
02 
00 
00 
4d 
63 
bd 
 shrink_node+0x429/0x16a0 mm/vmscan.c:2735
d8 
0a 
00 
00 
e8 
7f 
35 
d2 
ff 
 shrink_zones mm/vmscan.c:2964 [inline]
 do_try_to_free_pages+0x3e7/0x1290 mm/vmscan.c:3026
48 
8d 
7b 
 try_to_free_mem_cgroup_pages+0x49d/0xc90 mm/vmscan.c:3324
50 
48 
b8 
00 
00 
00 
00 
00 
fc 
 reclaim_high.constprop.73+0x137/0x1e0 mm/memcontrol.c:2060
ff 
df 
48 
 mem_cgroup_handle_over_high+0x8d/0x130 mm/memcontrol.c:2085
89 
 tracehook_notify_resume include/linux/tracehook.h:195 [inline]
 exit_to_usermode_loop+0x287/0x380 arch/x86/entry/common.c:166
fa 
48 
 prepare_exit_to_usermode arch/x86/entry/common.c:197 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:268 [inline]
 do_syscall_64+0x6be/0x820 arch/x86/entry/common.c:293
c1 
ea 
03 
<80> 
3c 
02 
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
00 
RIP: 0033:0x45416a
0f 
Code: 
85 
f7 
d8 
d8 
02 
64 
00 
89 
00 
04 
49 
25 
8d 
d4 
46 
02 
c0 
00 
4c 
00 
8b 
64 
6b 
4c 
50 
8b 
48 
0c 
ba 
25 
00 
10 
00 
00 
00 
RSP: 0018:ffff88019c68f1e0 EFLAGS: 00010206
00 
31 
RAX: dffffc0000000000 RBX: 0000000000000000 RCX: ffffffff81aa3a64
d2 
RDX: 000000000000000a RSI: ffffffff81aa3ad1 RDI: 0000000000000050
4d 
RBP: ffff88019c68f270 R08: ffff8801cdb76740 R09: 0000000000000000
8d 
R10: ffffed00399f1488 R11: ffff8801ccf8a447 R12: 1ffff100338d1e3d
91 
R13: ffff8801982a8540 R14: ffff88019c68f248 R15: 0000000000000007
d0 
FS:  000000000261c940(0000) GS:ffff8801dae00000(0000) knlGS:0000000000000000
02 
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
00 
CR2: 000000000261cc10 CR3: 000000018d615000 CR4: 00000000001406f0
00 
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
31 
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
f6 
Call Trace:
bf 
11 
 list_lru_shrink_count include/linux/list_lru.h:122 [inline]
 super_cache_count+0x153/0x2e0 fs/super.c:146
00 
 do_shrink_slab+0x148/0xc50 mm/vmscan.c:458
20 
01 
b8 
38 
00 
00 
00 
0f 
 shrink_slab_memcg mm/vmscan.c:598 [inline]
 shrink_slab+0x861/0xa60 mm/vmscan.c:671
05 
<48> 
3d 
00 
f0 
ff 
 shrink_node+0x429/0x16a0 mm/vmscan.c:2735
ff 
0f 
87 
f5 
00 
00 
 shrink_zones mm/vmscan.c:2964 [inline]
 do_try_to_free_pages+0x3e7/0x1290 mm/vmscan.c:3026
00 
85 
c0 
41 
 try_to_free_mem_cgroup_pages+0x49d/0xc90 mm/vmscan.c:3324
89 
c5 
0f 
85 
fc 
00 
00 
 reclaim_high.constprop.73+0x137/0x1e0 mm/memcontrol.c:2060
RSP: 002b:00007fff42595e10 EFLAGS: 00000246
 ORIG_RAX: 0000000000000038
RAX: 0000000000000545 RBX: 00007fff42595e10 RCX: 000000000045416a
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000001200011
 mem_cgroup_handle_over_high+0x8d/0x130 mm/memcontrol.c:2085
RBP: 00007fff42595e50 R08: 0000000000000001 R09: 000000000261c940
 tracehook_notify_resume include/linux/tracehook.h:195 [inline]
 exit_to_usermode_loop+0x287/0x380 arch/x86/entry/common.c:166
R10: 000000000261cc10 R11: 0000000000000246 R12: 0000000000000001
R13: 0000000000000000 R14: 0000000000000000 R15: 00000000007034c0

 prepare_exit_to_usermode arch/x86/entry/common.c:197 [inline]
 syscall_return_slowpath+0x533/0x5e0 arch/x86/entry/common.c:268
Allocated by task 20871:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 kasan_kmalloc+0xc4/0xe0 mm/kasan/kasan.c:553
 ret_from_fork+0x15/0x50 arch/x86/entry/entry_64.S:407
 kmem_cache_alloc_trace+0x152/0x780 mm/slab.c:3620
RIP: 0033:0x45416a
 kmalloc include/linux/slab.h:513 [inline]
 kzalloc include/linux/slab.h:707 [inline]
 alloc_super+0xd4/0xb10 fs/super.c:199
Code: 
 sget_fc+0x269/0x950 fs/super.c:533
Bad RIP value.
 vfs_get_super+0x6e/0x270 fs/super.c:1255
RSP: 002b:00007fff42595e10 EFLAGS: 00000246
 proc_get_tree+0x88/0xb0 fs/proc/root.c:159
 ORIG_RAX: 0000000000000038
 vfs_get_tree+0x1cb/0x5c0 fs/super.c:1743
RAX: 0000000000000000 RBX: 00007fff42595e10 RCX: 000000000045416a
 do_new_mount fs/namespace.c:2567 [inline]
 do_mount+0x6c1/0x1fb0 fs/namespace.c:2889
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000001200011
 ksys_mount+0x12d/0x140 fs/namespace.c:3105
RBP: 00007fff42595e50 R08: 0000000000000001 R09: 000000000261c940
 __do_sys_mount fs/namespace.c:3119 [inline]
 __se_sys_mount fs/namespace.c:3116 [inline]
 __x64_sys_mount+0xbe/0x150 fs/namespace.c:3116
R10: 000000000261cc10 R11: 0000000000000246 R12: 0000000000000001
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
R13: 0000000000000000 R14: 0000000000000000 R15: 00000000007034c0
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
Modules linked in:

Freed by task 40:
Dumping ftrace buffer:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
   (ftrace buffer empty)
 set_track mm/kasan/kasan.c:460 [inline]
 __kasan_slab_free+0x11a/0x170 mm/kasan/kasan.c:521
---[ end trace 95f748ed38c11134 ]---
 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
 __cache_free mm/slab.c:3498 [inline]
 kfree+0xd9/0x260 mm/slab.c:3813
 destroy_super_work+0x40/0x50 fs/super.c:164
RIP: 0010:__read_once_size include/linux/compiler.h:188 [inline]
RIP: 0010:list_lru_from_memcg_idx mm/list_lru.c:56 [inline]
RIP: 0010:list_lru_count_one+0x156/0x460 mm/list_lru.c:201
 process_one_work+0xc73/0x1ba0 kernel/workqueue.c:2153
 worker_thread+0x189/0x13c0 kernel/workqueue.c:2296
 kthread+0x345/0x410 kernel/kthread.c:246
Code: 
 ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:415

The buggy address belongs to the object at ffff8801974de100
 which belongs to the cache kmalloc-4096 of size 4096
The buggy address is located 1880 bytes inside of
 4096-byte region [ffff8801974de100, ffff8801974df100)
08 
The buggy address belongs to the page:
page:ffffea00065d3780 count:1 mapcount:0 mapping:ffff8801da800dc0 index:0x0 compound_mapcount: 0
3c 
flags: 0x2fffc0000008100(slab|head)
raw: 02fffc0000008100 ffffea0006366188 ffffea000654e008 ffff8801da800dc0
03 
raw: 0000000000000000 ffff8801974de100 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

0f 
Memory state around the buggy address:
 ffff8801974de700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801974de780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
8e 
>ffff8801974de800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                    ^
 ffff8801974de880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
b5 
 ffff8801974de900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (400):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/07/16 07:01 linux-next 483d835c8189 92a49505 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/07/16 05:41 linux-next 483d835c8189 92a49505 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/07/16 04:40 linux-next 483d835c8189 92a49505 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/07/16 03:40 linux-next 483d835c8189 92a49505 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/07/16 02:39 linux-next 483d835c8189 92a49505 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/07/16 02:16 linux-next 483d835c8189 92a49505 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/07/16 01:04 linux-next 483d835c8189 92a49505 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/07/16 00:02 linux-next 483d835c8189 92a49505 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/07/15 22:25 linux-next 483d835c8189 92a49505 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/07/15 22:10 linux-next 483d835c8189 92a49505 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/07/15 21:06 linux-next 483d835c8189 92a49505 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/07/15 20:54 linux-next 483d835c8189 92a49505 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/07/15 19:49 linux-next 483d835c8189 92a49505 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/07/15 18:44 linux-next 483d835c8189 92a49505 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/07/15 18:16 linux-next 483d835c8189 92a49505 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/07/15 17:15 linux-next 483d835c8189 92a49505 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/07/15 15:57 linux-next 483d835c8189 92a49505 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/07/15 14:31 linux-next 483d835c8189 92a49505 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/07/15 14:16 linux-next 483d835c8189 92a49505 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/07/15 12:58 linux-next 483d835c8189 92a49505 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/07/15 11:58 linux-next 483d835c8189 92a49505 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/07/15 10:56 linux-next 483d835c8189 92a49505 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/07/15 10:30 linux-next 483d835c8189 92a49505 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/07/15 09:29 linux-next 483d835c8189 92a49505 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/07/15 08:14 linux-next 483d835c8189 92a49505 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/07/15 06:49 linux-next 483d835c8189 92a49505 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/07/15 06:38 linux-next 483d835c8189 92a49505 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/07/15 05:27 linux-next 483d835c8189 92a49505 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/07/15 04:15 linux-next 483d835c8189 92a49505 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/07/15 03:15 linux-next 483d835c8189 92a49505 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/07/15 02:36 linux-next 483d835c8189 92a49505 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/07/15 01:30 linux-next 483d835c8189 92a49505 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/07/14 23:59 linux-next 483d835c8189 92a49505 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/07/14 23:09 linux-next 483d835c8189 92a49505 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/07/14 22:06 linux-next 483d835c8189 92a49505 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/07/14 21:04 linux-next 483d835c8189 92a49505 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/07/14 20:03 linux-next 483d835c8189 92a49505 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/07/14 18:58 linux-next 483d835c8189 92a49505 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/07/14 18:50 linux-next 483d835c8189 92a49505 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/07/14 17:13 linux-next 483d835c8189 92a49505 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/07/14 16:06 linux-next 483d835c8189 92a49505 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/07/14 14:50 linux-next 483d835c8189 92a49505 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/07/14 14:13 linux-next 483d835c8189 92a49505 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/07/14 13:12 linux-next 483d835c8189 92a49505 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/07/06 17:14 linux-next 526674536360 9636bc93 .config console log report ci-upstream-linux-next-kasan-gce-root
* Struck through repros no longer work on HEAD.