syzbot


KASAN: use-after-free Read in register_shrinker_prepared

Status: closed as invalid on 2019/08/23 00:04
Reported-by: syzbot+b8b2e599b6176efeaf51@syzkaller.appspotmail.com
First crash: 1337d, last: 1332d
similar bugs (1):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in register_shrinker_prepared (2) C done 1145 89d 127d 23/24 upstream: reported C repro on 2022/09/27 10:52

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in __list_add_valid+0x9a/0xa0 lib/list_debug.c:26
Read of size 8 at addr ffff8880a33a30e8 by task syz-executor.5/13084

CPU: 1 PID: 13084 Comm: syz-executor.5 Not tainted 5.2.0-rc3-next-20190607 #11
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+0x172/0x1f0 lib/dump_stack.c:113
 print_address_description.cold+0xd4/0x306 mm/kasan/report.c:351
 __kasan_report.cold+0x1b/0x36 mm/kasan/report.c:482
 kasan_report+0x12/0x20 mm/kasan/common.c:614
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/generic_report.c:132
 __list_add_valid+0x9a/0xa0 lib/list_debug.c:26
 __list_add include/linux/list.h:60 [inline]
 list_add_tail include/linux/list.h:93 [inline]
 register_shrinker_prepared+0x3d/0x190 mm/vmscan.c:414
 sget_fc+0x70d/0x940 fs/super.c:551
 vfs_get_super+0x6e/0x270 fs/super.c:1257
 mqueue_get_tree+0x195/0x210 ipc/mqueue.c:370
 vfs_get_tree+0x8e/0x390 fs/super.c:1476
 fc_mount+0x17/0xc0 fs/namespace.c:983
 mq_create_mount+0xcf/0x120 ipc/mqueue.c:410
 mq_init_ns+0x15a/0x210 ipc/mqueue.c:1601
 create_ipc_ns ipc/namespace.c:58 [inline]
 copy_ipcs+0x2ba/0x420 ipc/namespace.c:84
 create_new_namespaces+0x21a/0x7b0 kernel/nsproxy.c:87
 unshare_nsproxy_namespaces+0xc2/0x200 kernel/nsproxy.c:206
 ksys_unshare+0x444/0x980 kernel/fork.c:2717
 __do_sys_unshare kernel/fork.c:2785 [inline]
 __se_sys_unshare kernel/fork.c:2783 [inline]
 __x64_sys_unshare+0x31/0x40 kernel/fork.c:2783
 do_syscall_64+0xfd/0x680 arch/x86/entry/common.c:301
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x459279
Code: fd b7 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 cb b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007fd2a2284c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000110
RAX: ffffffffffffffda RBX: 0000000000000001 RCX: 0000000000459279
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000008000400
RBP: 000000000075bf20 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fd2a22856d4
R13: 00000000004c8759 R14: 00000000004df1e0 R15: 00000000ffffffff

Allocated by task 12996:
 save_stack+0x23/0x90 mm/kasan/common.c:71
 set_track mm/kasan/common.c:79 [inline]
 __kasan_kmalloc mm/kasan/common.c:489 [inline]
 __kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:462
 kasan_kmalloc+0x9/0x10 mm/kasan/common.c:503
 __do_kmalloc mm/slab.c:3654 [inline]
 __kmalloc+0x15c/0x740 mm/slab.c:3663
 kmalloc include/linux/slab.h:552 [inline]
 kzalloc include/linux/slab.h:742 [inline]
 ops_init+0xff/0x410 net/core/net_namespace.c:120
 setup_net+0x2d3/0x740 net/core/net_namespace.c:316
 copy_net_ns+0x1df/0x340 net/core/net_namespace.c:439
 create_new_namespaces+0x400/0x7b0 kernel/nsproxy.c:107
 unshare_nsproxy_namespaces+0xc2/0x200 kernel/nsproxy.c:206
 ksys_unshare+0x444/0x980 kernel/fork.c:2717
 __do_sys_unshare kernel/fork.c:2785 [inline]
 __se_sys_unshare kernel/fork.c:2783 [inline]
 __x64_sys_unshare+0x31/0x40 kernel/fork.c:2783
 do_syscall_64+0xfd/0x680 arch/x86/entry/common.c:301
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 12996:
 save_stack+0x23/0x90 mm/kasan/common.c:71
 set_track mm/kasan/common.c:79 [inline]
 __kasan_slab_free+0x102/0x150 mm/kasan/common.c:451
 kasan_slab_free+0xe/0x10 mm/kasan/common.c:459
 __cache_free mm/slab.c:3426 [inline]
 kfree+0x106/0x2a0 mm/slab.c:3753
 ops_init+0xd1/0x410 net/core/net_namespace.c:135
 setup_net+0x2d3/0x740 net/core/net_namespace.c:316
 copy_net_ns+0x1df/0x340 net/core/net_namespace.c:439
 create_new_namespaces+0x400/0x7b0 kernel/nsproxy.c:107
 unshare_nsproxy_namespaces+0xc2/0x200 kernel/nsproxy.c:206
 ksys_unshare+0x444/0x980 kernel/fork.c:2717
 __do_sys_unshare kernel/fork.c:2785 [inline]
 __se_sys_unshare kernel/fork.c:2783 [inline]
 __x64_sys_unshare+0x31/0x40 kernel/fork.c:2783
 do_syscall_64+0xfd/0x680 arch/x86/entry/common.c:301
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8880a33a2d80
 which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 872 bytes inside of
 1024-byte region [ffff8880a33a2d80, ffff8880a33a3180)
The buggy address belongs to the page:
page:ffffea00028ce880 refcount:1 mapcount:0 mapping:ffff8880aa400ac0 index:0xffff8880a33a3b00 compound_mapcount: 0
flags: 0x1fffc0000010200(slab|head)
raw: 01fffc0000010200 ffffea00022a9808 ffffea000291ef88 ffff8880aa400ac0
raw: ffff8880a33a3b00 ffff8880a33a2000 0000000100000002 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880a33a2f80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880a33a3000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880a33a3080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                          ^
 ffff8880a33a3100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880a33a3180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (8):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets Title
ci-upstream-linux-next-kasan-gce-root 2019/06/10 09:35 linux-next 3f310e51ceb1 0159583c .config console log report
ci-upstream-linux-next-kasan-gce-root 2019/06/08 14:55 linux-next 3f310e51ceb1 0159583c .config console log report
ci-upstream-linux-next-kasan-gce-root 2019/06/08 02:23 linux-next 3f310e51ceb1 cf9c3a50 .config console log report
ci-upstream-linux-next-kasan-gce-root 2019/06/07 19:42 linux-next 3f310e51ceb1 ce9107d0 .config console log report
ci-upstream-linux-next-kasan-gce-root 2019/06/06 02:47 linux-next b2924447b98a a547defc .config console log report
ci-upstream-linux-next-kasan-gce-root 2019/06/05 15:33 linux-next b2924447b98a bfb4a51e .config console log report
ci-upstream-linux-next-kasan-gce-root 2019/06/05 10:13 linux-next b2924447b98a bfb4a51e .config console log report
ci-upstream-linux-next-kasan-gce-root 2019/06/05 05:34 linux-next 56b697c6c13b bfb4a51e .config console log report
* Struck through repros no longer work on HEAD.