[v6.1] KASAN: use-after-free Read in tcp_write_timer_handler

15 views
Skip to first unread message

syzbot

unread,
Mar 8, 2023, 1:26:37 AM3/8/23
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 42616e0f09fb Linux 6.1.15
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=11bb5e6cc80000
kernel config: https://syzkaller.appspot.com/x/.config?x=690b9ff41783cd73
dashboard link: https://syzkaller.appspot.com/bug?extid=4253c3a28964c0d828d3
compiler: Debian clang version 15.0.7, GNU ld (GNU Binutils for Debian) 2.35.2

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/db869f2ed2bd/disk-42616e0f.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/37951bbe5829/vmlinux-42616e0f.xz
kernel image: https://storage.googleapis.com/syzbot-assets/23aa1a75ce0f/bzImage-42616e0f.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+4253c3...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: use-after-free in tcp_probe_timer net/ipv4/tcp_timer.c:378 [inline]
BUG: KASAN: use-after-free in tcp_write_timer_handler+0x7ef/0x930 net/ipv4/tcp_timer.c:624
Read of size 1 at addr ffff88804927dc05 by task syz-executor.3/12696

CPU: 1 PID: 12696 Comm: syz-executor.3 Not tainted 6.1.15-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/2023
Call Trace:
<IRQ>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
print_address_description mm/kasan/report.c:284 [inline]
print_report+0x15f/0x4f0 mm/kasan/report.c:395
kasan_report+0x136/0x160 mm/kasan/report.c:495
tcp_probe_timer net/ipv4/tcp_timer.c:378 [inline]
tcp_write_timer_handler+0x7ef/0x930 net/ipv4/tcp_timer.c:624
tcp_write_timer+0x12e/0x280 net/ipv4/tcp_timer.c:637
call_timer_fn+0x1e5/0x800 kernel/time/timer.c:1474
expire_timers kernel/time/timer.c:1519 [inline]
__run_timers+0x67c/0x890 kernel/time/timer.c:1790
run_timer_softirq+0x63/0xf0 kernel/time/timer.c:1803
__do_softirq+0x304/0xb09 kernel/softirq.c:571
invoke_softirq kernel/softirq.c:445 [inline]
__irq_exit_rcu+0x155/0x240 kernel/softirq.c:650
irq_exit_rcu+0x5/0x20 kernel/softirq.c:662
sysvec_apic_timer_interrupt+0x91/0xb0 arch/x86/kernel/apic/apic.c:1107
</IRQ>
<TASK>
asm_sysvec_apic_timer_interrupt+0x16/0x20 arch/x86/include/asm/idtentry.h:649
RIP: 0010:finish_lock_switch+0x91/0x100 kernel/sched/core.c:4998
Code: 45 31 c9 68 e7 67 60 81 e8 1c b5 09 00 48 83 c4 08 4c 89 ff e8 e0 cb fe ff 66 90 4c 89 ff e8 76 7d 2a 09 e8 a1 74 30 00 fb 5b <41> 5c 41 5d 41 5e 41 5f c3 44 89 f1 80 e1 07 80 c1 03 38 c1 7c 87
RSP: 0000:ffffc9000a3c7c98 EFLAGS: 00000286
RAX: 6851f8b72ac25c00 RBX: ffff8880558a1d74 RCX: ffffffff9196d003
RDX: dffffc0000000000 RSI: ffffffff8aebcf60 RDI: ffffffff8b3d0400
RBP: ffffc9000a3c7d10 R08: dffffc0000000000 R09: ffffed10173673b9
R10: 0000000000000000 R11: dffffc0000000001 R12: dffffc0000000000
R13: 1ffff11017367563 R14: ffff8880b9b3ab18 R15: ffff8880b9b39dc0
finish_task_switch+0x134/0x630 kernel/sched/core.c:5115
context_switch kernel/sched/core.c:5241 [inline]
__schedule+0x137e/0x4360 kernel/sched/core.c:6551
schedule+0xbf/0x180 kernel/sched/core.c:6627
exit_to_user_mode_loop+0x44/0x100 kernel/entry/common.c:159
exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:203
irqentry_exit_to_user_mode+0x5/0x30 kernel/entry/common.c:309
asm_sysvec_reschedule_ipi+0x16/0x20 arch/x86/include/asm/idtentry.h:654
RIP: 0033:0x7f40cfe393b6
Code: 1f 44 00 00 4c 89 ff e8 38 08 ff ff 41 08 c5 0f 85 f7 01 00 00 41 83 c6 01 44 39 73 04 0f 86 b7 00 00 00 48 8b 04 24 44 89 f7 <48> 8b 53 28 4d 89 f8 48 03 14 f8 80 3d f0 ec 16 00 00 49 89 d7 89
RSP: 002b:00007ffe386580d0 EFLAGS: 00000216
RAX: 00007f40cf400008 RBX: 00007f40cffac1b8 RCX: 0000001b30c20000
RDX: 0000000067cadaff RSI: 0000001b30c36c84 RDI: 00000000000232eb
RBP: 0000000067cadaff R08: 0000000000001aff R09: 0000000067cadb03
R10: 00007ffe38658290 R11: 0000000000000246 R12: 00007f40cffa0000
R13: 0000000000000001 R14: 00000000000232eb R15: ffffffff822ea777
</TASK>

Allocated by task 5297:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
__kasan_slab_alloc+0x65/0x70 mm/kasan/common.c:328
kasan_slab_alloc include/linux/kasan.h:201 [inline]
slab_post_alloc_hook+0x50/0x360 mm/slab.h:737
slab_alloc_node mm/slub.c:3398 [inline]
slab_alloc mm/slub.c:3406 [inline]
__kmem_cache_alloc_lru mm/slub.c:3413 [inline]
kmem_cache_alloc+0x119/0x260 mm/slub.c:3422
kmem_cache_zalloc include/linux/slab.h:679 [inline]
net_alloc net/core/net_namespace.c:410 [inline]
copy_net_ns+0x13d/0x5a0 net/core/net_namespace.c:465
create_new_namespaces+0x425/0x7a0 kernel/nsproxy.c:110
unshare_nsproxy_namespaces+0x119/0x170 kernel/nsproxy.c:226
ksys_unshare+0x580/0xb20 kernel/fork.c:3193
__do_sys_unshare kernel/fork.c:3264 [inline]
__se_sys_unshare kernel/fork.c:3262 [inline]
__x64_sys_unshare+0x34/0x40 kernel/fork.c:3262
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd

Last potentially related work creation:
kasan_save_stack+0x3b/0x60 mm/kasan/common.c:45
__kasan_record_aux_stack+0xb0/0xc0 mm/kasan/generic.c:486
insert_work+0x54/0x3d0 kernel/workqueue.c:1358
__queue_work+0xb59/0xfc0 kernel/workqueue.c:1517
call_timer_fn+0x1e5/0x800 kernel/time/timer.c:1474
expire_timers kernel/time/timer.c:1514 [inline]
__run_timers+0x6a8/0x890 kernel/time/timer.c:1790
__do_softirq+0x304/0xb09 kernel/softirq.c:571

Second to last potentially related work creation:
kasan_save_stack+0x3b/0x60 mm/kasan/common.c:45
__kasan_record_aux_stack+0xb0/0xc0 mm/kasan/generic.c:486
insert_work+0x54/0x3d0 kernel/workqueue.c:1358
__queue_work+0xb59/0xfc0 kernel/workqueue.c:1517
queue_work_on+0x14b/0x250 kernel/workqueue.c:1545
xfrm_set_spdinfo+0x3fd/0x5d0 net/xfrm/xfrm_user.c:1385
xfrm_user_rcv_msg+0x6f0/0xa40 net/xfrm/xfrm_user.c:3054
netlink_rcv_skb+0x1cd/0x410 net/netlink/af_netlink.c:2550
xfrm_netlink_rcv+0x70/0x80 net/xfrm/xfrm_user.c:3076
netlink_unicast_kernel net/netlink/af_netlink.c:1328 [inline]
netlink_unicast+0x7bf/0x990 net/netlink/af_netlink.c:1354
netlink_sendmsg+0x9fe/0xd10 net/netlink/af_netlink.c:1931
sock_sendmsg_nosec net/socket.c:714 [inline]
sock_sendmsg net/socket.c:734 [inline]
____sys_sendmsg+0x59e/0x8f0 net/socket.c:2485
___sys_sendmsg net/socket.c:2539 [inline]
__sys_sendmsg+0x2a9/0x390 net/socket.c:2568
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd

The buggy address belongs to the object at ffff88804927d4c0
which belongs to the cache net_namespace of size 6976
The buggy address is located 1861 bytes inside of
6976-byte region [ffff88804927d4c0, ffff88804927f000)

The buggy address belongs to the physical page:
page:ffffea0001249e00 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88804927d4c0 pfn:0x49278
head:ffffea0001249e00 order:3 compound_mapcount:0 compound_pincount:0
memcg:ffff88801fdd2601
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 ffff88801221a348 ffffea00009d6a08 ffff888140007500
raw: ffff88804927d4c0 0000000000040000 00000001ffffffff ffff88801fdd2601
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 4752, tgid 4750 (syz-executor.4), ts 155074780257, free_ts 155048764916
prep_new_page mm/page_alloc.c:2539 [inline]
get_page_from_freelist+0x3542/0x36d0 mm/page_alloc.c:4291
__alloc_pages+0x28d/0x7e0 mm/page_alloc.c:5558
alloc_slab_page+0x6a/0x150 mm/slub.c:1794
allocate_slab mm/slub.c:1939 [inline]
new_slab+0x84/0x2d0 mm/slub.c:1992
___slab_alloc+0xa71/0x1080 mm/slub.c:3180
__slab_alloc mm/slub.c:3279 [inline]
slab_alloc_node mm/slub.c:3364 [inline]
slab_alloc mm/slub.c:3406 [inline]
__kmem_cache_alloc_lru mm/slub.c:3413 [inline]
kmem_cache_alloc+0x199/0x260 mm/slub.c:3422
kmem_cache_zalloc include/linux/slab.h:679 [inline]
net_alloc net/core/net_namespace.c:410 [inline]
copy_net_ns+0x13d/0x5a0 net/core/net_namespace.c:465
create_new_namespaces+0x425/0x7a0 kernel/nsproxy.c:110
copy_namespaces+0x325/0x380 kernel/nsproxy.c:178
copy_process+0x1a66/0x3fd0 kernel/fork.c:2259
kernel_clone+0x222/0x9e0 kernel/fork.c:2676
__do_sys_clone kernel/fork.c:2817 [inline]
__se_sys_clone kernel/fork.c:2801 [inline]
__x64_sys_clone+0x231/0x280 kernel/fork.c:2801
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
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 mm/page_alloc.c:1509 [inline]
free_unref_page_prepare+0xfdc/0x1190 mm/page_alloc.c:3387
free_unref_page+0x98/0x570 mm/page_alloc.c:3483
free_slab mm/slub.c:2031 [inline]
discard_slab mm/slub.c:2037 [inline]
__unfreeze_partials+0x1b7/0x210 mm/slub.c:2586
put_cpu_partial+0x116/0x180 mm/slub.c:2662
qlist_free_all+0x22/0x60 mm/kasan/quarantine.c:187
kasan_quarantine_reduce+0x162/0x180 mm/kasan/quarantine.c:294
__kasan_slab_alloc+0x1f/0x70 mm/kasan/common.c:305
kasan_slab_alloc include/linux/kasan.h:201 [inline]
slab_post_alloc_hook+0x50/0x360 mm/slab.h:737
slab_alloc_node mm/slub.c:3398 [inline]
slab_alloc mm/slub.c:3406 [inline]
__kmem_cache_alloc_lru mm/slub.c:3413 [inline]
kmem_cache_alloc+0x119/0x260 mm/slub.c:3422
getname_flags+0xb8/0x4e0 fs/namei.c:139
vfs_fstatat fs/stat.c:266 [inline]
__do_sys_newfstatat fs/stat.c:437 [inline]
__se_sys_newfstatat+0xe2/0x7b0 fs/stat.c:431
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd

Memory state around the buggy address:
ffff88804927db00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88804927db80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88804927dc00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88804927dc80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88804927dd00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
----------------
Code disassembly (best guess):
0: 45 31 c9 xor %r9d,%r9d
3: 68 e7 67 60 81 pushq $0xffffffff816067e7
8: e8 1c b5 09 00 callq 0x9b529
d: 48 83 c4 08 add $0x8,%rsp
11: 4c 89 ff mov %r15,%rdi
14: e8 e0 cb fe ff callq 0xfffecbf9
19: 66 90 xchg %ax,%ax
1b: 4c 89 ff mov %r15,%rdi
1e: e8 76 7d 2a 09 callq 0x92a7d99
23: e8 a1 74 30 00 callq 0x3074c9
28: fb sti
29: 5b pop %rbx
* 2a: 41 5c pop %r12 <-- trapping instruction
2c: 41 5d pop %r13
2e: 41 5e pop %r14
30: 41 5f pop %r15
32: c3 retq
33: 44 89 f1 mov %r14d,%ecx
36: 80 e1 07 and $0x7,%cl
39: 80 c1 03 add $0x3,%cl
3c: 38 c1 cmp %al,%cl
3e: 7c 87 jl 0xffffffc7


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

syzbot

unread,
Mar 9, 2023, 3:35:47 AM3/9/23
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: d9b4a0c83a2d Linux 5.15.98
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=16883442c80000
kernel config: https://syzkaller.appspot.com/x/.config?x=2f8d9515b973b23b
dashboard link: https://syzkaller.appspot.com/bug?extid=1a885b255a749c675633
compiler: Debian clang version 15.0.7, GNU ld (GNU Binutils for Debian) 2.35.2

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/be34e23aaa99/disk-d9b4a0c8.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/b475bbb4fab3/vmlinux-d9b4a0c8.xz
kernel image: https://storage.googleapis.com/syzbot-assets/7c1abc451dda/bzImage-d9b4a0c8.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+1a885b...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: use-after-free in tcp_probe_timer net/ipv4/tcp_timer.c:384 [inline]
BUG: KASAN: use-after-free in tcp_write_timer_handler+0x882/0x9c0 net/ipv4/tcp_timer.c:630
Read of size 1 at addr ffff88807d9dbb0d by task swapper/0/0

CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.15.98-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/2023
Call Trace:
<IRQ>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
print_address_description+0x63/0x3b0 mm/kasan/report.c:248
__kasan_report mm/kasan/report.c:434 [inline]
kasan_report+0x16b/0x1c0 mm/kasan/report.c:451
tcp_probe_timer net/ipv4/tcp_timer.c:384 [inline]
tcp_write_timer_handler+0x882/0x9c0 net/ipv4/tcp_timer.c:630
tcp_write_timer+0x12e/0x280 net/ipv4/tcp_timer.c:646
call_timer_fn+0x1bc/0x6b0 kernel/time/timer.c:1421
expire_timers kernel/time/timer.c:1466 [inline]
__run_timers+0x67c/0x890 kernel/time/timer.c:1737
run_timer_softirq+0x63/0xf0 kernel/time/timer.c:1750
__do_softirq+0x3d1/0x9fe kernel/softirq.c:558
invoke_softirq kernel/softirq.c:432 [inline]
__irq_exit_rcu+0x155/0x240 kernel/softirq.c:636
irq_exit_rcu+0x5/0x20 kernel/softirq.c:648
sysvec_apic_timer_interrupt+0x91/0xb0 arch/x86/kernel/apic/apic.c:1097
</IRQ>
<TASK>
asm_sysvec_apic_timer_interrupt+0x16/0x20 arch/x86/include/asm/idtentry.h:638
RIP: 0010:native_save_fl arch/x86/include/asm/irqflags.h:22 [inline]
RIP: 0010:arch_local_save_flags arch/x86/include/asm/irqflags.h:70 [inline]
RIP: 0010:arch_irqs_disabled arch/x86/include/asm/irqflags.h:132 [inline]
RIP: 0010:acpi_safe_halt drivers/acpi/processor_idle.c:110 [inline]
RIP: 0010:acpi_idle_do_entry+0x10f/0x340 drivers/acpi/processor_idle.c:570
Code: 33 5c f7 48 83 e3 08 0f 85 0a 01 00 00 4c 8d 74 24 20 e8 e4 a0 62 f7 0f 1f 44 00 00 e8 2a 2f 5c f7 0f 00 2d 13 77 be 00 fb f4 <4c> 89 f3 48 c1 eb 03 42 80 3c 3b 00 74 08 4c 89 f7 e8 fb 62 a5 f7
RSP: 0000:ffffffff8c607b80 EFLAGS: 000002d3
RAX: ffffffff8a242566 RBX: 0000000000000000 RCX: ffffffff8c6bb600
RDX: 0000000000000000 RSI: ffffffff8a8aff60 RDI: ffffffff8ad8b900
RBP: ffffffff8c607c10 R08: ffffffff8186c670 R09: fffffbfff18d76c1
R10: 0000000000000000 R11: dffffc0000000001 R12: 1ffffffff18c0f70
R13: ffff888146771804 R14: ffffffff8c607ba0 R15: dffffc0000000000
acpi_idle_enter+0x352/0x4f0 drivers/acpi/processor_idle.c:705
cpuidle_enter_state+0x521/0xef0 drivers/cpuidle/cpuidle.c:237
cpuidle_enter+0x59/0x90 drivers/cpuidle/cpuidle.c:351
call_cpuidle kernel/sched/idle.c:158 [inline]
cpuidle_idle_call kernel/sched/idle.c:239 [inline]
do_idle+0x3e4/0x670 kernel/sched/idle.c:306
cpu_startup_entry+0x14/0x20 kernel/sched/idle.c:403
start_kernel+0x48c/0x535 init/main.c:1144
secondary_startup_64_no_verify+0xb1/0xbb
</TASK>

Allocated by task 5753:
kasan_save_stack mm/kasan/common.c:38 [inline]
kasan_set_track mm/kasan/common.c:46 [inline]
set_alloc_info mm/kasan/common.c:434 [inline]
__kasan_slab_alloc+0x8e/0xc0 mm/kasan/common.c:467
kasan_slab_alloc include/linux/kasan.h:254 [inline]
slab_post_alloc_hook+0x53/0x370 mm/slab.h:519
slab_alloc_node mm/slub.c:3220 [inline]
slab_alloc mm/slub.c:3228 [inline]
kmem_cache_alloc+0xf3/0x2d0 mm/slub.c:3233
kmem_cache_zalloc include/linux/slab.h:711 [inline]
net_alloc net/core/net_namespace.c:405 [inline]
copy_net_ns+0x13d/0x5a0 net/core/net_namespace.c:460
create_new_namespaces+0x425/0x7a0 kernel/nsproxy.c:110
unshare_nsproxy_namespaces+0x119/0x170 kernel/nsproxy.c:226
ksys_unshare+0x580/0xb20 kernel/fork.c:3094
__do_sys_unshare kernel/fork.c:3168 [inline]
__se_sys_unshare kernel/fork.c:3166 [inline]
__x64_sys_unshare+0x34/0x40 kernel/fork.c:3166
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x61/0xcb

The buggy address belongs to the object at ffff88807d9db480
which belongs to the cache net_namespace of size 6464
The buggy address is located 1677 bytes inside of
6464-byte region [ffff88807d9db480, ffff88807d9dcdc0)
The buggy address belongs to the page:
page:ffffea0001f67600 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88807d9db480 pfn:0x7d9d8
head:ffffea0001f67600 order:3 compound_mapcount:0 compound_pincount:0
memcg:ffff888014b93ac1
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 0000000000000000 0000000100000001 ffff888011dc63c0
raw: ffff88807d9db480 0000000080040003 00000001ffffffff ffff888014b93ac1
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 3827, ts 67128602801, free_ts 67118243775
prep_new_page mm/page_alloc.c:2426 [inline]
get_page_from_freelist+0x32d4/0x3470 mm/page_alloc.c:4159
__alloc_pages+0x272/0x780 mm/page_alloc.c:5421
alloc_slab_page mm/slub.c:1775 [inline]
allocate_slab mm/slub.c:1912 [inline]
new_slab+0xbb/0x4b0 mm/slub.c:1975
___slab_alloc+0x6f6/0xe10 mm/slub.c:3008
__slab_alloc mm/slub.c:3095 [inline]
slab_alloc_node mm/slub.c:3186 [inline]
slab_alloc mm/slub.c:3228 [inline]
kmem_cache_alloc+0x1d8/0x2d0 mm/slub.c:3233
kmem_cache_zalloc include/linux/slab.h:711 [inline]
net_alloc net/core/net_namespace.c:405 [inline]
copy_net_ns+0x13d/0x5a0 net/core/net_namespace.c:460
create_new_namespaces+0x425/0x7a0 kernel/nsproxy.c:110
copy_namespaces+0x325/0x380 kernel/nsproxy.c:178
copy_process+0x1801/0x3e90 kernel/fork.c:2201
kernel_clone+0x210/0xa40 kernel/fork.c:2601
__do_sys_clone kernel/fork.c:2718 [inline]
__se_sys_clone kernel/fork.c:2702 [inline]
__x64_sys_clone+0x23f/0x290 kernel/fork.c:2702
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x61/0xcb
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1340 [inline]
free_pcp_prepare mm/page_alloc.c:1391 [inline]
free_unref_page_prepare+0xcae/0xd70 mm/page_alloc.c:3317
free_unref_page+0x95/0x2d0 mm/page_alloc.c:3396
free_slab mm/slub.c:2015 [inline]
discard_slab mm/slub.c:2021 [inline]
__unfreeze_partials+0x1b7/0x210 mm/slub.c:2507
put_cpu_partial+0x132/0x1a0 mm/slub.c:2587
do_slab_free mm/slub.c:3487 [inline]
___cache_free+0xe3/0x100 mm/slub.c:3506
qlist_free_all+0x36/0x90 mm/kasan/quarantine.c:176
kasan_quarantine_reduce+0x162/0x180 mm/kasan/quarantine.c:283
__kasan_slab_alloc+0x2f/0xc0 mm/kasan/common.c:444
kasan_slab_alloc include/linux/kasan.h:254 [inline]
slab_post_alloc_hook+0x53/0x370 mm/slab.h:519
slab_alloc_node mm/slub.c:3220 [inline]
slab_alloc mm/slub.c:3228 [inline]
kmem_cache_alloc+0xf3/0x2d0 mm/slub.c:3233
getname_flags+0xb8/0x4e0 fs/namei.c:138
user_path_at_empty+0x2a/0x180 fs/namei.c:2852
user_path_at include/linux/namei.h:57 [inline]
vfs_statx+0x106/0x3b0 fs/stat.c:221
vfs_fstatat fs/stat.c:243 [inline]
__do_sys_newfstatat fs/stat.c:411 [inline]
__se_sys_newfstatat+0xc8/0x760 fs/stat.c:405
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x61/0xcb

Memory state around the buggy address:
ffff88807d9dba00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88807d9dba80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88807d9dbb00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88807d9dbb80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88807d9dbc00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
----------------
Code disassembly (best guess):
0: 33 5c f7 48 xor 0x48(%rdi,%rsi,8),%ebx
4: 83 e3 08 and $0x8,%ebx
7: 0f 85 0a 01 00 00 jne 0x117
d: 4c 8d 74 24 20 lea 0x20(%rsp),%r14
12: e8 e4 a0 62 f7 callq 0xf762a0fb
17: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1)
1c: e8 2a 2f 5c f7 callq 0xf75c2f4b
21: 0f 00 2d 13 77 be 00 verw 0xbe7713(%rip) # 0xbe773b
28: fb sti
29: f4 hlt
* 2a: 4c 89 f3 mov %r14,%rbx <-- trapping instruction
2d: 48 c1 eb 03 shr $0x3,%rbx
31: 42 80 3c 3b 00 cmpb $0x0,(%rbx,%r15,1)
36: 74 08 je 0x40
38: 4c 89 f7 mov %r14,%rdi
3b: e8 fb 62 a5 f7 callq 0xf7a5633b

syzbot

unread,
Feb 25, 2024, 5:44:24 AMFeb 25
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: 458ce51d0356 Linux 5.15.149
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=14176b3a180000
kernel config: https://syzkaller.appspot.com/x/.config?x=72292cff014cb054
dashboard link: https://syzkaller.appspot.com/bug?extid=1a885b255a749c675633
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
userspace arch: arm64
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=16260e02180000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1120f106180000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/5e02146c6560/disk-458ce51d.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/267e4c48f387/vmlinux-458ce51d.xz
kernel image: https://storage.googleapis.com/syzbot-assets/e46fd8f3e04b/Image-458ce51d.gz.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+1a885b...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: use-after-free in tcp_probe_timer net/ipv4/tcp_timer.c:384 [inline]
BUG: KASAN: use-after-free in tcp_write_timer_handler+0x78c/0x8a8 net/ipv4/tcp_timer.c:648
Read of size 1 at addr ffff0000dc573b0d by task syz-executor413/3994

CPU: 1 PID: 3994 Comm: syz-executor413 Not tainted 5.15.149-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/25/2024
Call trace:
dump_backtrace+0x0/0x530 arch/arm64/kernel/stacktrace.c:152
show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:216
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
print_address_description+0x7c/0x3f0 mm/kasan/report.c:248
__kasan_report mm/kasan/report.c:434 [inline]
kasan_report+0x174/0x1e4 mm/kasan/report.c:451
__asan_report_load1_noabort+0x44/0x50 mm/kasan/report_generic.c:306
tcp_probe_timer net/ipv4/tcp_timer.c:384 [inline]
tcp_write_timer_handler+0x78c/0x8a8 net/ipv4/tcp_timer.c:648
tcp_write_timer+0x178/0x318 net/ipv4/tcp_timer.c:664
call_timer_fn+0x19c/0x8f0 kernel/time/timer.c:1421
expire_timers kernel/time/timer.c:1466 [inline]
__run_timers+0x554/0x718 kernel/time/timer.c:1737
run_timer_softirq+0x7c/0x114 kernel/time/timer.c:1750
__do_softirq+0x344/0xdb0 kernel/softirq.c:558
do_softirq_own_stack include/asm-generic/softirq_stack.h:10 [inline]
invoke_softirq kernel/softirq.c:439 [inline]
__irq_exit_rcu+0x264/0x4d4 kernel/softirq.c:637
irq_exit+0x14/0x88 kernel/softirq.c:661
handle_domain_irq+0xf4/0x178 kernel/irq/irqdesc.c:710
gic_handle_irq+0x78/0x1c8 drivers/irqchip/irq-gic-v3.c:758
call_on_irq_stack+0x24/0x4c arch/arm64/kernel/entry.S:899
do_interrupt_handler+0x74/0x94 arch/arm64/kernel/entry-common.c:267
el1_interrupt+0x30/0x58 arch/arm64/kernel/entry-common.c:454
el1h_64_irq_handler+0x18/0x24 arch/arm64/kernel/entry-common.c:470
el1h_64_irq+0x78/0x7c arch/arm64/kernel/entry.S:580
check_kcov_mode kernel/kcov.c:163 [inline]
__sanitizer_cov_trace_pc+0x5c/0x94 kernel/kcov.c:197
unwind_frame+0x31c/0x550 arch/arm64/kernel/stacktrace.c:113
walk_stackframe arch/arm64/kernel/stacktrace.c:148 [inline]
arch_stack_walk+0x270/0x32c arch/arm64/kernel/stacktrace.c:238
stack_trace_save+0xfc/0x1a0 kernel/stacktrace.c:122
kasan_save_stack mm/kasan/common.c:38 [inline]
kasan_set_track mm/kasan/common.c:46 [inline]
set_alloc_info mm/kasan/common.c:434 [inline]
__kasan_slab_alloc+0x8c/0xcc mm/kasan/common.c:467
kasan_slab_alloc include/linux/kasan.h:254 [inline]
slab_post_alloc_hook+0x74/0x3f4 mm/slab.h:519
slab_alloc_node mm/slub.c:3220 [inline]
kmem_cache_alloc_node+0x208/0x49c mm/slub.c:3256
alloc_vmap_area+0x158/0x16a8 mm/vmalloc.c:1531
__get_vm_area_node+0x178/0x2e0 mm/vmalloc.c:2423
__vmalloc_node_range+0xe4/0x8e4 mm/vmalloc.c:3019
__vmalloc_node mm/vmalloc.c:3079 [inline]
vzalloc+0x128/0x19c mm/vmalloc.c:3149
alloc_counters+0x84/0x7ec net/ipv4/netfilter/ip_tables.c:800
copy_entries_to_user net/ipv6/netfilter/ip6_tables.c:839 [inline]
get_entries net/ipv6/netfilter/ip6_tables.c:1041 [inline]
do_ip6t_get_ctl+0xc78/0x17fc net/ipv6/netfilter/ip6_tables.c:1671
nf_getsockopt+0x264/0x284 net/netfilter/nf_sockopt.c:116
ipv6_getsockopt+0x58c/0x3470 net/ipv6/ipv6_sockglue.c:1489
tcp_getsockopt+0x294/0x797c net/ipv4/tcp.c:4304
sock_common_getsockopt+0xa8/0xc4 net/core/sock.c:3405
__sys_getsockopt+0x1e8/0x460 net/socket.c:2242
__do_sys_getsockopt net/socket.c:2257 [inline]
__se_sys_getsockopt net/socket.c:2254 [inline]
__arm64_sys_getsockopt+0xb8/0xd4 net/socket.c:2254
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608
el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626
el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

Allocated by task 3991:
kasan_save_stack mm/kasan/common.c:38 [inline]
kasan_set_track mm/kasan/common.c:46 [inline]
set_alloc_info mm/kasan/common.c:434 [inline]
__kasan_slab_alloc+0x8c/0xcc mm/kasan/common.c:467
kasan_slab_alloc include/linux/kasan.h:254 [inline]
slab_post_alloc_hook+0x74/0x3f4 mm/slab.h:519
slab_alloc_node mm/slub.c:3220 [inline]
slab_alloc mm/slub.c:3228 [inline]
kmem_cache_alloc+0x1dc/0x45c mm/slub.c:3233
kmem_cache_zalloc include/linux/slab.h:711 [inline]
net_alloc net/core/net_namespace.c:405 [inline]
copy_net_ns+0x128/0x5e4 net/core/net_namespace.c:460
create_new_namespaces+0x330/0x61c kernel/nsproxy.c:110
unshare_nsproxy_namespaces+0x108/0x158 kernel/nsproxy.c:226
ksys_unshare+0x45c/0x874 kernel/fork.c:3101
__do_sys_unshare kernel/fork.c:3175 [inline]
__se_sys_unshare kernel/fork.c:3173 [inline]
__arm64_sys_unshare+0x3c/0x50 kernel/fork.c:3173
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608
el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626
el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

Freed by task 136:
kasan_save_stack mm/kasan/common.c:38 [inline]
kasan_set_track+0x4c/0x84 mm/kasan/common.c:46
kasan_set_free_info+0x28/0x4c mm/kasan/generic.c:360
____kasan_slab_free+0x118/0x164 mm/kasan/common.c:366
__kasan_slab_free+0x18/0x28 mm/kasan/common.c:374
kasan_slab_free include/linux/kasan.h:230 [inline]
slab_free_hook mm/slub.c:1705 [inline]
slab_free_freelist_hook+0x128/0x1ec mm/slub.c:1731
slab_free mm/slub.c:3499 [inline]
kmem_cache_free+0xdc/0x3c4 mm/slub.c:3515
net_free net/core/net_namespace.c:434 [inline]
cleanup_net+0x8a0/0x9bc net/core/net_namespace.c:617
process_one_work+0x790/0x11b8 kernel/workqueue.c:2310
worker_thread+0x910/0x1034 kernel/workqueue.c:2457
kthread+0x37c/0x45c kernel/kthread.c:319
ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:870

The buggy address belongs to the object at ffff0000dc573480
which belongs to the cache net_namespace of size 6464
The buggy address is located 1677 bytes inside of
6464-byte region [ffff0000dc573480, ffff0000dc574dc0)
The buggy address belongs to the page:
page:00000000082df7fe refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff0000dc571a40 pfn:0x11c570
head:00000000082df7fe order:3 compound_mapcount:0 compound_pincount:0
flags: 0x5ffc00000010200(slab|head|node=0|zone=2|lastcpupid=0x7ff)
raw: 05ffc00000010200 0000000000000000 dead000000000122 ffff0000c0840000
raw: ffff0000dc571a40 0000000080040003 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff0000dc573a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff0000dc573a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff0000dc573b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff0000dc573b80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff0000dc573c00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


---
If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.
Reply all
Reply to author
Forward
0 new messages