syzbot


KASAN: slab-use-after-free Read in notifier_call_chain

Status: moderation: reported on 2024/12/30 13:31
Subsystems: kernel
[Documentation on labels]
Reported-by: syzbot+2b5f3b01d04e1cf99b0a@syzkaller.appspotmail.com
First crash: 9d11h, last: 9d11h
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in notifier_call_chain kernel C error 157 772d 778d 22/28 fixed on 2023/02/24 13:50

Sample crash report:
==================================================================
BUG: KASAN: slab-use-after-free in notifier_call_chain+0x88/0x3f0 kernel/notifier.c:75
Read of size 8 at addr ffff8880271298d0 by task init/29718

CPU: 0 UID: 0 PID: 29718 Comm: init Not tainted 6.13.0-rc4-syzkaller-00012-g9b2ffa6148b1 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:94 [inline]
 dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120
 print_address_description mm/kasan/report.c:378 [inline]
 print_report+0x169/0x550 mm/kasan/report.c:489
 kasan_report+0x143/0x180 mm/kasan/report.c:602
 notifier_call_chain+0x88/0x3f0 kernel/notifier.c:75
 blocking_notifier_call_chain+0x69/0x90 kernel/notifier.c:380
 kernel_shutdown_prepare kernel/reboot.c:299 [inline]
 kernel_power_off+0x1c/0xb0 kernel/reboot.c:702
 __do_sys_reboot kernel/reboot.c:777 [inline]
 __se_sys_reboot+0x509/0x590 kernel/reboot.c:722
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fae141168b4
Code: f0 ff ff 73 01 c3 48 8b 0d 71 55 0d 00 f7 d8 64 89 01 48 83 c8 ff c3 89 fa be 69 19 12 28 bf ad de e1 fe b8 a9 00 00 00 0f 05 <48> 3d 00 f0 ff ff 76 10 48 8b 15 45 55 0d 00 f7 d8 64 89 02 48 83
RSP: 002b:00007ffcacaef898 EFLAGS: 00000246 ORIG_RAX: 00000000000000a9
RAX: ffffffffffffffda RBX: 000000000000000c RCX: 00007fae141168b4
RDX: 000000004321fedc RSI: 0000000028121969 RDI: 00000000fee1dead
RBP: 000000004321fedc R08: 0000000000000000 R09: 0000000000000000
R10: 00007ffcacaef870 R11: 0000000000000246 R12: 00007fae142bd4a0
R13: 00007ffcacaef8f8 R14: 00005590b3474169 R15: 00007fae142f4a80
 </TASK>

Allocated by task 29550:
 kasan_save_stack mm/kasan/common.c:47 [inline]
 kasan_save_track+0x3f/0x80 mm/kasan/common.c:68
 poison_kmalloc_redzone mm/kasan/common.c:377 [inline]
 __kasan_kmalloc+0x98/0xb0 mm/kasan/common.c:394
 kasan_kmalloc include/linux/kasan.h:260 [inline]
 __kmalloc_cache_noprof+0x243/0x390 mm/slub.c:4329
 kmalloc_noprof include/linux/slab.h:901 [inline]
 audit_log_d_path+0xbb/0x310 kernel/audit.c:2149
 audit_log_d_path_exe+0x42/0x70 kernel/audit.c:2220
 audit_log_task+0x254/0x320 kernel/auditsc.c:2962
 audit_seccomp+0x7b/0x1f0 kernel/auditsc.c:3009
 seccomp_log kernel/seccomp.c:1016 [inline]
 __seccomp_filter+0xb38/0x1fe0 kernel/seccomp.c:1305
 syscall_trace_enter+0xa8/0x150 kernel/entry/common.c:52
 syscall_enter_from_user_mode_work include/linux/entry-common.h:169 [inline]
 syscall_enter_from_user_mode include/linux/entry-common.h:199 [inline]
 do_syscall_64+0xcc/0x230 arch/x86/entry/common.c:79
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Freed by task 29550:
 kasan_save_stack mm/kasan/common.c:47 [inline]
 kasan_save_track+0x3f/0x80 mm/kasan/common.c:68
 kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:582
 poison_slab_object mm/kasan/common.c:247 [inline]
 __kasan_slab_free+0x59/0x70 mm/kasan/common.c:264
 kasan_slab_free include/linux/kasan.h:233 [inline]
 slab_free_hook mm/slub.c:2353 [inline]
 slab_free mm/slub.c:4613 [inline]
 kfree+0x196/0x430 mm/slub.c:4761
 audit_log_d_path_exe+0x42/0x70 kernel/audit.c:2220
 audit_log_task+0x254/0x320 kernel/auditsc.c:2962
 audit_seccomp+0x7b/0x1f0 kernel/auditsc.c:3009
 seccomp_log kernel/seccomp.c:1016 [inline]
 __seccomp_filter+0xb38/0x1fe0 kernel/seccomp.c:1305
 syscall_trace_enter+0xa8/0x150 kernel/entry/common.c:52
 syscall_enter_from_user_mode_work include/linux/entry-common.h:169 [inline]
 syscall_enter_from_user_mode include/linux/entry-common.h:199 [inline]
 do_syscall_64+0xcc/0x230 arch/x86/entry/common.c:79
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

The buggy address belongs to the object at ffff888027128000
 which belongs to the cache kmalloc-8k of size 8192
The buggy address is located 6352 bytes inside of
 freed 8192-byte region [ffff888027128000, ffff88802712a000)

The buggy address belongs to the physical page:
page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x27128
head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 00fff00000000040 ffff88801ac42280 dead000000000100 dead000000000122
raw: 0000000000000000 0000000000020002 00000001f5000000 0000000000000000
head: 00fff00000000040 ffff88801ac42280 dead000000000100 dead000000000122
head: 0000000000000000 0000000000020002 00000001f5000000 0000000000000000
head: 00fff00000000003 ffffea00009c4a01 ffffffffffffffff 0000000000000000
head: 0000000000000008 0000000000000000 00000000ffffffff 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 5487, tgid 5487 (dhcpcd), ts 462188508325, free_ts 462056668507
 set_page_owner include/linux/page_owner.h:32 [inline]
 post_alloc_hook+0x1f3/0x230 mm/page_alloc.c:1558
 prep_new_page mm/page_alloc.c:1566 [inline]
 get_page_from_freelist+0x3651/0x37a0 mm/page_alloc.c:3476
 __alloc_pages_noprof+0x292/0x710 mm/page_alloc.c:4753
 alloc_pages_mpol_noprof+0x3e8/0x680 mm/mempolicy.c:2269
 alloc_slab_page+0x6a/0x110 mm/slub.c:2423
 allocate_slab+0x5a/0x2b0 mm/slub.c:2589
 new_slab mm/slub.c:2642 [inline]
 ___slab_alloc+0xc27/0x14a0 mm/slub.c:3830
 __slab_alloc+0x58/0xa0 mm/slub.c:3920
 __slab_alloc_node mm/slub.c:3995 [inline]
 slab_alloc_node mm/slub.c:4156 [inline]
 __do_kmalloc_node mm/slub.c:4297 [inline]
 __kmalloc_node_track_caller_noprof+0x2e9/0x4c0 mm/slub.c:4317
 kmalloc_reserve+0x111/0x2a0 net/core/skbuff.c:609
 __alloc_skb+0x1f3/0x440 net/core/skbuff.c:678
 alloc_skb include/linux/skbuff.h:1323 [inline]
 nlmsg_new include/net/netlink.h:1018 [inline]
 nl80211_get_wiphy+0xc1/0x2c0 net/wireless/nl80211.c:3263
 genl_family_rcv_msg_doit net/netlink/genetlink.c:1115 [inline]
 genl_family_rcv_msg net/netlink/genetlink.c:1195 [inline]
 genl_rcv_msg+0xb14/0xec0 net/netlink/genetlink.c:1210
 netlink_rcv_skb+0x1e3/0x430 net/netlink/af_netlink.c:2542
 genl_rcv+0x28/0x40 net/netlink/genetlink.c:1219
 netlink_unicast_kernel net/netlink/af_netlink.c:1321 [inline]
 netlink_unicast+0x7f6/0x990 net/netlink/af_netlink.c:1347
page last free pid 5816 tgid 5816 stack trace:
 reset_page_owner include/linux/page_owner.h:25 [inline]
 free_pages_prepare mm/page_alloc.c:1127 [inline]
 free_unref_page+0xd2c/0x1000 mm/page_alloc.c:2659
 discard_slab mm/slub.c:2688 [inline]
 __put_partials+0x160/0x1c0 mm/slub.c:3157
 put_cpu_partial+0x17c/0x250 mm/slub.c:3232
 __slab_free+0x290/0x380 mm/slub.c:4483
 qlink_free mm/kasan/quarantine.c:163 [inline]
 qlist_free_all+0x9a/0x140 mm/kasan/quarantine.c:179
 kasan_quarantine_reduce+0x14f/0x170 mm/kasan/quarantine.c:286
 __kasan_slab_alloc+0x23/0x80 mm/kasan/common.c:329
 kasan_slab_alloc include/linux/kasan.h:250 [inline]
 slab_post_alloc_hook mm/slub.c:4119 [inline]
 slab_alloc_node mm/slub.c:4168 [inline]
 __do_kmalloc_node mm/slub.c:4297 [inline]
 __kmalloc_noprof+0x236/0x4c0 mm/slub.c:4310
 kmalloc_noprof include/linux/slab.h:905 [inline]
 inotify_handle_inode_event+0x1c9/0x530 fs/notify/inotify/inotify_fsnotify.c:96
 fsnotify_handle_event fs/notify/fsnotify.c:353 [inline]
 send_to_group fs/notify/fsnotify.c:401 [inline]
 fsnotify+0x1948/0x1f70 fs/notify/fsnotify.c:610
 __fsnotify_parent+0x3e5/0x5e0 fs/notify/fsnotify.c:264
 fsnotify_parent include/linux/fsnotify.h:96 [inline]
 fsnotify_file include/linux/fsnotify.h:131 [inline]
 fsnotify_close include/linux/fsnotify.h:412 [inline]
 __fput+0x79d/0xa50 fs/file_table.c:436
 __do_sys_close fs/open.c:1554 [inline]
 __se_sys_close fs/open.c:1539 [inline]
 __x64_sys_close+0x7f/0x110 fs/open.c:1539
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Memory state around the buggy address:
 ffff888027129780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888027129800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888027129880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                 ^
 ffff888027129900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888027129980: 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/12/26 13:23 upstream 9b2ffa6148b1 d3ccff63 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root KASAN: slab-use-after-free Read in notifier_call_chain
* Struck through repros no longer work on HEAD.