==================================================================
BUG: KASAN: slab-use-after-free in advance_sched+0xc20/0xca0 net/sched/sch_taprio.c:942
Read of size 8 at addr ffff88802effe510 by task syz-executor.0/5077
CPU: 0 PID: 5077 Comm: syz-executor.0 Not tainted 6.8.0-syzkaller-05271-gf99c5f563c17 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
Call Trace:
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e7/0x2e0 lib/dump_stack.c:106
print_address_description mm/kasan/report.c:377 [inline]
print_report+0x169/0x550 mm/kasan/report.c:488
kasan_report+0x143/0x180 mm/kasan/report.c:601
advance_sched+0xc20/0xca0 net/sched/sch_taprio.c:942
__run_hrtimer kernel/time/hrtimer.c:1692 [inline]
__hrtimer_run_queues+0x595/0xd00 kernel/time/hrtimer.c:1756
hrtimer_interrupt+0x396/0x990 kernel/time/hrtimer.c:1818
local_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1032 [inline]
__sysvec_apic_timer_interrupt+0x107/0x3a0 arch/x86/kernel/apic/apic.c:1049
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1043 [inline]
sysvec_apic_timer_interrupt+0xa1/0xc0 arch/x86/kernel/apic/apic.c:1043
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702
RIP: 0010:should_resched arch/x86/include/asm/preempt.h:103 [inline]
RIP: 0010:unwind_next_frame+0x1e6c/0x2a00 arch/x86/kernel/unwind_orc.c:672
Code: 00 e9 06 fd ff ff e8 b3 42 54 00 eb 0c e8 ac 42 54 00 eb 05 e8 a5 42 54 00 bf 01 00 00 00 e8 5b 3e 24 00 65 8b 1d ac 20 c3 7e <31> ff 89 de e8 cb 46 54 00 85 db 0f 84 9d 02 00 00 e8 7e 42 54 00
RSP: 0018:ffffc900042def08 EFLAGS: 00000297
RAX: 0000000080000001 RBX: 0000000080000000 RCX: 0000000000000001
RDX: 0000000000000000 RSI: ffffc900042df610 RDI: 0000000000000001
RBP: ffffc900042defe0 R08: ffffffff8140ad65 R09: ffffffff8140a8df
R10: 0000000000000003 R11: ffff8880221a5a00 R12: ffffc900042df640
R13: dffffc0000000000 R14: ffffc900042d8000 R15: ffffc900042df648
arch_stack_walk+0x151/0x1b0 arch/x86/kernel/stacktrace.c:25
stack_trace_save+0x118/0x1d0 kernel/stacktrace.c:122
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:370 [inline]
__kasan_kmalloc+0x98/0xb0 mm/kasan/common.c:387
kasan_kmalloc include/linux/kasan.h:211 [inline]
__do_kmalloc_node mm/slub.c:3981 [inline]
__kmalloc_node+0x251/0x4e0 mm/slub.c:3988
kmalloc_node include/linux/slab.h:610 [inline]
__vmalloc_area_node mm/vmalloc.c:3197 [inline]
__vmalloc_node_range+0x5f9/0x14a0 mm/vmalloc.c:3392
__vmalloc_node mm/vmalloc.c:3457 [inline]
vzalloc+0x79/0x90 mm/vmalloc.c:3530
alloc_counters+0xd7/0x760 net/ipv4/netfilter/ip_tables.c:799
copy_entries_to_user net/ipv4/netfilter/ip_tables.c:821 [inline]
get_entries net/ipv4/netfilter/ip_tables.c:1022 [inline]
do_ipt_get_ctl+0xecc/0x1810 net/ipv4/netfilter/ip_tables.c:1660
nf_getsockopt+0x299/0x2c0 net/netfilter/nf_sockopt.c:116
ip_getsockopt+0x222/0x2e0 net/ipv4/ip_sockglue.c:1777
tcp_getsockopt+0x163/0x1c0 net/ipv4/tcp.c:4373
do_sock_getsockopt+0x373/0x850 net/socket.c:2373
__sys_getsockopt+0x271/0x330 net/socket.c:2402
__do_sys_getsockopt net/socket.c:2412 [inline]
__se_sys_getsockopt net/socket.c:2409 [inline]
__x64_sys_getsockopt+0xb5/0xd0 net/socket.c:2409
do_syscall_64+0xfb/0x240
entry_SYSCALL_64_after_hwframe+0x6d/0x75
RIP: 0033:0x7fe9b8e7fa0a
Code: c4 c1 e0 1a 0d 00 00 04 00 89 01 e9 e0 fe ff ff e8 3b 05 00 00 66 2e 0f 1f 84 00 00 00 00 00 90 49 89 ca b8 37 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 06 c3 0f 1f 44 00 00 48 c7 c2 b0 ff ff ff f7
RSP: 002b:00007ffde2ad7568 EFLAGS: 00000202 ORIG_RAX: 0000000000000037
RAX: ffffffffffffffda RBX: 00007ffde2ad75f0 RCX: 00007fe9b8e7fa0a
RDX: 0000000000000041 RSI: 0000000000000000 RDI: 0000000000000003
RBP: 0000000000000003 R08: 00007ffde2ad758c R09: 00007ffde2ad79a7
R10: 00007ffde2ad75f0 R11: 0000000000000202 R12: 00007fe9b8f7d3c0
R13: 00007ffde2ad758c R14: 0000000000000000 R15: 00007fe9b8f7eec0
Allocated by task 15348:
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:370 [inline]
__kasan_kmalloc+0x98/0xb0 mm/kasan/common.c:387
kasan_kmalloc include/linux/kasan.h:211 [inline]
kmalloc_trace+0x1d9/0x360 mm/slub.c:4012
kmalloc include/linux/slab.h:590 [inline]
kzalloc include/linux/slab.h:711 [inline]
taprio_change+0x1030/0x42d0 net/sched/sch_taprio.c:1862
qdisc_change net/sched/sch_api.c:1416 [inline]
tc_modify_qdisc+0x190d/0x1e40 net/sched/sch_api.c:1746
rtnetlink_rcv_msg+0x89b/0x10d0 net/core/rtnetlink.c:6595
netlink_rcv_skb+0x1e3/0x430 net/netlink/af_netlink.c:2559
netlink_unicast_kernel net/netlink/af_netlink.c:1335 [inline]
netlink_unicast+0x7ea/0x980 net/netlink/af_netlink.c:1361
netlink_sendmsg+0x8e1/0xcb0 net/netlink/af_netlink.c:1905
sock_sendmsg_nosec net/socket.c:730 [inline]
__sock_sendmsg+0x221/0x270 net/socket.c:745
____sys_sendmsg+0x525/0x7d0 net/socket.c:2584
___sys_sendmsg net/socket.c:2638 [inline]
__sys_sendmmsg+0x3b2/0x740 net/socket.c:2724
__do_sys_sendmmsg net/socket.c:2753 [inline]
__se_sys_sendmmsg net/socket.c:2750 [inline]
__x64_sys_sendmmsg+0xa0/0xb0 net/socket.c:2750
do_syscall_64+0xfb/0x240
entry_SYSCALL_64_after_hwframe+0x6d/0x75
Freed by task 15:
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:589
poison_slab_object+0xa6/0xe0 mm/kasan/common.c:240
__kasan_slab_free+0x37/0x60 mm/kasan/common.c:256
kasan_slab_free include/linux/kasan.h:184 [inline]
slab_free_hook mm/slub.c:2121 [inline]
slab_free mm/slub.c:4299 [inline]
kfree+0x14a/0x380 mm/slub.c:4409
rcu_do_batch kernel/rcu/tree.c:2196 [inline]
rcu_core+0xafd/0x1830 kernel/rcu/tree.c:2471
__do_softirq+0x2bc/0x943 kernel/softirq.c:554
Last potentially related work creation:
kasan_save_stack+0x3f/0x60 mm/kasan/common.c:47
__kasan_record_aux_stack+0xac/0xc0 mm/kasan/generic.c:551
__call_rcu_common kernel/rcu/tree.c:2734 [inline]
call_rcu+0x167/0xa70 kernel/rcu/tree.c:2838
taprio_change+0x32d9/0x42d0 net/sched/sch_taprio.c:1972
qdisc_change net/sched/sch_api.c:1416 [inline]
tc_modify_qdisc+0x190d/0x1e40 net/sched/sch_api.c:1746
rtnetlink_rcv_msg+0x89b/0x10d0 net/core/rtnetlink.c:6595
netlink_rcv_skb+0x1e3/0x430 net/netlink/af_netlink.c:2559
netlink_unicast_kernel net/netlink/af_netlink.c:1335 [inline]
netlink_unicast+0x7ea/0x980 net/netlink/af_netlink.c:1361
netlink_sendmsg+0x8e1/0xcb0 net/netlink/af_netlink.c:1905
sock_sendmsg_nosec net/socket.c:730 [inline]
__sock_sendmsg+0x221/0x270 net/socket.c:745
____sys_sendmsg+0x525/0x7d0 net/socket.c:2584
___sys_sendmsg net/socket.c:2638 [inline]
__sys_sendmmsg+0x3b2/0x740 net/socket.c:2724
__do_sys_sendmmsg net/socket.c:2753 [inline]
__se_sys_sendmmsg net/socket.c:2750 [inline]
__x64_sys_sendmmsg+0xa0/0xb0 net/socket.c:2750
do_syscall_64+0xfb/0x240
entry_SYSCALL_64_after_hwframe+0x6d/0x75
The buggy address belongs to the object at ffff88802effe400
which belongs to the cache kmalloc-512 of size 512
The buggy address is located 272 bytes inside of
freed 512-byte region [ffff88802effe400, ffff88802effe600)
The buggy address belongs to the physical page:
page:ffffea0000bbff00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x2effc
head:ffffea0000bbff00 order:2 entire_mapcount:0 nr_pages_mapped:0 pincount:0
anon flags: 0xfff00000000840(slab|head|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000000840 ffff888014c41c80 0000000000000000 dead000000000001
raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 2, migratetype Unmovable, gfp_mask 0xd2040(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 1, tgid 1 (swapper/0), ts 19084103476, free_ts 19083965234
set_page_owner include/linux/page_owner.h:31 [inline]
post_alloc_hook+0x1ea/0x210 mm/page_alloc.c:1533
prep_new_page mm/page_alloc.c:1540 [inline]
get_page_from_freelist+0x33ea/0x3580 mm/page_alloc.c:3311
__alloc_pages+0x256/0x680 mm/page_alloc.c:4569
__alloc_pages_node include/linux/gfp.h:238 [inline]
alloc_pages_node include/linux/gfp.h:261 [inline]
alloc_slab_page+0x5f/0x160 mm/slub.c:2190
allocate_slab mm/slub.c:2354 [inline]
new_slab+0x84/0x2f0 mm/slub.c:2407
___slab_alloc+0xd1b/0x13e0 mm/slub.c:3540
__slab_alloc mm/slub.c:3625 [inline]
__slab_alloc_node mm/slub.c:3678 [inline]
slab_alloc_node mm/slub.c:3850 [inline]
__do_kmalloc_node mm/slub.c:3980 [inline]
__kmalloc+0x2e3/0x4a0 mm/slub.c:3994
kmalloc include/linux/slab.h:594 [inline]
kzalloc include/linux/slab.h:711 [inline]
tomoyo_init_log+0x1b3e/0x2050 security/tomoyo/audit.c:275
tomoyo_write_log2+0x3e0/0x8e0 security/tomoyo/audit.c:376
tomoyo_supervisor+0x159/0x11f0 security/tomoyo/common.c:2065
tomoyo_audit_path_log security/tomoyo/file.c:168 [inline]
tomoyo_path_permission+0x243/0x360 security/tomoyo/file.c:587
tomoyo_path_perm+0x480/0x740 security/tomoyo/file.c:838
tomoyo_path_unlink+0xd0/0x110 security/tomoyo/tomoyo.c:162
security_path_unlink+0xe1/0x140 security/security.c:1852
do_unlinkat+0x3e6/0x830 fs/namei.c:4397
rd_load_image+0x440/0x660 init/do_mounts_rd.c:275
page last free pid 1 tgid 1 stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1140 [inline]
free_unref_page_prepare+0x968/0xa90 mm/page_alloc.c:2346
free_unref_page+0x37/0x3f0 mm/page_alloc.c:2486
stack_depot_save_flags+0x38f/0x860 lib/stackdepot.c:714
kasan_save_stack+0x4f/0x60 mm/kasan/common.c:48
__kasan_record_aux_stack+0xac/0xc0 mm/kasan/generic.c:551
task_work_add+0x8b/0x3a0 kernel/task_work.c:48
fput+0x11c/0x210 fs/file_table.c:483
rd_load_image+0x42c/0x660 init/do_mounts_rd.c:272
initrd_load+0x36/0xe0 init/do_mounts_initrd.c:147
prepare_namespace+0x87/0x100 init/do_mounts.c:487
kernel_init_freeable+0x476/0x5d0 init/main.c:1570
kernel_init+0x1d/0x2a0 init/main.c:1446
ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:243
Memory state around the buggy address:
ffff88802effe400: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88802effe480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88802effe500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88802effe580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88802effe600: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================
----------------
Code disassembly (best guess), 1 bytes skipped:
0: e9 06 fd ff ff jmp 0xfffffd0b
5: e8 b3 42 54 00 call 0x5442bd
a: eb 0c jmp 0x18
c: e8 ac 42 54 00 call 0x5442bd
11: eb 05 jmp 0x18
13: e8 a5 42 54 00 call 0x5442bd
18: bf 01 00 00 00 mov $0x1,%edi
1d: e8 5b 3e 24 00 call 0x243e7d
22: 65 8b 1d ac 20 c3 7e mov %gs:0x7ec320ac(%rip),%ebx # 0x7ec320d5
* 29: 31 ff xor %edi,%edi <-- trapping instruction
2b: 89 de mov %ebx,%esi
2d: e8 cb 46 54 00 call 0x5446fd
32: 85 db test %ebx,%ebx
34: 0f 84 9d 02 00 00 je 0x2d7
3a: e8 7e 42 54 00 call 0x5442bd