==================================================================
BUG: KASAN: slab-use-after-free in __rb_change_child include/linux/rbtree_augmented.h:199 [inline]
BUG: KASAN: slab-use-after-free in __rb_erase_augmented include/linux/rbtree_augmented.h:253 [inline]
BUG: KASAN: slab-use-after-free in rb_erase+0x2a8/0xe70 lib/rbtree.c:443
Read of size 8 at addr ffff888021753ed0 by task syz.3.23/5418
CPU: 0 UID: 0 PID: 5418 Comm: syz.3.23 Not tainted 6.11.0-rc4-next-20240820-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
Call Trace:
__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:377 [inline]
print_report+0x169/0x550 mm/kasan/report.c:488
kasan_report+0x143/0x180 mm/kasan/report.c:601
__rb_change_child include/linux/rbtree_augmented.h:199 [inline]
__rb_erase_augmented include/linux/rbtree_augmented.h:253 [inline]
rb_erase+0x2a8/0xe70 lib/rbtree.c:443
sched_core_dequeue kernel/sched/core.c:283 [inline]
dequeue_task+0x34d/0x550 kernel/sched/core.c:2031
detach_task kernel/sched/fair.c:9368 [inline]
detach_tasks kernel/sched/fair.c:9504 [inline]
sched_balance_rq+0x5d5b/0x8590 kernel/sched/fair.c:11648
sched_balance_domains+0x565/0xa90 kernel/sched/fair.c:12069
handle_softirqs+0x2c5/0x980 kernel/softirq.c:554
__do_softirq kernel/softirq.c:588 [inline]
invoke_softirq kernel/softirq.c:428 [inline]
__irq_exit_rcu+0xf4/0x1c0 kernel/softirq.c:637
irq_exit_rcu+0x9/0x30 kernel/softirq.c:649
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1037 [inline]
sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1037
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702
RIP: 0010:__sanitizer_cov_trace_pc+0x46/0x70 kernel/kcov.c:222
Code: ff 00 74 11 81 fa 00 01 00 00 75 35 83 b9 1c 16 00 00 00 74 2c 8b 91 f8 15 00 00 83 fa 02 75 21 48 8b 91 00 16 00 00 48 8b 32 <48> 8d 7e 01 8b 89 fc 15 00 00 48 39 cf 73 08 48 89 3a 48 89 44 f2
RSP: 0018:ffffc900048bf5d8 EFLAGS: 00000246
RAX: ffffffff89852b06 RBX: ffff8880607fa000 RCX: ffff8880658f5a00
RDX: ffffc9000a9f2000 RSI: 000000000003ffff RDI: ffff8880607fa000
RBP: ffffc900048bf6f0 R08: ffffc900048bf850 R09: ffffc900048bf800
R10: dffffc0000000000 R11: fffffbfff20318ee R12: 1ffff92000917f04
R13: 1ffff92000917ecc R14: dffffc0000000000 R15: ffff8880607fa0e8
__skb_try_recv_datagram+0x96/0x6a0 net/core/datagram.c:245
__unix_dgram_recvmsg+0x3ba/0x12f0 net/unix/af_unix.c:2442
sock_recvmsg_nosec+0x18e/0x1d0 net/socket.c:1046
____sys_recvmsg+0x3c0/0x470 net/socket.c:2814
___sys_recvmsg net/socket.c:2858 [inline]
do_recvmmsg+0x464/0xad0 net/socket.c:2952
__sys_recvmmsg net/socket.c:3031 [inline]
__do_sys_recvmmsg net/socket.c:3054 [inline]
__se_sys_recvmmsg net/socket.c:3047 [inline]
__x64_sys_recvmmsg+0x199/0x250 net/socket.c:3047
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:0x7f3d88d79e79
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:00007f3d887ff038 EFLAGS: 00000246 ORIG_RAX: 000000000000012b
RAX: ffffffffffffffda RBX: 00007f3d88f16058 RCX: 00007f3d88d79e79
RDX: 0000000000010106 RSI: 00000000200000c0 RDI: 0000000000000004
RBP: 00007f3d88de7916 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000002 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000001 R14: 00007f3d88f16058 R15: 00007fff30d24098
Allocated by task 5400:
kasan_save_stack mm/kasan/common.c:47 [inline]
kasan_save_track+0x3f/0x80 mm/kasan/common.c:68
unpoison_slab_object mm/kasan/common.c:319 [inline]
__kasan_slab_alloc+0x66/0x80 mm/kasan/common.c:345
kasan_slab_alloc include/linux/kasan.h:250 [inline]
slab_post_alloc_hook mm/slub.c:4036 [inline]
slab_alloc_node mm/slub.c:4085 [inline]
kmem_cache_alloc_node_noprof+0x16b/0x320 mm/slub.c:4128
alloc_task_struct_node kernel/fork.c:180 [inline]
dup_task_struct+0x57/0x8c0 kernel/fork.c:1107
copy_process+0x5d1/0x3d50 kernel/fork.c:2206
kernel_clone+0x226/0x8f0 kernel/fork.c:2787
__do_sys_clone3 kernel/fork.c:3091 [inline]
__se_sys_clone3+0x2cb/0x350 kernel/fork.c:3070
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
Freed by task 0:
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:579
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:2299 [inline]
slab_free mm/slub.c:4521 [inline]
kmem_cache_free+0x195/0x3d0 mm/slub.c:4623
put_task_struct include/linux/sched/task.h:139 [inline]
delayed_put_task_struct+0x125/0x300 kernel/exit.c:228
rcu_do_batch kernel/rcu/tree.c:2567 [inline]
rcu_core+0xaaa/0x17a0 kernel/rcu/tree.c:2823
handle_softirqs+0x2c5/0x980 kernel/softirq.c:554
__do_softirq kernel/softirq.c:588 [inline]
invoke_softirq kernel/softirq.c:428 [inline]
__irq_exit_rcu+0xf4/0x1c0 kernel/softirq.c:637
irq_exit_rcu+0x9/0x30 kernel/softirq.c:649
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1037 [inline]
sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1037
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702
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:541
__call_rcu_common kernel/rcu/tree.c:3086 [inline]
call_rcu+0x167/0xa70 kernel/rcu/tree.c:3190
context_switch kernel/sched/core.c:5314 [inline]
__schedule+0x1852/0x4b30 kernel/sched/core.c:6677
__schedule_loop kernel/sched/core.c:6754 [inline]
schedule+0x14b/0x320 kernel/sched/core.c:6769
futex_wait_queue+0x14e/0x1d0 kernel/futex/waitwake.c:370
__futex_wait+0x17f/0x320 kernel/futex/waitwake.c:669
futex_wait+0x101/0x360 kernel/futex/waitwake.c:697
do_futex+0x33b/0x560 kernel/futex/syscalls.c:102
__do_sys_futex kernel/futex/syscalls.c:179 [inline]
__se_sys_futex+0x3f9/0x480 kernel/futex/syscalls.c:160
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
The buggy address belongs to the object at ffff888021753c00
which belongs to the cache task_struct of size 7424
The buggy address is located 720 bytes inside of
freed 7424-byte region [ffff888021753c00, ffff888021755900)
The buggy address belongs to the physical page:
page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x21750
head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
memcg:ffff88802f6a9a81
anon flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xfdffffff(slab)
raw: 00fff00000000040 ffff8880166fb500 0000000000000000 0000000000000001
raw: 0000000000000000 0000000000040004 00000001fdffffff ffff88802f6a9a81
head: 00fff00000000040 ffff8880166fb500 0000000000000000 0000000000000001
head: 0000000000000000 0000000000040004 00000001fdffffff ffff88802f6a9a81
head: 00fff00000000003 ffffea000085d401 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 5212, tgid 5212 (sshd), ts 43068110290, free_ts 43039944558
set_page_owner include/linux/page_owner.h:32 [inline]
post_alloc_hook+0x1f3/0x230 mm/page_alloc.c:1517
prep_new_page mm/page_alloc.c:1525 [inline]
get_page_from_freelist+0x3004/0x30c0 mm/page_alloc.c:3476
__alloc_pages_noprof+0x29e/0x780 mm/page_alloc.c:4743
__alloc_pages_node_noprof include/linux/gfp.h:269 [inline]
alloc_pages_node_noprof include/linux/gfp.h:296 [inline]
alloc_slab_page+0x5f/0x120 mm/slub.c:2368
allocate_slab+0x5a/0x2f0 mm/slub.c:2531
new_slab mm/slub.c:2584 [inline]
___slab_alloc+0xcd1/0x14b0 mm/slub.c:3771
__slab_alloc+0x58/0xa0 mm/slub.c:3861
__slab_alloc_node mm/slub.c:3914 [inline]
slab_alloc_node mm/slub.c:4073 [inline]
kmem_cache_alloc_node_noprof+0x1fe/0x320 mm/slub.c:4128
alloc_task_struct_node kernel/fork.c:180 [inline]
dup_task_struct+0x57/0x8c0 kernel/fork.c:1107
copy_process+0x5d1/0x3d50 kernel/fork.c:2206
kernel_clone+0x226/0x8f0 kernel/fork.c:2787
__do_sys_clone kernel/fork.c:2930 [inline]
__se_sys_clone kernel/fork.c:2914 [inline]
__x64_sys_clone+0x258/0x2a0 kernel/fork.c:2914
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
page last free pid 5212 tgid 5212 stack trace:
reset_page_owner include/linux/page_owner.h:25 [inline]
free_pages_prepare mm/page_alloc.c:1098 [inline]
free_unref_page+0xc07/0xd90 mm/page_alloc.c:2651
discard_slab mm/slub.c:2630 [inline]
__put_partials+0xeb/0x130 mm/slub.c:3098
put_cpu_partial+0x17c/0x250 mm/slub.c:3173
__slab_free+0x2ea/0x3d0 mm/slub.c:4391
qlink_free mm/kasan/quarantine.c:163 [inline]
qlist_free_all+0x9e/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:4036 [inline]
slab_alloc_node mm/slub.c:4085 [inline]
__do_kmalloc_node mm/slub.c:4205 [inline]
__kmalloc_noprof+0x1a6/0x400 mm/slub.c:4218
kmalloc_noprof include/linux/slab.h:685 [inline]
tomoyo_add_entry security/tomoyo/common.c:2023 [inline]
tomoyo_supervisor+0xe0d/0x11f0 security/tomoyo/common.c:2095
tomoyo_audit_path_log security/tomoyo/file.c:168 [inline]
tomoyo_path_permission+0x243/0x360 security/tomoyo/file.c:587
tomoyo_check_open_permission+0x2fb/0x500 security/tomoyo/file.c:777
security_file_open+0x6a/0x750 security/security.c:2996
do_dentry_open+0x359/0x13f0 fs/open.c:946
vfs_open+0x3e/0x330 fs/open.c:1089
do_open fs/namei.c:3774 [inline]
path_openat+0x2c87/0x3590 fs/namei.c:3933
do_filp_open+0x235/0x490 fs/namei.c:3960
Memory state around the buggy address:
ffff888021753d80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888021753e00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888021753e80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888021753f00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888021753f80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
----------------
Code disassembly (best guess):
0: ff 00 incl (%rax)
2: 74 11 je 0x15
4: 81 fa 00 01 00 00 cmp $0x100,%edx
a: 75 35 jne 0x41
c: 83 b9 1c 16 00 00 00 cmpl $0x0,0x161c(%rcx)
13: 74 2c je 0x41
15: 8b 91 f8 15 00 00 mov 0x15f8(%rcx),%edx
1b: 83 fa 02 cmp $0x2,%edx
1e: 75 21 jne 0x41
20: 48 8b 91 00 16 00 00 mov 0x1600(%rcx),%rdx
27: 48 8b 32 mov (%rdx),%rsi
* 2a: 48 8d 7e 01 lea 0x1(%rsi),%rdi <-- trapping instruction
2e: 8b 89 fc 15 00 00 mov 0x15fc(%rcx),%ecx
34: 48 39 cf cmp %rcx,%rdi
37: 73 08 jae 0x41
39: 48 89 3a mov %rdi,(%rdx)
3c: 48 rex.W
3d: 89 .byte 0x89
3e: 44 rex.R
3f: f2 repnz