syzbot


KASAN: use-after-free Read in relay_switch_subbuf (2)

Status: upstream: reported on 2021/10/17 18:33
Reported-by: syzbot+1a4f3a6cd1e92ae4ef9d@syzkaller.appspotmail.com
First crash: 478d, last: 10d
similar bugs (9):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in relay_switch_subbuf C done error 93 101d 1595d 0/24 upstream: reported C repro on 2018/09/26 07:41
linux-4.19 KASAN: use-after-free Read in relay_switch_subbuf 10 956d 1380d 0/1 auto-closed as invalid on 2020/10/24 01:02
linux-4.14 KASAN: use-after-free Read in relay_switch_subbuf C done unreliable 5 148d 1190d 0/1 upstream: reported C repro on 2019/11/05 17:36
linux-4.14 general protection fault in relay_switch_subbuf 2 1047d 1140d 0/1 auto-closed as invalid on 2020/07/25 03:12
upstream general protection fault in relay_switch_subbuf 4 1475d 1447d 0/24 auto-closed as invalid on 2019/07/23 22:29
upstream general protection fault in relay_switch_subbuf (2) 1 1288d 1279d 0/24 auto-closed as invalid on 2019/10/25 14:11
upstream general protection fault in relay_switch_subbuf (3) 1 1195d 1195d 0/24 auto-closed as invalid on 2020/01/29 10:20
linux-4.19 general protection fault in relay_switch_subbuf 1 1270d 1270d 0/1 auto-closed as invalid on 2019/12/15 08:14
linux-4.19 general protection fault in relay_switch_subbuf (2) 1 967d 967d 0/1 auto-closed as invalid on 2020/10/13 07:52

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in d_inode include/linux/dcache.h:516 [inline]
BUG: KASAN: use-after-free in relay_switch_subbuf+0x8cc/0x940 kernel/relay.c:761
Read of size 8 at addr ffff88808e27c478 by task syz-executor.2/15387

CPU: 0 PID: 15387 Comm: syz-executor.2 Not tainted 4.19.211-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/12/2023
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1fc/0x2ef lib/dump_stack.c:118
 print_address_description.cold+0x54/0x219 mm/kasan/report.c:256
 kasan_report_error.cold+0x8a/0x1b9 mm/kasan/report.c:354
 kasan_report mm/kasan/report.c:412 [inline]
 __asan_report_load8_noabort+0x88/0x90 mm/kasan/report.c:433
 d_inode include/linux/dcache.h:516 [inline]
 relay_switch_subbuf+0x8cc/0x940 kernel/relay.c:761
 relay_reserve include/linux/relay.h:261 [inline]
 trace_note+0x5eb/0x750 kernel/trace/blktrace.c:96
 trace_note_tsk kernel/trace/blktrace.c:127 [inline]
 __blk_add_trace+0xb86/0xe20 kernel/trace/blktrace.c:267
 blk_add_trace_rq+0x36e/0x470 kernel/trace/blktrace.c:858
 trace_block_rq_insert include/trace/events/block.h:192 [inline]
 blk_mq_sched_request_inserted+0x167/0x2f0 block/blk-mq-sched.c:352
 dd_insert_request block/mq-deadline.c:497 [inline]
 dd_insert_requests+0x2d2/0x970 block/mq-deadline.c:533
 blk_mq_sched_insert_request+0x504/0x760 block/blk-mq-sched.c:397
 blk_execute_rq_nowait+0x194/0x340 block/blk-exec.c:64
 sg_common_write.constprop.0+0xfaa/0x20b0 drivers/scsi/sg.c:847
 sg_new_write.isra.0+0x6f4/0xa10 drivers/scsi/sg.c:785
 sg_ioctl+0x118b/0x2720 drivers/scsi/sg.c:931
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:501 [inline]
 do_vfs_ioctl+0xcdb/0x12e0 fs/ioctl.c:688
 ksys_ioctl+0x9b/0xc0 fs/ioctl.c:705
 __do_sys_ioctl fs/ioctl.c:712 [inline]
 __se_sys_ioctl fs/ioctl.c:710 [inline]
 __x64_sys_ioctl+0x6f/0xb0 fs/ioctl.c:710
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x7fb7b28850c9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 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 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fb7b0df7168 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007fb7b29a4f80 RCX: 00007fb7b28850c9
RDX: 0000000020000400 RSI: 0000000000002285 RDI: 0000000000000003
RBP: 00007fb7b28e0ae9 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffcb7bb0d8f R14: 00007fb7b0df7300 R15: 0000000000022000

Allocated by task 27605:
 kmem_cache_alloc+0x122/0x370 mm/slab.c:3559
 __d_alloc+0x2b/0xa10 fs/dcache.c:1612
 d_alloc+0x4a/0x230 fs/dcache.c:1696
 d_alloc_parallel+0xeb/0x19e0 fs/dcache.c:2443
 __lookup_slow+0x18d/0x4a0 fs/namei.c:1655
 lookup_one_len+0x163/0x190 fs/namei.c:2544
 start_creating+0xc9/0x220 fs/debugfs/inode.c:313
 __debugfs_create_file+0x5e/0x480 fs/debugfs/inode.c:352
 relay_create_buf_file+0xf0/0x170 kernel/relay.c:429
 relay_open_buf.part.0+0x781/0xb80 kernel/relay.c:458
 relay_open_buf kernel/relay.c:450 [inline]
 relay_open kernel/relay.c:605 [inline]
 relay_open+0x537/0x9f0 kernel/relay.c:564
 do_blk_trace_setup+0x4f6/0xb40 kernel/trace/blktrace.c:566
 __blk_trace_setup+0xca/0x180 kernel/trace/blktrace.c:609
 blk_trace_ioctl+0x155/0x290 kernel/trace/blktrace.c:750
 blkdev_ioctl+0x112/0x1a80 block/ioctl.c:587
 block_ioctl+0xe9/0x130 fs/block_dev.c:1906
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:501 [inline]
 do_vfs_ioctl+0xcdb/0x12e0 fs/ioctl.c:688
 ksys_ioctl+0x9b/0xc0 fs/ioctl.c:705
 __do_sys_ioctl fs/ioctl.c:712 [inline]
 __se_sys_ioctl fs/ioctl.c:710 [inline]
 __x64_sys_ioctl+0x6f/0xb0 fs/ioctl.c:710
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 18:
 __cache_free mm/slab.c:3503 [inline]
 kmem_cache_free+0x7f/0x260 mm/slab.c:3765
 __rcu_reclaim kernel/rcu/rcu.h:236 [inline]
 rcu_do_batch kernel/rcu/tree.c:2584 [inline]
 invoke_rcu_callbacks kernel/rcu/tree.c:2897 [inline]
 __rcu_process_callbacks kernel/rcu/tree.c:2864 [inline]
 rcu_process_callbacks+0x8ff/0x18b0 kernel/rcu/tree.c:2881
 __do_softirq+0x265/0x980 kernel/softirq.c:292

The buggy address belongs to the object at ffff88808e27c420
 which belongs to the cache dentry of size 288
The buggy address is located 88 bytes inside of
 288-byte region [ffff88808e27c420, ffff88808e27c540)
The buggy address belongs to the page:
page:ffffea0002389f00 count:1 mapcount:0 mapping:ffff88813be45200 index:0x0
flags: 0xfff00000000100(slab)
raw: 00fff00000000100 ffffea0002d50688 ffffea0002d50788 ffff88813be45200
raw: 0000000000000000 ffff88808e27c000 000000010000000b 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88808e27c300: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88808e27c380: 00 00 00 00 00 00 00 00 00 00 00 00 fc fc fc fc
>ffff88808e27c400: fc fc fc fc fb fb fb fb fb fb fb fb fb fb fb fb
                                                                ^
 ffff88808e27c480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88808e27c500: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
==================================================================

Crashes (22):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets Title
ci2-linux-4-19 2023/01/28 08:33 linux-4.19.y 3f8a27f9e27b 9dfcf09c .config console log report info [disk image] [vmlinux] KASAN: use-after-free Read in relay_switch_subbuf
ci2-linux-4-19 2023/01/27 05:11 linux-4.19.y 3f8a27f9e27b 9dfcf09c .config console log report info [disk image] [vmlinux] KASAN: use-after-free Read in relay_switch_subbuf
ci2-linux-4-19 2023/01/03 01:40 linux-4.19.y 3f8a27f9e27b ab32d508 .config console log report info [disk image] [vmlinux] KASAN: use-after-free Read in relay_switch_subbuf
ci2-linux-4-19 2022/12/27 22:45 linux-4.19.y 3f8a27f9e27b 44712fbc .config console log report info [disk image] [vmlinux] KASAN: use-after-free Read in relay_switch_subbuf
ci2-linux-4-19 2022/11/12 18:14 linux-4.19.y 3f8a27f9e27b f42ee5d8 .config console log report info [disk image] [vmlinux] KASAN: use-after-free Read in relay_switch_subbuf
ci2-linux-4-19 2022/11/06 11:40 linux-4.19.y 3f8a27f9e27b 6d752409 .config console log report info [disk image] [vmlinux] KASAN: use-after-free Read in relay_switch_subbuf
ci2-linux-4-19 2022/09/12 21:17 linux-4.19.y 3f8a27f9e27b f371ed7e .config console log report info KASAN: use-after-free Read in relay_switch_subbuf
ci2-linux-4-19 2022/09/10 22:21 linux-4.19.y 3f8a27f9e27b 356d8217 .config console log report info KASAN: use-after-free Read in relay_switch_subbuf
ci2-linux-4-19 2022/08/22 13:23 linux-4.19.y 3f8a27f9e27b 26a13b38 .config console log report info KASAN: use-after-free Read in relay_switch_subbuf
ci2-linux-4-19 2022/08/20 03:28 linux-4.19.y 3f8a27f9e27b 26a13b38 .config console log report info KASAN: use-after-free Read in relay_switch_subbuf
ci2-linux-4-19 2022/07/13 22:06 linux-4.19.y 3f8a27f9e27b 5d921b08 .config console log report info KASAN: use-after-free Read in relay_switch_subbuf
ci2-linux-4-19 2022/07/04 16:49 linux-4.19.y 3f8a27f9e27b bff65f44 .config console log report info KASAN: use-after-free Read in relay_switch_subbuf
ci2-linux-4-19 2022/07/04 00:25 linux-4.19.y 3f8a27f9e27b 1434eec0 .config console log report info KASAN: use-after-free Read in relay_switch_subbuf
ci2-linux-4-19 2022/06/25 12:15 linux-4.19.y 3f8a27f9e27b a371c43c .config console log report info KASAN: use-after-free Read in relay_switch_subbuf
ci2-linux-4-19 2022/06/10 11:10 linux-4.19.y 3f8a27f9e27b 0d5abf15 .config console log report info KASAN: use-after-free Read in relay_switch_subbuf
ci2-linux-4-19 2022/03/05 09:57 linux-4.19.y 3f8a27f9e27b 45a13a73 .config console log report info KASAN: use-after-free Read in relay_switch_subbuf
ci2-linux-4-19 2022/02/01 17:32 linux-4.19.y 3f8a27f9e27b c1c1631d .config console log report info KASAN: use-after-free Read in relay_switch_subbuf
ci2-linux-4-19 2022/01/26 16:04 linux-4.19.y 3f8a27f9e27b 2cbffd88 .config console log report info KASAN: use-after-free Read in relay_switch_subbuf
ci2-linux-4-19 2022/01/23 08:21 linux-4.19.y 3f8a27f9e27b 214351e1 .config console log report info KASAN: use-after-free Read in relay_switch_subbuf
ci2-linux-4-19 2021/12/26 07:08 linux-4.19.y 3f8a27f9e27b 6caa12e4 .config console log report info KASAN: use-after-free Read in relay_switch_subbuf
ci2-linux-4-19 2021/10/17 18:32 linux-4.19.y 3f8a27f9e27b 0c5d9412 .config console log report info KASAN: use-after-free Read in relay_switch_subbuf
ci2-linux-4-19 2022/10/21 13:22 linux-4.19.y 3f8a27f9e27b 63e790dd .config console log report info [disk image] [vmlinux] general protection fault in relay_switch_subbuf
* Struck through repros no longer work on HEAD.