==================================================================
BUG: KASAN: use-after-free in tcp_retransmit_timer+0x2f97/0x3410 net/ipv4/tcp_timer.c:509
Read of size 8 at addr ffff88803c7de380 by task syz-executor.5/15766
CPU: 1 PID: 15766 Comm: syz-executor.5 Not tainted 6.1.0-rc5-syzkaller-00018-g59d0d52c30d4 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
Call Trace:
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0xd1/0x138 lib/dump_stack.c:106
print_address_description mm/kasan/report.c:284 [inline]
print_report+0x15e/0x461 mm/kasan/report.c:395
kasan_report+0xbf/0x1f0 mm/kasan/report.c:495
tcp_retransmit_timer+0x2f97/0x3410 net/ipv4/tcp_timer.c:509
tcp_write_timer_handler net/ipv4/tcp_timer.c:620 [inline]
tcp_write_timer_handler+0x4e2/0x9f0 net/ipv4/tcp_timer.c:594
tcp_write_timer+0xa6/0x2b0 net/ipv4/tcp_timer.c:637
call_timer_fn+0x1da/0x7c0 kernel/time/timer.c:1474
expire_timers kernel/time/timer.c:1519 [inline]
__run_timers.part.0+0x6a2/0xaf0 kernel/time/timer.c:1790
__run_timers kernel/time/timer.c:1768 [inline]
run_timer_softirq+0xb7/0x1d0 kernel/time/timer.c:1803
__do_softirq+0x1fb/0xadc kernel/softirq.c:571
invoke_softirq kernel/softirq.c:445 [inline]
__irq_exit_rcu+0x123/0x180 kernel/softirq.c:650
irq_exit_rcu+0x9/0x20 kernel/softirq.c:662
sysvec_apic_timer_interrupt+0x97/0xc0 arch/x86/kernel/apic/apic.c:1107
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:649
RIP: 0010:lock_acquire+0x227/0x630 kernel/locking/lockdep.c:5636
Code: 57 a0 7e 83 f8 01 0f 85 3a 03 00 00 9c 58 f6 c4 02 0f 85 25 03 00 00 48 83 7c 24 08 00 74 01 fb 48 b8 00 00 00 00 00 fc ff df <48> 01 c3 48 c7 03 00 00 00 00 48 c7 43 08 00 00 00 00 48 8b 84 24
RSP: 0018:ffffc90003bb74e8 EFLAGS: 00000206
RAX: dffffc0000000000 RBX: 1ffff92000776ea0 RCX: ffffffff8161dbbe
RDX: 1ffff1100f694551 RSI: 0000000000000001 RDI: 0000000000000000
RBP: 0000000000000001 R08: 0000000000000000 R09: ffffffff91108a87
R10: fffffbfff2221150 R11: 0000000000000000 R12: 0000000000000000
R13: 0000000000000000 R14: ffff8880b9b36520 R15: 0000000000000000
local_lock_acquire include/linux/local_lock_internal.h:29 [inline]
mlock_page_drain_local+0x89/0x4e0 mm/mlock.c:217
free_pages_and_swap_cache+0x1c/0x90 mm/swap_state.c:311
tlb_batch_pages_flush+0xa8/0x1a0 mm/mmu_gather.c:59
zap_pte_range mm/memory.c:1528 [inline]
zap_pmd_range mm/memory.c:1577 [inline]
zap_pud_range mm/memory.c:1606 [inline]
zap_p4d_range mm/memory.c:1627 [inline]
unmap_page_range+0x23fb/0x3c90 mm/memory.c:1648
unmap_single_vma+0x190/0x2a0 mm/memory.c:1694
unmap_vmas+0x226/0x370 mm/memory.c:1733
exit_mmap+0x18d/0x7b0 mm/mmap.c:3094
__mmput+0x128/0x4c0 kernel/fork.c:1185
mmput+0x60/0x70 kernel/fork.c:1207
exit_mm kernel/exit.c:516 [inline]
do_exit+0xa41/0x2a30 kernel/exit.c:807
do_group_exit+0xd4/0x2a0 kernel/exit.c:950
get_signal+0x21b1/0x2440 kernel/signal.c:2858
arch_do_signal_or_restart+0x86/0x2300 arch/x86/kernel/signal.c:869
exit_to_user_mode_loop kernel/entry/common.c:168 [inline]
exit_to_user_mode_prepare+0x15f/0x250 kernel/entry/common.c:203
__syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline]
syscall_exit_to_user_mode+0x1d/0x50 kernel/entry/common.c:296
do_syscall_64+0x46/0xb0 arch/x86/entry/common.c:86
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f5976e8b639
Code: Unable to access opcode bytes at 0x7f5976e8b60f.
RSP: 002b:00007f5977b59218 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca
RAX: fffffffffffffe00 RBX: 00007f5976fabf88 RCX: 00007f5976e8b639
RDX: 0000000000000000 RSI: 0000000000000080 RDI: 00007f5976fabf88
RBP: 00007f5976fabf80 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f5976fabf8c
R13: 00007ffc4878713f R14: 00007f5977b59300 R15: 0000000000022000
Allocated by task 13674:
kasan_save_stack+0x22/0x40 mm/kasan/common.c:45
kasan_set_track+0x25/0x30 mm/kasan/common.c:52
____kasan_kmalloc mm/kasan/common.c:371 [inline]
____kasan_kmalloc mm/kasan/common.c:330 [inline]
__kasan_kmalloc+0xa3/0xb0 mm/kasan/common.c:380
kasan_kmalloc include/linux/kasan.h:211 [inline]
__do_kmalloc_node mm/slab_common.c:955 [inline]
__kmalloc_node_track_caller+0x5b/0xc0 mm/slab_common.c:975
kmalloc_reserve net/core/skbuff.c:437 [inline]
__alloc_skb+0xdd/0x300 net/core/skbuff.c:509
alloc_skb include/linux/skbuff.h:1267 [inline]
nsim_dev_trap_skb_build drivers/net/netdevsim/dev.c:751 [inline]
nsim_dev_trap_report drivers/net/netdevsim/dev.c:808 [inline]
nsim_dev_trap_report_work+0x2b1/0xc80 drivers/net/netdevsim/dev.c:853
process_one_work+0x9bf/0x1710 kernel/workqueue.c:2289
worker_thread+0x669/0x1090 kernel/workqueue.c:2436
kthread+0x2e8/0x3a0 kernel/kthread.c:376
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306
Freed by task 13674:
kasan_save_stack+0x22/0x40 mm/kasan/common.c:45
kasan_set_track+0x25/0x30 mm/kasan/common.c:52
kasan_save_free_info+0x2b/0x40 mm/kasan/generic.c:511
____kasan_slab_free mm/kasan/common.c:236 [inline]
____kasan_slab_free+0x13b/0x1a0 mm/kasan/common.c:200
kasan_slab_free include/linux/kasan.h:177 [inline]
__cache_free mm/slab.c:3389 [inline]
__do_kmem_cache_free mm/slab.c:3585 [inline]
__kmem_cache_free+0xcd/0x3b0 mm/slab.c:3592
skb_free_head+0xac/0x110 net/core/skbuff.c:760
skb_release_data+0x5f1/0x870 net/core/skbuff.c:789
skb_release_all net/core/skbuff.c:854 [inline]
__kfree_skb net/core/skbuff.c:868 [inline]
consume_skb net/core/skbuff.c:1033 [inline]
consume_skb+0xc6/0x160 net/core/skbuff.c:1027
nsim_dev_trap_report drivers/net/netdevsim/dev.c:824 [inline]
nsim_dev_trap_report_work+0x87c/0xc80 drivers/net/netdevsim/dev.c:853
process_one_work+0x9bf/0x1710 kernel/workqueue.c:2289
worker_thread+0x669/0x1090 kernel/workqueue.c:2436
kthread+0x2e8/0x3a0 kernel/kthread.c:376
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306
The buggy address belongs to the object at ffff88803c7de000
which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 896 bytes inside of
4096-byte region [ffff88803c7de000, ffff88803c7df000)
The buggy address belongs to the physical page:
page:ffffea0000f1f780 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x3c7de
head:ffffea0000f1f780 order:1 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 ffffea0000fec508 ffffea0001f67608 ffff888012040900
raw: 0000000000000000 ffff88803c7de000 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 1, migratetype Unmovable, gfp_mask 0x3c2220(__GFP_HIGH|__GFP_ATOMIC|__GFP_NOWARN|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL|__GFP_THISNODE), pid 13674, tgid 13674 (kworker/0:2), ts 2727279084682, free_ts 2726476727769
prep_new_page mm/page_alloc.c:2539 [inline]
get_page_from_freelist+0x10b5/0x2d50 mm/page_alloc.c:4288
__alloc_pages+0x1cb/0x5b0 mm/page_alloc.c:5555
__alloc_pages_node include/linux/gfp.h:223 [inline]
kmem_getpages mm/slab.c:1363 [inline]
cache_grow_begin+0x75/0x360 mm/slab.c:2570
cache_alloc_refill+0x27f/0x380 mm/slab.c:2943
____cache_alloc mm/slab.c:3019 [inline]
____cache_alloc mm/slab.c:3002 [inline]
__do_cache_alloc mm/slab.c:3202 [inline]
slab_alloc_node mm/slab.c:3250 [inline]
__kmem_cache_alloc_node+0x44a/0x510 mm/slab.c:3549
__do_kmalloc_node mm/slab_common.c:954 [inline]
__kmalloc_node_track_caller+0x4b/0xc0 mm/slab_common.c:975
kmalloc_reserve net/core/skbuff.c:437 [inline]
__alloc_skb+0xdd/0x300 net/core/skbuff.c:509
alloc_skb include/linux/skbuff.h:1267 [inline]
nsim_dev_trap_skb_build drivers/net/netdevsim/dev.c:751 [inline]
nsim_dev_trap_report drivers/net/netdevsim/dev.c:808 [inline]
nsim_dev_trap_report_work+0x2b1/0xc80 drivers/net/netdevsim/dev.c:853
process_one_work+0x9bf/0x1710 kernel/workqueue.c:2289
worker_thread+0x669/0x1090 kernel/workqueue.c:2436
kthread+0x2e8/0x3a0 kernel/kthread.c:376
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1459 [inline]
free_pcp_prepare+0x65c/0xd90 mm/page_alloc.c:1509
free_unref_page_prepare mm/page_alloc.c:3387 [inline]
free_unref_page+0x1d/0x4d0 mm/page_alloc.c:3483
slab_destroy mm/slab.c:1615 [inline]
slabs_destroy+0x85/0xc0 mm/slab.c:1635
cache_flusharray mm/slab.c:3360 [inline]
___cache_free+0x2ac/0x3d0 mm/slab.c:3423
qlink_free mm/kasan/quarantine.c:168 [inline]
qlist_free_all+0x4f/0x1a0 mm/kasan/quarantine.c:187
kasan_quarantine_reduce+0x184/0x210 mm/kasan/quarantine.c:294
____kasan_kmalloc mm/kasan/common.c:337 [inline]
__kasan_kmalloc+0x87/0xb0 mm/kasan/common.c:380
kasan_kmalloc include/linux/kasan.h:211 [inline]
__do_kmalloc_node mm/slab_common.c:955 [inline]
__kmalloc+0x5a/0xd0 mm/slab_common.c:968
kmalloc include/linux/slab.h:558 [inline]
kzalloc include/linux/slab.h:689 [inline]
tomoyo_encode2.part.0+0xe9/0x3a0 security/tomoyo/realpath.c:45
tomoyo_encode2 security/tomoyo/realpath.c:31 [inline]
tomoyo_encode+0x2c/0x50 security/tomoyo/realpath.c:80
tomoyo_realpath_from_path+0x185/0x600 security/tomoyo/realpath.c:283
tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
tomoyo_path_perm+0x21f/0x410 security/tomoyo/file.c:822
security_inode_getattr+0xd3/0x140 security/security.c:1347
vfs_getattr fs/stat.c:158 [inline]
vfs_statx+0x16e/0x430 fs/stat.c:233
vfs_fstatat+0x90/0xb0 fs/stat.c:267
__do_sys_newfstatat+0x94/0x120 fs/stat.c:437
Memory state around the buggy address:
ffff88803c7de280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88803c7de300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88803c7de380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88803c7de400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88803c7de480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
----------------
Code disassembly (best guess):
0: 57 push %rdi
1: a0 7e 83 f8 01 0f 85 movabs 0x33a850f01f8837e,%al
8: 3a 03
a: 00 00 add %al,(%rax)
c: 9c pushfq
d: 58 pop %rax
e: f6 c4 02 test $0x2,%ah
11: 0f 85 25 03 00 00 jne 0x33c
17: 48 83 7c 24 08 00 cmpq $0x0,0x8(%rsp)
1d: 74 01 je 0x20
1f: fb sti
20: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax
27: fc ff df
* 2a: 48 01 c3 add %rax,%rbx <-- trapping instruction
2d: 48 c7 03 00 00 00 00 movq $0x0,(%rbx)
34: 48 c7 43 08 00 00 00 movq $0x0,0x8(%rbx)
3b: 00
3c: 48 rex.W
3d: 8b .byte 0x8b
3e: 84 .byte 0x84
3f: 24 .byte 0x24