syzbot


KASAN: slab-out-of-bounds Write in try_module_get

Status: premoderation: reported on 2025/05/03 17:24
Reported-by: syzbot+f312428775d295764222@syzkaller.appspotmail.com
First crash: 65d, last: 4d04h
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: slab-out-of-bounds Write in try_module_get modules 2 52d 83d 0/29 moderation: reported on 2025/04/15 15:23

Sample crash report:
==================================================================
BUG: KASAN: slab-out-of-bounds in instrument_atomic_read_write include/linux/instrumented.h:101 [inline]
BUG: KASAN: slab-out-of-bounds in atomic_inc_not_zero include/asm-generic/atomic-instrumented.h:798 [inline]
BUG: KASAN: slab-out-of-bounds in try_module_get+0x56/0x180 kernel/module.c:1142
Write of size 4 at addr ffff8881096279a8 by task syz.1.19261/26232

CPU: 0 PID: 26232 Comm: syz.1.19261 Tainted: G        W         5.10.238-syzkaller-00008-g59e9a7228857 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
Call Trace:
 __dump_stack+0x21/0x24 lib/dump_stack.c:77
 dump_stack_lvl+0x169/0x1d8 lib/dump_stack.c:118
 print_address_description+0x7f/0x2c0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:435 [inline]
 kasan_report+0xe2/0x130 mm/kasan/report.c:452
 check_region_inline mm/kasan/generic.c:-1 [inline]
 kasan_check_range+0x280/0x290 mm/kasan/generic.c:189
 __kasan_check_write+0x14/0x20 mm/kasan/shadow.c:37
 instrument_atomic_read_write include/linux/instrumented.h:101 [inline]
 atomic_inc_not_zero include/asm-generic/atomic-instrumented.h:798 [inline]
 try_module_get+0x56/0x180 kernel/module.c:1142
 get_disk_and_module block/genhd.c:1790 [inline]
 exact_lock+0x6a/0xc0 block/genhd.c:677
 kobj_lookup+0x298/0x430 drivers/base/map.c:119
 get_gendisk+0xe9/0x340 block/genhd.c:1001
 bdev_get_gendisk fs/block_dev.c:1110 [inline]
 __blkdev_get+0x1b0/0x12f0 fs/block_dev.c:1474
 blkdev_get fs/block_dev.c:1653 [inline]
 blkdev_open+0x208/0x430 fs/block_dev.c:1770
 do_dentry_open+0x793/0x1090 fs/open.c:819
 vfs_open+0x73/0x80 fs/open.c:942
 do_open fs/namei.c:3391 [inline]
 path_openat+0x27ad/0x3160 fs/namei.c:3509
 do_filp_open+0x1b3/0x3e0 fs/namei.c:3536
 do_sys_openat2+0x14c/0x6d0 fs/open.c:1217
 do_sys_open fs/open.c:1233 [inline]
 __do_sys_creat fs/open.c:1309 [inline]
 __se_sys_creat fs/open.c:1303 [inline]
 __x64_sys_creat+0x8e/0xb0 fs/open.c:1303
 do_syscall_64+0x31/0x40 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7f70d7fe9929
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 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f70d6652038 EFLAGS: 00000246 ORIG_RAX: 0000000000000055
RAX: ffffffffffffffda RBX: 00007f70d8210fa0 RCX: 00007f70d7fe9929
RDX: 0000000000000000 RSI: 0000000000000008 RDI: 0000200000000180
RBP: 00007f70d806bb39 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f70d8210fa0 R15: 00007fffcf4424f8

Allocated by task 9044:
 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_kmalloc mm/kasan/common.c:509 [inline]
 __kasan_kmalloc+0xda/0x110 mm/kasan/common.c:518
 kasan_kmalloc include/linux/kasan.h:254 [inline]
 __kmalloc+0x1a7/0x330 mm/slub.c:4033
 kmalloc include/linux/slab.h:557 [inline]
 kzalloc include/linux/slab.h:664 [inline]
 __register_sysctl_table+0xeb/0x1250 fs/proc/proc_sysctl.c:1319
 register_net_sysctl+0x2c/0x40 net/sysctl_net.c:121
 __addrconf_sysctl_register+0x26e/0x3d0 net/ipv6/addrconf.c:7049
 addrconf_sysctl_register+0x147/0x1a0 net/ipv6/addrconf.c:7096
 ipv6_add_dev+0xbaf/0x10a0 net/ipv6/addrconf.c:448
 ipv6_find_idev net/ipv6/addrconf.c:484 [inline]
 inet6_rtm_newaddr+0x446/0x930 net/ipv6/addrconf.c:4938
 rtnetlink_rcv_msg+0x9db/0xb90 net/core/rtnetlink.c:5610
 netlink_rcv_skb+0x1e0/0x430 net/netlink/af_netlink.c:2485
 rtnetlink_rcv+0x1c/0x20 net/core/rtnetlink.c:5628
 netlink_unicast_kernel net/netlink/af_netlink.c:1307 [inline]
 netlink_unicast+0x87c/0xa40 net/netlink/af_netlink.c:1333
 netlink_sendmsg+0x88d/0xb30 net/netlink/af_netlink.c:1901
 sock_sendmsg_nosec net/socket.c:652 [inline]
 __sock_sendmsg net/socket.c:664 [inline]
 __sys_sendto+0x41d/0x580 net/socket.c:2006
 __do_sys_sendto net/socket.c:2018 [inline]
 __se_sys_sendto net/socket.c:2014 [inline]
 __x64_sys_sendto+0xe5/0x100 net/socket.c:2014
 do_syscall_64+0x31/0x40 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

Last potentially related work creation:
 kasan_save_stack+0x3a/0x60 mm/kasan/common.c:38
 __kasan_record_aux_stack+0xd2/0x100 mm/kasan/generic.c:348
 kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:358
 kvfree_call_rcu+0x10c/0x620 kernel/rcu/tree.c:3535
 drop_sysctl_table+0x2ef/0x410 fs/proc/proc_sysctl.c:1680
 unregister_sysctl_table+0x75/0x120 fs/proc/proc_sysctl.c:1718
 unregister_net_sysctl_table+0x15/0x20 net/sysctl_net.c:127
 __devinet_sysctl_unregister net/ipv4/devinet.c:2622 [inline]
 devinet_sysctl_unregister net/ipv4/devinet.c:2650 [inline]
 inetdev_destroy net/ipv4/devinet.c:326 [inline]
 inetdev_event+0x79d/0x1030 net/ipv4/devinet.c:1613
 notifier_call_chain kernel/notifier.c:83 [inline]
 raw_notifier_call_chain+0x90/0x100 kernel/notifier.c:410
 call_netdevice_notifiers_info net/core/dev.c:2054 [inline]
 call_netdevice_notifiers_extack net/core/dev.c:2066 [inline]
 call_netdevice_notifiers net/core/dev.c:2080 [inline]
 unregister_netdevice_many+0xf8b/0x1980 net/core/dev.c:10767
 ip_tunnel_delete_nets+0x343/0x390 net/ipv4/ip_tunnel.c:1136
 erspan_exit_batch_net+0x22/0x30 net/ipv4/ip_gre.c:1724
 ops_exit_list net/core/net_namespace.c:190 [inline]
 cleanup_net+0x5fb/0xb70 net/core/net_namespace.c:609
 process_one_work+0x6e1/0xba0 kernel/workqueue.c:2301
 worker_thread+0xa6a/0x13b0 kernel/workqueue.c:2447
 kthread+0x346/0x3d0 kernel/kthread.c:313
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298

Second to last potentially related work creation:
 kasan_save_stack+0x3a/0x60 mm/kasan/common.c:38
 __kasan_record_aux_stack+0xd2/0x100 mm/kasan/generic.c:348
 kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:358
 insert_work+0x52/0x310 kernel/workqueue.c:1352
 __queue_work+0x923/0xca0 kernel/workqueue.c:1518
 __queue_delayed_work+0x188/0x200 kernel/workqueue.c:1672
 mod_delayed_work_on+0x7b/0xd0 kernel/workqueue.c:1746
 mod_delayed_work include/linux/workqueue.h:545 [inline]
 wb_shutdown+0x164/0x1b0 mm/backing-dev.c:351
 bdi_unregister+0x15e/0x4f0 mm/backing-dev.c:880
 generic_shutdown_super+0x2c4/0x320 fs/super.c:480
 kill_anon_super+0x3a/0x70 fs/super.c:1131
 v9fs_kill_super+0x4c/0x90 fs/9p/vfs_super.c:221
 deactivate_locked_super+0xa0/0x100 fs/super.c:335
 deactivate_super+0xaf/0xe0 fs/super.c:366
 cleanup_mnt+0x446/0x500 fs/namespace.c:1114
 __cleanup_mnt+0x19/0x20 fs/namespace.c:1121
 task_work_run+0x127/0x190 kernel/task_work.c:189
 tracehook_notify_resume include/linux/tracehook.h:188 [inline]
 exit_to_user_mode_loop+0xcb/0xe0 kernel/entry/common.c:172
 exit_to_user_mode_prepare kernel/entry/common.c:199 [inline]
 syscall_exit_to_user_mode+0x68/0x90 kernel/entry/common.c:274
 do_syscall_64+0x3d/0x40 arch/x86/entry/common.c:56
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

The buggy address belongs to the object at ffff888109627000
 which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 424 bytes to the right of
 2048-byte region [ffff888109627000, ffff888109627800)
The buggy address belongs to the page:
page:ffffea0004258800 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x109620
head:ffffea0004258800 order:3 compound_mapcount:0 compound_pincount:0
flags: 0x4000000000010200(slab|head)
raw: 4000000000010200 0000000000000000 0000000100000001 ffff888100042d80
raw: 0000000000000000 0000000000080008 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 1, ts 1863124312, 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+0x179/0x180 mm/page_alloc.c:2462
 get_page_from_freelist+0x2235/0x23d0 mm/page_alloc.c:4254
 __alloc_pages_nodemask+0x268/0x5f0 mm/page_alloc.c:5357
 alloc_slab_page mm/slub.c:-1 [inline]
 allocate_slab mm/slub.c:1808 [inline]
 new_slab+0x84/0x3f0 mm/slub.c:1869
 new_slab_objects mm/slub.c:2627 [inline]
 ___slab_alloc+0x2a6/0x450 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_trace+0x1b3/0x2e0 mm/slub.c:2972
 kmem_cache_alloc_node_trace include/linux/slab.h:440 [inline]
 kmalloc_node include/linux/slab.h:570 [inline]
 kzalloc_node include/linux/slab.h:675 [inline]
 __alloc_disk_node+0x79/0x580 block/genhd.c:1727
 loop_add+0x33f/0x7b0 drivers/block/loop.c:2158
 loop_init+0x1bf/0x1ff drivers/block/loop.c:2403
 do_one_initcall+0x187/0x510 init/main.c:1197
 do_initcall_level+0x16f/0x2cf init/main.c:1270
 do_initcalls+0x50/0x92 init/main.c:1286
 do_basic_setup+0x88/0x8f init/main.c:1306
 kernel_init_freeable+0x287/0x3be init/main.c:1510
 kernel_init+0x11/0x1a0 init/main.c:1397
page_owner free stack trace missing

Memory state around the buggy address:
 ffff888109627880: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888109627900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888109627980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                                  ^
 ffff888109627a00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888109627a80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (9):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/07/03 14:26 android13-5.10-lts 59e9a7228857 115ceea7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: slab-out-of-bounds Write in try_module_get
2025/06/28 14:43 android13-5.10-lts 59e9a7228857 fc9d8ee5 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: slab-out-of-bounds Write in try_module_get
2025/06/22 02:28 android13-5.10-lts d76d4cd0623a d6cdfb8a .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: slab-out-of-bounds Write in try_module_get
2025/06/21 22:43 android13-5.10-lts d76d4cd0623a d6cdfb8a .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: slab-out-of-bounds Write in try_module_get
2025/06/17 01:36 android13-5.10-lts d76d4cd0623a cfebc887 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: slab-out-of-bounds Write in try_module_get
2025/06/16 08:29 android13-5.10-lts d76d4cd0623a 5f4b362d .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: slab-out-of-bounds Write in try_module_get
2025/06/15 19:41 android13-5.10-lts d76d4cd0623a 5f4b362d .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: slab-out-of-bounds Write in try_module_get
2025/05/05 09:33 android13-5.10-lts ab07aeb2c93d b0714e37 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: slab-out-of-bounds Write in try_module_get
2025/05/03 17:23 android13-5.10-lts ab07aeb2c93d b0714e37 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: slab-out-of-bounds Write in try_module_get
* Struck through repros no longer work on HEAD.