syzbot


KASAN: use-after-free Read in nbd_release

Status: upstream: reported C repro on 2021/02/21 06:21
Reported-by: syzbot+8ec6dfaa3508f7893ce9@syzkaller.appspotmail.com
First crash: 1153d, last: 416d
Fix bisection: failed (error log, bisect log)
  
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 KASAN: use-after-free Read in nbd_release C 125 411d 1154d 0/1 upstream: reported C repro on 2021/02/20 11:32
upstream KASAN: use-after-free Read in nbd_release nbd C inconclusive unreliable 5 979d 1152d 0/26 auto-obsoleted due to no activity on 2022/09/15 06:29

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in atomic_read include/asm-generic/atomic-instrumented.h:21 [inline]
BUG: KASAN: use-after-free in refcount_dec_not_one+0x71/0x1d0 lib/refcount.c:269
Read of size 4 at addr ffff8880b3336618 by task systemd-udevd/8362

CPU: 0 PID: 8362 Comm: systemd-udevd Not tainted 4.19.211-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/16/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+0x8f/0xa0 mm/kasan/report.c:412
 atomic_read include/asm-generic/atomic-instrumented.h:21 [inline]
 refcount_dec_not_one+0x71/0x1d0 lib/refcount.c:269
 refcount_dec_and_mutex_lock+0x1c/0x80 lib/refcount.c:308
 nbd_put drivers/block/nbd.c:228 [inline]
 nbd_release+0x108/0x170 drivers/block/nbd.c:1462
 __blkdev_put+0x636/0x870 fs/block_dev.c:1819
 blkdev_close+0x86/0xb0 fs/block_dev.c:1888
 __fput+0x2ce/0x890 fs/file_table.c:278
 task_work_run+0x148/0x1c0 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:193 [inline]
 exit_to_usermode_loop+0x251/0x2a0 arch/x86/entry/common.c:167
 prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:271 [inline]
 do_syscall_64+0x538/0x620 arch/x86/entry/common.c:296
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x7f44ae456270
Code: 73 01 c3 48 8b 0d 38 7d 20 00 f7 d8 64 89 01 48 83 c8 ff c3 66 0f 1f 44 00 00 83 3d 59 c1 20 00 00 75 10 b8 03 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 31 c3 48 83 ec 08 e8 ee fb ff ff 48 89 04 24
RSP: 002b:00007ffd2e1c0f48 EFLAGS: 00000246 ORIG_RAX: 0000000000000003
RAX: 0000000000000000 RBX: 0000000000000007 RCX: 00007f44ae456270
RDX: 000000000aba9500 RSI: 0000000000000000 RDI: 0000000000000007
RBP: 00007f44af310710 R08: 00005627aefa1eb0 R09: 0000000000000008
R10: 00005627aefa1c98 R11: 0000000000000246 R12: 0000000000000000
R13: 00005627aefa0880 R14: 0000000000000003 R15: 000000000000000e

Allocated by task 8359:
 kmem_cache_alloc_trace+0x12f/0x380 mm/slab.c:3625
 kmalloc include/linux/slab.h:515 [inline]
 kzalloc include/linux/slab.h:709 [inline]
 nbd_dev_add+0x44/0x890 drivers/block/nbd.c:1627
 nbd_genl_connect+0x4cc/0x1630 drivers/block/nbd.c:1773
 genl_family_rcv_msg+0x642/0xc40 net/netlink/genetlink.c:602
 genl_rcv_msg+0xbf/0x160 net/netlink/genetlink.c:627
 netlink_rcv_skb+0x160/0x440 net/netlink/af_netlink.c:2463
 genl_rcv+0x24/0x40 net/netlink/genetlink.c:638
 netlink_unicast_kernel net/netlink/af_netlink.c:1325 [inline]
 netlink_unicast+0x4d5/0x690 net/netlink/af_netlink.c:1351
 netlink_sendmsg+0x6c3/0xc50 net/netlink/af_netlink.c:1917
 sock_sendmsg_nosec net/socket.c:651 [inline]
 sock_sendmsg+0xc3/0x120 net/socket.c:661
 ___sys_sendmsg+0x7bb/0x8e0 net/socket.c:2227
 __sys_sendmsg net/socket.c:2265 [inline]
 __do_sys_sendmsg net/socket.c:2274 [inline]
 __se_sys_sendmsg net/socket.c:2272 [inline]
 __x64_sys_sendmsg+0x132/0x220 net/socket.c:2272
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 8362:
 __cache_free mm/slab.c:3503 [inline]
 kfree+0xcc/0x210 mm/slab.c:3822
 nbd_dev_remove drivers/block/nbd.c:223 [inline]
 nbd_put.part.0+0xfe/0x140 drivers/block/nbd.c:231
 nbd_put drivers/block/nbd.c:275 [inline]
 nbd_config_put+0x6a0/0x870 drivers/block/nbd.c:1185
 nbd_release+0xf4/0x170 drivers/block/nbd.c:1461
 __blkdev_put+0x636/0x870 fs/block_dev.c:1819
 blkdev_close+0x86/0xb0 fs/block_dev.c:1888
 __fput+0x2ce/0x890 fs/file_table.c:278
 task_work_run+0x148/0x1c0 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:193 [inline]
 exit_to_usermode_loop+0x251/0x2a0 arch/x86/entry/common.c:167
 prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:271 [inline]
 do_syscall_64+0x538/0x620 arch/x86/entry/common.c:296
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8880b3336540
 which belongs to the cache kmalloc-512 of size 512
The buggy address is located 216 bytes inside of
 512-byte region [ffff8880b3336540, ffff8880b3336740)
The buggy address belongs to the page:
page:ffffea0002cccd80 count:1 mapcount:0 mapping:ffff88813bff0940 index:0xffff8880b3336cc0
flags: 0xfff00000000100(slab)
raw: 00fff00000000100 ffffea000288e208 ffffea0002a7f588 ffff88813bff0940
raw: ffff8880b3336cc0 ffff8880b3336040 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880b3336500: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
 ffff8880b3336580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880b3336600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                            ^
 ffff8880b3336680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880b3336700: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
==================================================================

Crashes (99):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/02/28 23:44 linux-4.19.y 3f8a27f9e27b 95aee97a .config console log report syz C [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2022/10/19 02:35 linux-4.19.y 3f8a27f9e27b b31320fc .config console log report syz C [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2022/09/18 12:45 linux-4.19.y 3f8a27f9e27b dd9a85ff .config console log report syz C [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2022/09/04 09:15 linux-4.19.y 3f8a27f9e27b 28811d0a .config console log report syz C [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2022/07/20 19:52 linux-4.19.y 3f8a27f9e27b 88cb1383 .config console log report syz C ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2021/05/25 04:59 linux-4.19.y 1e986fe9ad15 3c7fef33 .config console log report syz C ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2023/02/27 04:42 linux-4.19.y 3f8a27f9e27b ee50e71c .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2023/01/01 13:08 linux-4.19.y 3f8a27f9e27b ab32d508 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2022/12/30 17:58 linux-4.19.y 3f8a27f9e27b 44712fbc .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2022/11/24 01:25 linux-4.19.y 3f8a27f9e27b 52fdf57a .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2022/11/22 18:18 linux-4.19.y 3f8a27f9e27b 9da37ae8 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2022/11/20 09:53 linux-4.19.y 3f8a27f9e27b 5bb70014 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2022/11/13 20:35 linux-4.19.y 3f8a27f9e27b 7ba4d859 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2022/11/11 02:56 linux-4.19.y 3f8a27f9e27b 3ead01ad .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2022/11/05 05:12 linux-4.19.y 3f8a27f9e27b 6d752409 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2022/10/31 01:37 linux-4.19.y 3f8a27f9e27b 2a71366b .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2022/10/28 23:25 linux-4.19.y 3f8a27f9e27b 8168b69e .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2022/10/28 16:07 linux-4.19.y 3f8a27f9e27b 8168b69e .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2022/10/17 00:46 linux-4.19.y 3f8a27f9e27b 67cb024c .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2022/10/14 20:59 linux-4.19.y 3f8a27f9e27b 4954e4b2 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2022/10/14 14:41 linux-4.19.y 3f8a27f9e27b 4954e4b2 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2022/10/13 14:12 linux-4.19.y 3f8a27f9e27b adf90437 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2022/10/01 10:24 linux-4.19.y 3f8a27f9e27b feb56351 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2022/09/20 03:12 linux-4.19.y 3f8a27f9e27b dd9a85ff .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2022/09/19 09:06 linux-4.19.y 3f8a27f9e27b dd9a85ff .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2022/09/06 03:37 linux-4.19.y 3f8a27f9e27b 9dcd38fc .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2022/08/22 07:26 linux-4.19.y 3f8a27f9e27b 26a13b38 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2022/08/21 06:47 linux-4.19.y 3f8a27f9e27b 26a13b38 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2022/07/20 17:49 linux-4.19.y 3f8a27f9e27b 88cb1383 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2022/07/18 18:47 linux-4.19.y 3f8a27f9e27b ff988920 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2022/07/07 17:13 linux-4.19.y 3f8a27f9e27b bff65f44 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2022/06/26 04:45 linux-4.19.y 3f8a27f9e27b a371c43c .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2022/06/23 05:59 linux-4.19.y 3f8a27f9e27b 912f5df7 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2022/06/21 15:42 linux-4.19.y 3f8a27f9e27b 0fc5c330 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2022/06/15 07:22 linux-4.19.y 3f8a27f9e27b 127d1faf .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2022/06/07 05:49 linux-4.19.y 3f8a27f9e27b c8857892 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2022/05/30 22:48 linux-4.19.y 3f8a27f9e27b af70c3a9 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2022/05/09 19:07 linux-4.19.y 3f8a27f9e27b 8b277b8e .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2022/04/29 21:49 linux-4.19.y 3f8a27f9e27b 44a5ca63 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2022/04/28 17:10 linux-4.19.y 3f8a27f9e27b e9076525 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2022/04/28 08:56 linux-4.19.y 3f8a27f9e27b 8a1f1f07 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2022/03/07 06:10 linux-4.19.y 3f8a27f9e27b 7bdd8b2c .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2022/02/10 10:12 linux-4.19.y 3f8a27f9e27b 0b33604d .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2022/02/04 06:58 linux-4.19.y 3f8a27f9e27b 30646bfe .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2022/01/31 19:23 linux-4.19.y 3f8a27f9e27b a491ad2d .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2022/01/27 23:42 linux-4.19.y 3f8a27f9e27b 64a8e201 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2022/01/26 04:12 linux-4.19.y 3f8a27f9e27b 2cbffd88 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2022/01/25 18:41 linux-4.19.y 3f8a27f9e27b 2cbffd88 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2022/01/23 23:16 linux-4.19.y 3f8a27f9e27b 214351e1 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2022/01/14 11:21 linux-4.19.y 3f8a27f9e27b b8d780ab .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2022/01/11 08:47 linux-4.19.y 3f8a27f9e27b 1884f55a .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2022/01/10 22:38 linux-4.19.y 3f8a27f9e27b ddb0ab8c .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2021/12/29 17:12 linux-4.19.y 3f8a27f9e27b 6cc879d4 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2021/12/20 23:17 linux-4.19.y 3f8a27f9e27b 62bd192b .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2021/12/20 04:05 linux-4.19.y 3f8a27f9e27b 44068e19 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2021/03/29 13:22 linux-4.19.y 78fec1611cbf a8529b82 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2021/03/10 20:39 linux-4.19.y 2cae3e25b706 764067f3 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2021/02/21 14:19 linux-4.19.y 255b58a2b3af 3e5ed8b4 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
2021/02/21 06:20 linux-4.19.y 255b58a2b3af 3e5ed8b4 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in nbd_release
* Struck through repros no longer work on HEAD.