syzbot


KASAN: use-after-free Read in relay_switch_subbuf

Status: auto-closed as invalid on 2020/10/24 01:02
Reported-by: syzbot+77ab339a849138392812@syzkaller.appspotmail.com
First crash: 1380d, last: 956d
similar bugs (3):
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.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.19 KASAN: use-after-free Read in relay_switch_subbuf (2) 22 10d 478d 0/1 upstream: reported on 2021/10/17 18:33

Sample crash report:
audit: type=1804 audit(1593133298.984:150): pid=346 uid=0 auid=0 ses=4 subj=system_u:system_r:kernel_t:s0 op=invalid_pcr cause=open_writers comm="syz-executor.5" name="/root/syzkaller-testdir304699807/syzkaller.GI7liT/873/cgroup.controllers" dev="sda1" ino=16702 res=1
==================================================================
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:760
Read of size 8 at addr ffff888083be3738 by task kauditd/28

CPU: 0 PID: 28 Comm: kauditd Not tainted 4.19.130-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 <IRQ>
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1fc/0x2fe lib/dump_stack.c:118
 print_address_description.cold+0x54/0x219 mm/kasan/report.c:256
 kasan_report_error.cold+0x8a/0x1c7 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:760
 relay_reserve include/linux/relay.h:261 [inline]
 trace_note+0x5eb/0x750 kernel/trace/blktrace.c:93
 trace_note_tsk kernel/trace/blktrace.c:124 [inline]
 __blk_add_trace+0xb86/0xe20 kernel/trace/blktrace.c:264
 blk_add_trace_rq+0x36e/0x470 kernel/trace/blktrace.c:827
 trace_block_rq_complete include/trace/events/block.h:116 [inline]
 blk_update_request+0x74c/0xaf0 block/blk-core.c:3088
 scsi_end_request+0x7d/0xb60 drivers/scsi/scsi_lib.c:673
 scsi_io_completion+0x279/0x17c0 drivers/scsi/scsi_lib.c:1102
 scsi_softirq_done+0x336/0x3d0 drivers/scsi/scsi_lib.c:1758
 __blk_mq_complete_request block/blk-mq.c:583 [inline]
 blk_mq_complete_request+0x472/0x660 block/blk-mq.c:620
 virtscsi_vq_done drivers/scsi/virtio_scsi.c:223 [inline]
 virtscsi_req_done+0x14b/0x210 drivers/scsi/virtio_scsi.c:238
 vring_interrupt+0x119/0x160 drivers/virtio/virtio_ring.c:950
 __handle_irq_event_percpu+0x27e/0x8e0 kernel/irq/handle.c:149
 handle_irq_event_percpu kernel/irq/handle.c:189 [inline]
 handle_irq_event+0x102/0x285 kernel/irq/handle.c:206
 handle_edge_irq+0x260/0xcf0 kernel/irq/chip.c:797
 generic_handle_irq_desc include/linux/irqdesc.h:155 [inline]
 handle_irq+0x35/0x50 arch/x86/kernel/irq_64.c:87
 do_IRQ+0x93/0x1c0 arch/x86/kernel/irq.c:246
 common_interrupt+0xf/0xf arch/x86/entry/entry_64.S:670
RIP: 0010:__do_softirq+0x230/0x9a0 kernel/softirq.c:278
Code: c7 c0 58 5b d2 88 48 c1 e8 03 42 80 3c 38 00 0f 85 13 07 00 00 48 83 3d 35 59 72 01 00 0f 84 14 06 00 00 fb 66 0f 1f 44 00 00 <48> c7 44 24 08 c0 90 c0 88 b8 ff ff ff ff 0f bc 44 24 04 83 c0 01
RSP: 0018:ffff8880ae607f20 EFLAGS: 00000282 ORIG_RAX: ffffffffffffffdc
RAX: 1ffffffff11a4b6b RBX: ffff8880a954e000 RCX: 1ffff110152a9d15
RDX: 0000000000000000 RSI: ffff8880a954e888 RDI: ffff8880a954e884
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: dffffc0000000000
 invoke_softirq kernel/softirq.c:372 [inline]
 irq_exit+0x215/0x260 kernel/softirq.c:412
 exiting_irq arch/x86/include/asm/apic.h:544 [inline]
 smp_apic_timer_interrupt+0x136/0x550 arch/x86/kernel/apic/apic.c:1094
 apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:894
 </IRQ>
RIP: 0010:arch_local_irq_restore arch/x86/include/asm/paravirt.h:789 [inline]
RIP: 0010:console_unlock+0xe7b/0x1110 kernel/printk/printk.c:2437
Code: ff df 48 c1 e8 03 80 3c 08 00 0f 85 66 02 00 00 48 83 3d 4f d7 7d 07 00 0f 84 9e 00 00 00 e8 cc 23 15 00 48 8b 7c 24 30 57 9d <0f> 1f 44 00 00 e9 9b fc ff ff e8 b6 23 15 00 0f 0b e8 af 23 15 00
RSP: 0018:ffff8880a9557bd0 EFLAGS: 00000293 ORIG_RAX: ffffffffffffff13
RAX: ffff8880a954e000 RBX: 0000000000000200 RCX: dffffc0000000000
RDX: 0000000000000000 RSI: ffffffff81548404 RDI: 0000000000000293
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: ffffffff845c4ff0
R13: 000000000000011c R14: 0000000000000000 R15: ffffffff8945f9f0
 vprintk_emit+0x2b8/0x730 kernel/printk/printk.c:1937
 vprintk_func+0x79/0x17e kernel/printk/printk_safe.c:398
 printk+0xba/0xed kernel/printk/printk.c:2012
 kauditd_printk_skb kernel/audit.c:546 [inline]
 kauditd_hold_skb.cold+0x41/0x50 kernel/audit.c:579
 kauditd_send_queue+0x12f/0x170 kernel/audit.c:742
 kauditd_thread+0x5c0/0x7a0 kernel/audit.c:868
 kthread+0x30b/0x410 kernel/kthread.c:246
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415

Allocated by task 32647:
 kmem_cache_alloc+0x122/0x370 mm/slab.c:3559
 __d_alloc+0x2b/0xa10 fs/dcache.c:1610
 d_alloc+0x4a/0x230 fs/dcache.c:1694
 __lookup_hash+0xc8/0x180 fs/namei.c:1543
 filename_create+0x186/0x490 fs/namei.c:3639
 user_path_create fs/namei.c:3696 [inline]
 do_symlinkat+0xe1/0x2c0 fs/namei.c:4149
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 9:
 __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+0x26c/0x9a0 kernel/softirq.c:292

The buggy address belongs to the object at ffff888083be36e0
 which belongs to the cache dentry of size 288
The buggy address is located 88 bytes inside of
 288-byte region [ffff888083be36e0, ffff888083be3800)
The buggy address belongs to the page:
page:ffffea00020ef8c0 count:1 mapcount:0 mapping:ffff88821bc44c80 index:0x0
flags: 0xfffe0000000100(slab)
raw: 00fffe0000000100 ffffea00024a1f48 ffffea00020e43c8 ffff88821bc44c80
raw: 0000000000000000 ffff888083be3000 000000010000000b 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff888083be3600: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff888083be3680: 00 00 00 00 fc fc fc fc fc fc fc fc fb fb fb fb
>ffff888083be3700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                        ^
 ffff888083be3780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888083be3800: fc fc fc fc fc fc fc fc 00 00 00 00 00 00 00 00
==================================================================

Crashes (10):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets Title
ci2-linux-4-19 2020/06/26 01:01 linux-4.19.y a39e75458e1c aea82c00 .config console log report
ci2-linux-4-19 2020/05/06 01:46 linux-4.19.y fdc072324f3c 35b8eb30 .config console log report
ci2-linux-4-19 2020/03/30 14:23 linux-4.19.y 54b4fa6d3955 c8d1cc20 .config console log report
ci2-linux-4-19 2019/12/15 14:54 linux-4.19.y 312017a460d5 eef6e580 .config console log report
ci2-linux-4-19 2019/11/09 07:28 linux-4.19.y 5ee93551c703 1e35461e .config console log report
ci2-linux-4-19 2019/11/08 07:43 linux-4.19.y 5ee93551c703 1e35461e .config console log report
ci2-linux-4-19 2019/07/19 06:10 linux-4.19.y 3bd837bfe431 7bb222f7 .config console log report
ci2-linux-4-19 2019/06/13 20:10 linux-4.19.y 768292d05361 d25bb7ad .config console log report
ci2-linux-4-19 2019/06/04 07:16 linux-4.19.y e109a984cf38 ce07a7ae .config console log report
ci2-linux-4-19 2019/04/29 02:56 linux-4.19.y 19bb613acb9a b617407b .config console log report
* Struck through repros no longer work on HEAD.