syzbot


KASAN: use-after-free Read in mon_bin_flush

Status: auto-obsoleted due to no activity on 2023/01/14 11:53
Reported-by: syzbot+3be1d49d240b67aece8c@syzkaller.appspotmail.com
First crash: 112d, last: 112d
similar bugs (3):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-5-10 KASAN: use-after-free Read in mon_bin_flush C error 2 138d 140d 2/2 fixed on 2022/10/19 01:02
upstream KASAN: use-after-free Read in mon_bin_flush C inconclusive 15 8d04h 137d 0/24 upstream: reported C repro on 2022/09/18 10:24
android-54 general protection fault in mon_bin_flush C 2 138d 140d 0/2 upstream: reported C repro on 2022/09/16 06:36

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in MON_OFF2HDR drivers/usb/mon/mon_bin.c:207 [inline]
BUG: KASAN: use-after-free in mon_bin_flush+0x121/0x260 drivers/usb/mon/mon_bin.c:884
Read of size 8 at addr ffff888148db62f8 by task syz-executor.2/4457

CPU: 0 PID: 4457 Comm: syz-executor.2 Not tainted 5.15.72-syzkaller-04310-g43eb03f7ce81 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/22/2022
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x151/0x1b7 lib/dump_stack.c:106
 print_address_description+0x87/0x3d0 mm/kasan/report.c:256
 __kasan_report mm/kasan/report.c:435 [inline]
 kasan_report+0x1a6/0x1f0 mm/kasan/report.c:452
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report_generic.c:309
 MON_OFF2HDR drivers/usb/mon/mon_bin.c:207 [inline]
 mon_bin_flush+0x121/0x260 drivers/usb/mon/mon_bin.c:884
 mon_bin_ioctl+0x77c/0xed0 drivers/usb/mon/mon_bin.c:1091
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:874 [inline]
 __se_sys_ioctl+0x115/0x190 fs/ioctl.c:860
 __x64_sys_ioctl+0x7b/0x90 fs/ioctl.c:860
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7f52d41ba5a9
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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:00007f52d330d168 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f52d42db050 RCX: 00007f52d41ba5a9
RDX: 0000000020000080 RSI: 00000000c0109207 RDI: 0000000000000003
RBP: 00007f52d4215580 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffe82ef402f R14: 00007f52d330d300 R15: 0000000000022000
 </TASK>

Allocated by task 3798:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:45 [inline]
 set_alloc_info mm/kasan/common.c:433 [inline]
 __kasan_slab_alloc+0xb2/0xe0 mm/kasan/common.c:466
 kasan_slab_alloc include/linux/kasan.h:244 [inline]
 slab_post_alloc_hook mm/slab.h:550 [inline]
 slab_alloc_node mm/slub.c:3236 [inline]
 slab_alloc mm/slub.c:3244 [inline]
 kmem_cache_alloc+0x189/0x2f0 mm/slub.c:3249
 kmem_cache_alloc_node include/linux/slab.h:462 [inline]
 __alloc_skb+0xbc/0x550 net/core/skbuff.c:416
 alloc_skb include/linux/skbuff.h:1163 [inline]
 alloc_skb_with_frags+0xae/0x6b0 net/core/skbuff.c:6128
 sock_alloc_send_pskb+0x930/0xa70 net/core/sock.c:2503
 unix_dgram_sendmsg+0x6e9/0x2030 net/unix/af_unix.c:1811
 sock_sendmsg_nosec net/socket.c:704 [inline]
 sock_sendmsg net/socket.c:724 [inline]
 ____sys_sendmsg+0x597/0x8e0 net/socket.c:2412
 ___sys_sendmsg net/socket.c:2466 [inline]
 __sys_sendmmsg+0x5c7/0x800 net/socket.c:2552
 __do_sys_sendmmsg net/socket.c:2581 [inline]
 __se_sys_sendmmsg net/socket.c:2578 [inline]
 __x64_sys_sendmmsg+0xa0/0xb0 net/socket.c:2578
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

Freed by task 3798:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4c/0x70 mm/kasan/common.c:45
 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:370
 ____kasan_slab_free+0x126/0x160 mm/kasan/common.c:365
 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:373
 kasan_slab_free include/linux/kasan.h:220 [inline]
 slab_free_hook mm/slub.c:1721 [inline]
 slab_free_freelist_hook+0xc9/0x1a0 mm/slub.c:1747
 slab_free mm/slub.c:3515 [inline]
 kmem_cache_free+0x11a/0x2e0 mm/slub.c:3531
 __kfree_skb+0x13e/0x1c0 net/core/skbuff.c:758
 kfree_skb_reason net/core/skbuff.c:778 [inline]
 kfree_skb+0x7b/0x2e0 net/core/skbuff.c:792
 unix_dgram_sendmsg+0xb82/0x2030 net/unix/af_unix.c:1951
 sock_sendmsg_nosec net/socket.c:704 [inline]
 sock_sendmsg net/socket.c:724 [inline]
 ____sys_sendmsg+0x597/0x8e0 net/socket.c:2412
 ___sys_sendmsg net/socket.c:2466 [inline]
 __sys_sendmmsg+0x5c7/0x800 net/socket.c:2552
 __do_sys_sendmmsg net/socket.c:2581 [inline]
 __se_sys_sendmmsg net/socket.c:2578 [inline]
 __x64_sys_sendmmsg+0xa0/0xb0 net/socket.c:2578
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

The buggy address belongs to the object at ffff888148db6280
 which belongs to the cache skbuff_head_cache of size 248
The buggy address is located 120 bytes inside of
 248-byte region [ffff888148db6280, ffff888148db6378)
The buggy address belongs to the page:
page:ffffea0005236d80 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x148db6
flags: 0x4000000000000200(slab|zone=1)
raw: 4000000000000200 dead000000000100 dead000000000122 ffff888100220480
raw: 0000000000000000 00000000000c000c 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x112a20(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_HARDWALL), pid 29297, ts 1042135889257, free_ts 1042130221193
 set_page_owner include/linux/page_owner.h:33 [inline]
 post_alloc_hook+0x1ab/0x1b0 mm/page_alloc.c:2495
 prep_new_page mm/page_alloc.c:2501 [inline]
 get_page_from_freelist+0x38b/0x400 mm/page_alloc.c:4281
 __alloc_pages+0x3a8/0x7c0 mm/page_alloc.c:5548
 allocate_slab+0x62/0x580 mm/slub.c:1928
 new_slab mm/slub.c:1991 [inline]
 ___slab_alloc+0x2e2/0x6f0 mm/slub.c:3024
 __slab_alloc+0x4a/0x90 mm/slub.c:3111
 slab_alloc_node mm/slub.c:3202 [inline]
 slab_alloc mm/slub.c:3244 [inline]
 kmem_cache_alloc+0x205/0x2f0 mm/slub.c:3249
 kmem_cache_alloc_node include/linux/slab.h:462 [inline]
 __alloc_skb+0xbc/0x550 net/core/skbuff.c:416
 alloc_skb include/linux/skbuff.h:1163 [inline]
 nlmsg_new include/net/netlink.h:953 [inline]
 inet6_ifa_notify net/ipv6/addrconf.c:5508 [inline]
 __ipv6_ifa_notify+0x2c0/0x12e0 net/ipv6/addrconf.c:6154
 addrconf_ifdown+0xef7/0x1be0 net/ipv6/addrconf.c:3892
 addrconf_notify+0x372/0xec0
 notifier_call_chain kernel/notifier.c:83 [inline]
 raw_notifier_call_chain+0x9e/0x110 kernel/notifier.c:391
 call_netdevice_notifiers_info net/core/dev.c:2005 [inline]
 call_netdevice_notifiers_extack net/core/dev.c:2017 [inline]
 call_netdevice_notifiers net/core/dev.c:2031 [inline]
 dev_close_many+0x3fb/0x5d0 net/core/dev.c:1606
 unregister_netdevice_many+0x505/0x1920 net/core/dev.c:11054
 default_device_exit_batch+0x43b/0x4a0 net/core/dev.c:11607
 ops_exit_list net/core/net_namespace.c:167 [inline]
 cleanup_net+0x76d/0xce0 net/core/net_namespace.c:589
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:26 [inline]
 free_pages_prepare mm/page_alloc.c:1364 [inline]
 free_pcp_prepare+0x448/0x450 mm/page_alloc.c:1435
 free_unref_page_prepare mm/page_alloc.c:3433 [inline]
 free_unref_page+0x9c/0x370 mm/page_alloc.c:3513
 free_the_page mm/page_alloc.c:706 [inline]
 __free_pages+0xd8/0x100 mm/page_alloc.c:5621
 __free_slab+0xf0/0x1d0 mm/slub.c:2016
 free_slab mm/slub.c:2031 [inline]
 discard_slab+0x29/0x40 mm/slub.c:2037
 __slab_free+0x238/0x2f0 mm/slub.c:3420
 do_slab_free mm/slub.c:3503 [inline]
 ___cache_free+0x112/0x130 mm/slub.c:3522
 qlink_free+0x4d/0x90 mm/kasan/quarantine.c:157
 qlist_free_all+0x4c/0xc0 mm/kasan/quarantine.c:176
 kasan_quarantine_reduce+0x15a/0x180 mm/kasan/quarantine.c:283
 __kasan_slab_alloc+0x2f/0xe0 mm/kasan/common.c:443
 kasan_slab_alloc include/linux/kasan.h:244 [inline]
 slab_post_alloc_hook mm/slab.h:550 [inline]
 slab_alloc_node mm/slub.c:3236 [inline]
 slab_alloc mm/slub.c:3244 [inline]
 kmem_cache_alloc_trace+0x18a/0x310 mm/slub.c:3261
 kmalloc include/linux/slab.h:591 [inline]
 kzalloc include/linux/slab.h:721 [inline]
 mld_add_delrec net/ipv6/mcast.c:742 [inline]
 igmp6_leave_group net/ipv6/mcast.c:2627 [inline]
 igmp6_group_dropped+0x420/0xa10 net/ipv6/mcast.c:722
 __ipv6_dev_mc_dec+0x2ef/0x610 net/ipv6/mcast.c:978
 addrconf_leave_solict net/ipv6/addrconf.c:2198 [inline]
 __ipv6_ifa_notify+0x990/0x12e0 net/ipv6/addrconf.c:6183
 addrconf_ifdown+0xef7/0x1be0 net/ipv6/addrconf.c:3892

Memory state around the buggy address:
 ffff888148db6180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888148db6200: fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc fc
>ffff888148db6280: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                                ^
 ffff888148db6300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fc
 ffff888148db6380: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb
==================================================================
general protection fault, probably for non-canonical address 0xdffffc0000000164: 0000 [#1] PREEMPT SMP KASAN
KASAN: null-ptr-deref in range [0x0000000000000b20-0x0000000000000b27]
CPU: 0 PID: 4457 Comm: syz-executor.2 Tainted: G    B             5.15.72-syzkaller-04310-g43eb03f7ce81 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/22/2022
RIP: 0010:mon_bin_flush+0x141/0x260 drivers/usb/mon/mon_bin.c:885
Code: 74 08 48 89 df e8 3f c0 7f fe 48 8b 03 41 81 e7 ff 0f 00 00 4d 8d 7c 07 24 4c 89 f8 48 c1 e8 03 48 bb 00 00 00 00 00 fc ff df <0f> b6 04 18 84 c0 75 6b 41 8b 37 83 c6 40 4c 89 f7 e8 a9 fd ff ff
RSP: 0018:ffffc9000aa97ce8 EFLAGS: 00010003
RAX: 0000000000000164 RBX: dffffc0000000000 RCX: 0000000000000002
RDX: 0000000000000000 RSI: 0000000000000092 RDI: 0000000000000001
RBP: ffffc9000aa97d50 R08: ffffffff8142fa13 R09: fffffbfff0e4f6f5
R10: fffffbfff0e4f6f5 R11: 1ffffffff0e4f6f4 R12: 00000000ffffffff
R13: ffff88811282c618 R14: ffff88811282c600 R15: 0000000000000b24
FS:  00007f52d330d700(0000) GS:ffff8881f7000000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f52d32cad38 CR3: 0000000147f87000 CR4: 00000000003506b0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 mon_bin_ioctl+0x77c/0xed0 drivers/usb/mon/mon_bin.c:1091
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:874 [inline]
 __se_sys_ioctl+0x115/0x190 fs/ioctl.c:860
 __x64_sys_ioctl+0x7b/0x90 fs/ioctl.c:860
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7f52d41ba5a9
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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:00007f52d330d168 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f52d42db050 RCX: 00007f52d41ba5a9
RDX: 0000000020000080 RSI: 00000000c0109207 RDI: 0000000000000003
RBP: 00007f52d4215580 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffe82ef402f R14: 00007f52d330d300 R15: 0000000000022000
 </TASK>
Modules linked in:
---[ end trace 4bb480ef3b9cb446 ]---
RIP: 0010:mon_bin_flush+0x141/0x260 drivers/usb/mon/mon_bin.c:885
Code: 74 08 48 89 df e8 3f c0 7f fe 48 8b 03 41 81 e7 ff 0f 00 00 4d 8d 7c 07 24 4c 89 f8 48 c1 e8 03 48 bb 00 00 00 00 00 fc ff df <0f> b6 04 18 84 c0 75 6b 41 8b 37 83 c6 40 4c 89 f7 e8 a9 fd ff ff
RSP: 0018:ffffc9000aa97ce8 EFLAGS: 00010003
RAX: 0000000000000164 RBX: dffffc0000000000 RCX: 0000000000000002
RDX: 0000000000000000 RSI: 0000000000000092 RDI: 0000000000000001
RBP: ffffc9000aa97d50 R08: ffffffff8142fa13 R09: fffffbfff0e4f6f5
R10: fffffbfff0e4f6f5 R11: 1ffffffff0e4f6f4 R12: 00000000ffffffff
R13: ffff88811282c618 R14: ffff88811282c600 R15: 0000000000000b24
FS:  00007f52d330d700(0000) GS:ffff8881f7000000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f52d32cad38 CR3: 0000000147f87000 CR4: 00000000003506b0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess):
   0:	74 08                	je     0xa
   2:	48 89 df             	mov    %rbx,%rdi
   5:	e8 3f c0 7f fe       	callq  0xfe7fc049
   a:	48 8b 03             	mov    (%rbx),%rax
   d:	41 81 e7 ff 0f 00 00 	and    $0xfff,%r15d
  14:	4d 8d 7c 07 24       	lea    0x24(%r15,%rax,1),%r15
  19:	4c 89 f8             	mov    %r15,%rax
  1c:	48 c1 e8 03          	shr    $0x3,%rax
  20:	48 bb 00 00 00 00 00 	movabs $0xdffffc0000000000,%rbx
  27:	fc ff df
* 2a:	0f b6 04 18          	movzbl (%rax,%rbx,1),%eax <-- trapping instruction
  2e:	84 c0                	test   %al,%al
  30:	75 6b                	jne    0x9d
  32:	41 8b 37             	mov    (%r15),%esi
  35:	83 c6 40             	add    $0x40,%esi
  38:	4c 89 f7             	mov    %r14,%rdi
  3b:	e8 a9 fd ff ff       	callq  0xfffffde9

Crashes (1):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets Title
ci2-android-5-15 2022/10/13 20:33 android13-5.15-lts 43eb03f7ce81 adf90437 .config console log report info [disk image] [vmlinux] KASAN: use-after-free Read in mon_bin_flush
* Struck through repros no longer work on HEAD.