syzbot


KASAN: use-after-free Read in dev_get_by_index_rcu

Status: auto-obsoleted due to no activity on 2024/10/10 04:32
Reported-by: syzbot+c7ed2721b1ce11d3c75d@syzkaller.appspotmail.com
First crash: 134d, last: 134d
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in dev_get_by_index_rcu net 1 1738d 1738d 15/28 fixed on 2020/04/15 17:19
android-54 KASAN: use-after-free Read in dev_get_by_index_rcu 1 1708d 1708d 0/2 auto-closed as invalid on 2020/07/19 03:31
upstream general protection fault in dev_get_by_index_rcu (2) bpf net C error 18 1051d 1051d 20/28 fixed on 2022/03/08 16:11

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in dev_index_hash net/core/dev.c:219 [inline]
BUG: KASAN: use-after-free in dev_get_by_index_rcu+0x3d/0x110 net/core/dev.c:962
Read of size 8 at addr ffff88811ed83af0 by task kworker/1:3/308

CPU: 1 PID: 308 Comm: kworker/1:3 Not tainted 5.10.218-syzkaller-00638-g3feee789f446 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/07/2024
Workqueue: events cleanup_bearer
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack_lvl+0x1e2/0x24b lib/dump_stack.c:118
 print_address_description+0x81/0x3b0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:435 [inline]
 kasan_report+0x179/0x1c0 mm/kasan/report.c:452
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report_generic.c:309
 dev_index_hash net/core/dev.c:219 [inline]
 dev_get_by_index_rcu+0x3d/0x110 net/core/dev.c:962
 inetdev_by_index+0x22/0x70 net/ipv4/devinet.c:594
 ip_mc_drop_socket+0xf7/0x380 net/ipv4/igmp.c:2701
 inet_release+0x95/0x200 net/ipv4/af_inet.c:421
 __sock_release net/socket.c:597 [inline]
 sock_release+0x7e/0x140 net/socket.c:625
 udp_tunnel_sock_release+0x76/0x80 net/ipv4/udp_tunnel_core.c:199
 cleanup_bearer+0x2b1/0x300 net/tipc/udp_media.c:811
 process_one_work+0x6dc/0xbd0 kernel/workqueue.c:2301
 worker_thread+0xaea/0x1510 kernel/workqueue.c:2447
 kthread+0x34b/0x3d0 kernel/kthread.c:313
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298

Allocated by task 829:
 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:430 [inline]
 __kasan_slab_alloc+0xb1/0xe0 mm/kasan/common.c:463
 kasan_slab_alloc include/linux/kasan.h:244 [inline]
 slab_post_alloc_hook+0x61/0x2f0 mm/slab.h:583
 slab_alloc_node mm/slub.c:2947 [inline]
 slab_alloc mm/slub.c:2955 [inline]
 kmem_cache_alloc+0x168/0x2e0 mm/slub.c:2960
 kmem_cache_zalloc include/linux/slab.h:654 [inline]
 net_alloc net/core/net_namespace.c:421 [inline]
 copy_net_ns+0x140/0x520 net/core/net_namespace.c:473
 create_new_namespaces+0x410/0x660 kernel/nsproxy.c:110
 unshare_nsproxy_namespaces+0x126/0x180 kernel/nsproxy.c:231
 ksys_unshare+0x54c/0x9a0 kernel/fork.c:3080
 __do_sys_unshare kernel/fork.c:3148 [inline]
 __se_sys_unshare kernel/fork.c:3146 [inline]
 __x64_sys_unshare+0x38/0x40 kernel/fork.c:3146
 do_syscall_64+0x34/0x70
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

Freed by task 686:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:45
 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:370
 ____kasan_slab_free+0x121/0x160 mm/kasan/common.c:362
 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:370
 kasan_slab_free include/linux/kasan.h:220 [inline]
 slab_free_hook mm/slub.c:1595 [inline]
 slab_free_freelist_hook+0xc0/0x190 mm/slub.c:1621
 slab_free mm/slub.c:3203 [inline]
 kmem_cache_free+0xa9/0x1e0 mm/slub.c:3219
 net_free net/core/net_namespace.c:449 [inline]
 net_drop_ns net/core/net_namespace.c:456 [inline]
 cleanup_net+0xbe7/0xcb0 net/core/net_namespace.c:630
 process_one_work+0x6dc/0xbd0 kernel/workqueue.c:2301
 worker_thread+0xaea/0x1510 kernel/workqueue.c:2447
 kthread+0x34b/0x3d0 kernel/kthread.c:313
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298

The buggy address belongs to the object at ffff88811ed839c0
 which belongs to the cache net_namespace of size 4672
The buggy address is located 304 bytes inside of
 4672-byte region [ffff88811ed839c0, ffff88811ed84c00)
The buggy address belongs to the page:
page:ffffea00047b6000 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88811ed84d00 pfn:0x11ed80
head:ffffea00047b6000 order:3 compound_mapcount:0 compound_pincount:0
flags: 0x4000000000010200(slab|head)
raw: 4000000000010200 dead000000000100 dead000000000122 ffff888107fe5500
raw: ffff88811ed84d00 0000000080060003 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 288, ts 28980140976, free_ts 0
 set_page_owner include/linux/page_owner.h:35 [inline]
 post_alloc_hook mm/page_alloc.c:2456 [inline]
 prep_new_page+0x166/0x180 mm/page_alloc.c:2462
 get_page_from_freelist+0x2d8c/0x2f30 mm/page_alloc.c:4254
 __alloc_pages_nodemask+0x435/0xaf0 mm/page_alloc.c:5348
 allocate_slab mm/slub.c:1808 [inline]
 new_slab+0x80/0x400 mm/slub.c:1869
 new_slab_objects mm/slub.c:2627 [inline]
 ___slab_alloc+0x302/0x4b0 mm/slub.c:2791
 __slab_alloc+0x63/0xa0 mm/slub.c:2831
 slab_alloc_node mm/slub.c:2913 [inline]
 slab_alloc mm/slub.c:2955 [inline]
 kmem_cache_alloc+0x1b9/0x2e0 mm/slub.c:2960
 kmem_cache_zalloc include/linux/slab.h:654 [inline]
 net_alloc net/core/net_namespace.c:421 [inline]
 copy_net_ns+0x140/0x520 net/core/net_namespace.c:473
 create_new_namespaces+0x410/0x660 kernel/nsproxy.c:110
 unshare_nsproxy_namespaces+0x126/0x180 kernel/nsproxy.c:231
 ksys_unshare+0x54c/0x9a0 kernel/fork.c:3080
 __do_sys_unshare kernel/fork.c:3148 [inline]
 __se_sys_unshare kernel/fork.c:3146 [inline]
 __x64_sys_unshare+0x38/0x40 kernel/fork.c:3146
 do_syscall_64+0x34/0x70
 entry_SYSCALL_64_after_hwframe+0x61/0xcb
page_owner free stack trace missing

Memory state around the buggy address:
 ffff88811ed83980: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb
 ffff88811ed83a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88811ed83a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                             ^
 ffff88811ed83b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88811ed83b80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/07/12 04:29 android13-5.10-lts 3feee789f446 eaeb5c15 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: use-after-free Read in dev_get_by_index_rcu
* Struck through repros no longer work on HEAD.