syzbot


KASAN: use-after-free Read in dev_uevent

Status: auto-obsoleted due to no activity on 2024/03/27 01:05
Reported-by: syzbot+cbc05d69217a06cd8c7a@syzkaller.appspotmail.com
First crash: 502d, last: 331d
Similar bugs (6)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.1 KASAN: use-after-free Read in dev_uevent origin:upstream missing-backport C inconclusive 4 133d 626d 0/3 upstream: reported C repro on 2023/03/07 19:30
android-54 KASAN: use-after-free Read in dev_uevent 4 1276d 1340d 0/2 auto-closed as invalid on 2021/09/24 00:56
android-54 KASAN: use-after-free Read in dev_uevent (2) 2 1118d 1124d 0/2 auto-closed as invalid on 2022/03/01 02:09
android-5-10 KASAN: use-after-free Read in dev_uevent 1 1101d 1101d 0/2 auto-closed as invalid on 2022/02/16 03:05
upstream KASAN: use-after-free Read in dev_uevent kernel syz 54 645d 1618d 22/28 fixed on 2023/02/24 13:50
upstream KASAN: slab-use-after-free Read in dev_uevent kernel C error error 70 161d 627d 0/28 auto-obsoleted due to no activity on 2024/10/08 09:06

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in string_nocheck lib/vsprintf.c:643 [inline]
BUG: KASAN: use-after-free in string+0x218/0x2a0 lib/vsprintf.c:725
Read of size 1 at addr ffff88811821a300 by task udevd/679

CPU: 1 PID: 679 Comm: udevd Not tainted 6.1.57-syzkaller-00065-g401a2769d990 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x151/0x1b7 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:316 [inline]
 print_report+0x158/0x4e0 mm/kasan/report.c:427
 kasan_report+0x13c/0x170 mm/kasan/report.c:531
 __asan_report_load1_noabort+0x14/0x20 mm/kasan/report_generic.c:348
 string_nocheck lib/vsprintf.c:643 [inline]
 string+0x218/0x2a0 lib/vsprintf.c:725
 vsnprintf+0x11fc/0x1c70 lib/vsprintf.c:2800
 add_uevent_var+0x1c0/0x440 lib/kobject_uevent.c:665
 dev_uevent+0x3ee/0x6f0 drivers/base/core.c:2568
 uevent_show+0x192/0x310 drivers/base/core.c:2639
 dev_attr_show+0x56/0xd0 drivers/base/core.c:2342
 sysfs_kf_seq_show+0x27c/0x3a0 fs/sysfs/file.c:59
 kernfs_seq_show+0x119/0x160 fs/kernfs/file.c:201
 seq_read_iter+0x430/0xd00 fs/seq_file.c:230
 kernfs_fop_read_iter+0x145/0x470 fs/kernfs/file.c:275
 call_read_iter include/linux/fs.h:2209 [inline]
 new_sync_read fs/read_write.c:389 [inline]
 vfs_read+0x771/0xad0 fs/read_write.c:470
 ksys_read+0x199/0x2c0 fs/read_write.c:613
 __do_sys_read fs/read_write.c:623 [inline]
 __se_sys_read fs/read_write.c:621 [inline]
 __x64_sys_read+0x7b/0x90 fs/read_write.c:621
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f1569f16b6a
Code: 00 3d 00 00 41 00 75 0d 50 48 8d 3d 2d 08 0a 00 e8 ea 7d 01 00 31 c0 e9 07 ff ff ff 64 8b 04 25 18 00 00 00 85 c0 75 1b 0f 05 <48> 3d 00 f0 ff ff 76 6c 48 8b 15 8f a2 0d 00 f7 d8 64 89 02 48 83
RSP: 002b:00007fffd7d2da68 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
RAX: ffffffffffffffda RBX: 000055c04c1992c0 RCX: 00007f1569f16b6a
RDX: 0000000000001000 RSI: 000055c04c16e690 RDI: 0000000000000008
RBP: 000055c04c1992c0 R08: 0000000000000008 R09: 0000000000010000
R10: 000000000000010f R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000003fff R14: 00007fffd7d2df48 R15: 000000000000000a
 </TASK>

Allocated by task 9794:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
 kasan_save_alloc_info+0x1f/0x30 mm/kasan/generic.c:505
 ____kasan_kmalloc mm/kasan/common.c:379 [inline]
 __kasan_kmalloc+0x9c/0xb0 mm/kasan/common.c:388
 kasan_kmalloc include/linux/kasan.h:212 [inline]
 kmalloc_trace+0x44/0xa0 mm/slab_common.c:1052
 kmalloc include/linux/slab.h:553 [inline]
 raw_ioctl_init drivers/usb/gadget/legacy/raw_gadget.c:462 [inline]
 raw_ioctl+0x1a2d/0x3620 drivers/usb/gadget/legacy/raw_gadget.c:1252
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:870 [inline]
 __se_sys_ioctl+0x114/0x190 fs/ioctl.c:856
 __x64_sys_ioctl+0x7b/0x90 fs/ioctl.c:856
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

Freed by task 9797:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
 kasan_save_free_info+0x2b/0x40 mm/kasan/generic.c:516
 ____kasan_slab_free+0x131/0x180 mm/kasan/common.c:241
 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:249
 kasan_slab_free include/linux/kasan.h:178 [inline]
 slab_free_hook mm/slub.c:1745 [inline]
 slab_free_freelist_hook mm/slub.c:1771 [inline]
 slab_free mm/slub.c:3684 [inline]
 __kmem_cache_free+0x218/0x3b0 mm/slub.c:3697
 kfree+0x7a/0xf0 mm/slab_common.c:1009
 dev_free drivers/usb/gadget/legacy/raw_gadget.c:210 [inline]
 kref_put+0xb6/0x7c0 include/linux/kref.h:65
 raw_release+0x145/0x1e0 drivers/usb/gadget/legacy/raw_gadget.c:426
 __fput+0x3ab/0x870 fs/file_table.c:320
 ____fput+0x15/0x20 fs/file_table.c:348
 task_work_run+0x24d/0x2e0 kernel/task_work.c:179
 exit_task_work include/linux/task_work.h:38 [inline]
 do_exit+0xbd5/0x2b80 kernel/exit.c:875
 do_group_exit+0x21a/0x2d0 kernel/exit.c:1025
 __do_sys_exit_group kernel/exit.c:1036 [inline]
 __se_sys_exit_group kernel/exit.c:1034 [inline]
 __x64_sys_exit_group+0x3f/0x40 kernel/exit.c:1034
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

The buggy address belongs to the object at ffff88811821a300
 which belongs to the cache kmalloc-32 of size 32
The buggy address is located 0 bytes inside of
 32-byte region [ffff88811821a300, ffff88811821a320)

The buggy address belongs to the physical page:
page:ffffea0004608680 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x11821a
flags: 0x4000000000000200(slab|zone=1)
raw: 4000000000000200 ffffea000507ca80 dead000000000003 ffff888100042600
raw: 0000000000000000 0000000080400040 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 0x12a20(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY), pid 37, tgid 37 (kworker/1:1), ts 165497031911, free_ts 165342932197
 set_page_owner include/linux/page_owner.h:33 [inline]
 post_alloc_hook+0x213/0x220 mm/page_alloc.c:2566
 prep_new_page+0x1b/0x110 mm/page_alloc.c:2573
 get_page_from_freelist+0x27ea/0x2870 mm/page_alloc.c:4397
 __alloc_pages+0x3a1/0x780 mm/page_alloc.c:5684
 alloc_slab_page+0x6c/0xf0
 allocate_slab mm/slub.c:1962 [inline]
 new_slab+0x90/0x3e0 mm/slub.c:2015
 ___slab_alloc+0x6f9/0xb80 mm/slub.c:3203
 __slab_alloc+0x5d/0xa0 mm/slub.c:3302
 slab_alloc_node mm/slub.c:3387 [inline]
 __kmem_cache_alloc_node+0x1af/0x250 mm/slub.c:3460
 kmalloc_trace+0x2a/0xa0 mm/slab_common.c:1047
 kmalloc include/linux/slab.h:553 [inline]
 kzalloc include/linux/slab.h:689 [inline]
 ref_tracker_alloc+0x138/0x450 lib/ref_tracker.c:85
 __netdev_tracker_alloc include/linux/netdevice.h:4063 [inline]
 netdev_hold include/linux/netdevice.h:4092 [inline]
 dst_init+0xe1/0x400 net/core/dst.c:52
 dst_alloc+0x18a/0x1e0 net/core/dst.c:96
 ip6_dst_alloc net/ipv6/route.c:344 [inline]
 icmp6_dst_alloc+0xf8/0x510 net/ipv6/route.c:3265
 mld_sendpack+0x614/0xe40 net/ipv6/mcast.c:1809
 mld_send_cr net/ipv6/mcast.c:2121 [inline]
 mld_ifc_work+0x7dc/0xba0 net/ipv6/mcast.c:2653
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:26 [inline]
 free_pages_prepare mm/page_alloc.c:1474 [inline]
 free_pcp_prepare mm/page_alloc.c:1548 [inline]
 free_unref_page_prepare+0x83d/0x850 mm/page_alloc.c:3470
 free_unref_page+0xb2/0x5c0 mm/page_alloc.c:3566
 free_the_page mm/page_alloc.c:774 [inline]
 __free_pages+0x61/0xf0 mm/page_alloc.c:5773
 __free_slab+0xce/0x1a0 mm/slub.c:2039
 free_slab mm/slub.c:2054 [inline]
 discard_slab mm/slub.c:2060 [inline]
 __unfreeze_partials+0x165/0x1a0 mm/slub.c:2609
 put_cpu_partial+0xa9/0x100 mm/slub.c:2685
 __slab_free+0x1c8/0x280 mm/slub.c:3561
 do_slab_free mm/slub.c:3638 [inline]
 ___cache_free+0xc6/0xd0 mm/slub.c:3691
 qlink_free mm/kasan/quarantine.c:168 [inline]
 qlist_free_all+0xc5/0x140 mm/kasan/quarantine.c:187
 kasan_quarantine_reduce+0x15a/0x180 mm/kasan/quarantine.c:294
 __kasan_slab_alloc+0x24/0x80 mm/kasan/common.c:310
 kasan_slab_alloc include/linux/kasan.h:202 [inline]
 slab_post_alloc_hook+0x53/0x2c0 mm/slab.h:768
 slab_alloc_node mm/slub.c:3421 [inline]
 kmem_cache_alloc_node+0x18a/0x2d0 mm/slub.c:3466
 __alloc_skb+0xcc/0x2d0 net/core/skbuff.c:505
 alloc_skb include/linux/skbuff.h:1283 [inline]
 nlmsg_new include/net/netlink.h:991 [inline]
 rtmsg_ifa+0x1e7/0x3a0 net/ipv4/devinet.c:1906
 __inet_insert_ifa+0x8e7/0xb10 net/ipv4/devinet.c:553

Memory state around the buggy address:
 ffff88811821a200: 00 00 00 00 fc fc fc fc 00 00 00 00 fc fc fc fc
 ffff88811821a280: 00 00 00 00 fc fc fc fc 00 00 00 00 fc fc fc fc
>ffff88811821a300: fa fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
                   ^
 ffff88811821a380: 00 00 00 00 fc fc fc fc fb fb fb fb fc fc fc fc
 ffff88811821a400: 00 00 00 00 fc fc fc fc 00 00 00 00 fc fc fc fc
==================================================================

Crashes (6):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/12/28 00:58 android14-6.1 401a2769d990 fb427a07 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-6-1 KASAN: use-after-free Read in dev_uevent
2023/10/23 08:57 android14-6.1 53771c1826da 361b23dc .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-6-1 KASAN: use-after-free Read in dev_uevent
2023/10/02 02:55 android14-6.1 52824b718cd0 8e26a358 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-6-1 KASAN: use-after-free Read in dev_uevent
2023/08/09 11:35 android14-6.1 960d9828eee1 8ad1a287 .config console log report info ci2-android-6-1 KASAN: use-after-free Read in dev_uevent
2023/07/31 05:17 android14-6.1 d3b37a712ab7 2a0d0f29 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-6-1 KASAN: use-after-free Read in dev_uevent
2023/07/10 12:34 android14-6.1 0a2e9dd65c6b d47e94ee .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-6-1 KASAN: use-after-free Read in dev_uevent
* Struck through repros no longer work on HEAD.