syzbot


KASAN: use-after-free Read in ceph_mdsc_destroy

Status: fixed on 2020/09/16 22:51
Subsystems: ceph fs
[Documentation on labels]
Reported-by: syzbot+b57f46d8d6ea51960b8c@syzkaller.appspotmail.com
Fix commit: a7caa88f8b72 ceph: fix use-after-free for fsc->mdsc
First crash: 1429d, last: 1409d
Discussions (10)
Title Replies (including bot) Last reply
[PATCH 4.19 00/71] 4.19.142-rc1 review 79 (79) 2020/08/26 11:14
[PATCH 5.8 000/148] 5.8.4-rc1 review 152 (152) 2020/08/24 16:54
[PATCH 5.4 000/107] 5.4.61-rc1 review 108 (108) 2020/08/24 08:31
[PATCH 5.7 000/124] 5.7.18-rc1 review 125 (125) 2020/08/24 08:30
[PATCH AUTOSEL 4.19 01/18] scsi: ufs: Add DELAY_BEFORE_LPM quirk for Micron devices 18 (18) 2020/08/20 00:03
[PATCH AUTOSEL 5.4 01/22] scsi: ufs: Add DELAY_BEFORE_LPM quirk for Micron devices 22 (22) 2020/08/20 00:02
[PATCH AUTOSEL 5.7 01/24] scsi: ufs: Add DELAY_BEFORE_LPM quirk for Micron devices 24 (24) 2020/08/20 00:01
[PATCH AUTOSEL 5.8 01/27] scsi: ufs: Add DELAY_BEFORE_LPM quirk for Micron devices 27 (27) 2020/08/20 00:01
[PATCH] ceph: KASAN: use-after-free Read in ceph_mdsc_destroy 2 (2) 2020/07/23 10:42
KASAN: use-after-free Read in ceph_mdsc_destroy 1 (2) 2020/07/23 07:21

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in timer_is_static_object+0x31/0x80 kernel/time/timer.c:625
Read of size 8 at addr ffff88805aef0380 by task syz-executor.2/11389

CPU: 1 PID: 11389 Comm: syz-executor.2 Not tainted 5.8.0-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+0x1f0/0x31e lib/dump_stack.c:118
 print_address_description+0x66/0x5a0 mm/kasan/report.c:383
 __kasan_report mm/kasan/report.c:513 [inline]
 kasan_report+0x132/0x1d0 mm/kasan/report.c:530
 timer_is_static_object+0x31/0x80 kernel/time/timer.c:625
 debug_object_assert_init+0x12f/0x250 lib/debugobjects.c:866
 debug_timer_assert_init kernel/time/timer.c:742 [inline]
 debug_assert_init kernel/time/timer.c:787 [inline]
 del_timer+0x2f/0x390 kernel/time/timer.c:1205
 try_to_grab_pending+0xba/0x9f0 kernel/workqueue.c:1249
 __cancel_work_timer+0x84/0x5c0 kernel/workqueue.c:3092
 ceph_mdsc_stop fs/ceph/mds_client.c:4660 [inline]
 ceph_mdsc_destroy+0x4f/0x110 fs/ceph/mds_client.c:4679
 destroy_fs_client fs/ceph/super.c:720 [inline]
 ceph_get_tree+0x4c2/0x1420 fs/ceph/super.c:1110
 vfs_get_tree+0x88/0x270 fs/super.c:1547
 do_new_mount fs/namespace.c:2871 [inline]
 path_mount+0x179d/0x29e0 fs/namespace.c:3188
 do_mount fs/namespace.c:3201 [inline]
 __do_sys_mount fs/namespace.c:3409 [inline]
 __se_sys_mount+0x126/0x180 fs/namespace.c:3386
 do_syscall_64+0x31/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x45ce79
Code: 2d b6 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 fb b5 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007fa80dd26c78 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 0000000000020480 RCX: 000000000045ce79
RDX: 0000000020000140 RSI: 00000000200000c0 RDI: 0000000020000000
RBP: 000000000118c0b0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000118c06c
R13: 00007ffc4a2689af R14: 00007fa80dd279c0 R15: 000000000118c06c

Allocated by task 11389:
 save_stack mm/kasan/common.c:48 [inline]
 set_track mm/kasan/common.c:56 [inline]
 __kasan_kmalloc+0x103/0x140 mm/kasan/common.c:494
 kmem_cache_alloc_trace+0x234/0x300 mm/slab.c:3551
 kmalloc include/linux/slab.h:555 [inline]
 kzalloc include/linux/slab.h:669 [inline]
 ceph_mdsc_init+0x50/0xb40 fs/ceph/mds_client.c:4351
 ceph_get_tree+0x39a/0x1420 fs/ceph/super.c:1063
 vfs_get_tree+0x88/0x270 fs/super.c:1547
 do_new_mount fs/namespace.c:2871 [inline]
 path_mount+0x179d/0x29e0 fs/namespace.c:3188
 do_mount fs/namespace.c:3201 [inline]
 __do_sys_mount fs/namespace.c:3409 [inline]
 __se_sys_mount+0x126/0x180 fs/namespace.c:3386
 do_syscall_64+0x31/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

Freed by task 11389:
 save_stack mm/kasan/common.c:48 [inline]
 set_track mm/kasan/common.c:56 [inline]
 kasan_set_free_info mm/kasan/common.c:316 [inline]
 __kasan_slab_free+0x114/0x170 mm/kasan/common.c:455
 __cache_free mm/slab.c:3426 [inline]
 kfree+0x10a/0x220 mm/slab.c:3757
 ceph_mdsc_init+0x86a/0xb40 fs/ceph/mds_client.c:4422
 ceph_get_tree+0x39a/0x1420 fs/ceph/super.c:1063
 vfs_get_tree+0x88/0x270 fs/super.c:1547
 do_new_mount fs/namespace.c:2871 [inline]
 path_mount+0x179d/0x29e0 fs/namespace.c:3188
 do_mount fs/namespace.c:3201 [inline]
 __do_sys_mount fs/namespace.c:3409 [inline]
 __se_sys_mount+0x126/0x180 fs/namespace.c:3386
 do_syscall_64+0x31/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

The buggy address belongs to the object at ffff88805aef0000
 which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 896 bytes inside of
 4096-byte region [ffff88805aef0000, ffff88805aef1000)
The buggy address belongs to the page:
page:ffffea00016bbc00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 head:ffffea00016bbc00 order:1 compound_mapcount:0
flags: 0xfffe0000010200(slab|head)
raw: 00fffe0000010200 ffffea00015b1b88 ffffea00016bbc88 ffff8880aa442000
raw: 0000000000000000 ffff88805aef0000 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88805aef0280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88805aef0300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88805aef0380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                   ^
 ffff88805aef0400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88805aef0480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/08/08 02:44 upstream 5631c5e0eb90 ff51e522 .config console log report ci-upstream-kasan-gce-smack-root
2020/07/31 16:27 upstream d8b9faec54ae d895b3be .config console log report ci-upstream-kasan-gce-root
2020/07/19 12:39 upstream f932d58abc38 9c812472 .config console log report ci-upstream-kasan-gce-selinux-root
2020/07/26 12:02 linux-next 26027945c94a 51265195 .config console log report ci-upstream-linux-next-kasan-gce-root
* Struck through repros no longer work on HEAD.