==================================================================
BUG: KASAN: slab-use-after-free in sk_fullsock include/net/sock.h:2803 [inline]
BUG: KASAN: slab-use-after-free in ip_skb_dst_mtu+0x830/0x9b0 include/net/ip.h:499
Read of size 1 at addr ffff88807b09c012 by task syz-executor.4/5405
CPU: 1 PID: 5405 Comm: syz-executor.4 Not tainted 6.8.0-syzkaller-08951-gfe46a7dd189e #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+0x241/0x360 lib/dump_stack.c:114
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
sk_fullsock include/net/sock.h:2803 [inline]
ip_skb_dst_mtu+0x830/0x9b0 include/net/ip.h:499
__ip_finish_output+0x12b/0x400 net/ipv4/ip_output.c:306
ipvlan_process_v4_outbound+0x3ef/0x700 drivers/net/ipvlan/ipvlan_core.c:442
ipvlan_process_outbound drivers/net/ipvlan/ipvlan_core.c:540 [inline]
ipvlan_xmit_mode_l3 drivers/net/ipvlan/ipvlan_core.c:602 [inline]
ipvlan_queue_xmit+0xaa2/0x11f0 drivers/net/ipvlan/ipvlan_core.c:668
ipvlan_start_xmit+0x4a/0x150 drivers/net/ipvlan/ipvlan_main.c:222
__netdev_start_xmit include/linux/netdevice.h:4903 [inline]
netdev_start_xmit include/linux/netdevice.h:4917 [inline]
xmit_one net/core/dev.c:3531 [inline]
dev_hard_start_xmit+0x26a/0x790 net/core/dev.c:3547
sch_direct_xmit+0x2b6/0x5f0 net/sched/sch_generic.c:343
qdisc_restart net/sched/sch_generic.c:408 [inline]
__qdisc_run+0xbed/0x2150 net/sched/sch_generic.c:416
qdisc_run+0xda/0x270 include/net/pkt_sched.h:127
net_tx_action+0x877/0xa30 net/core/dev.c:5200
__do_softirq+0x2bc/0x943 kernel/softirq.c:554
invoke_softirq kernel/softirq.c:428 [inline]
__irq_exit_rcu+0xf2/0x1c0 kernel/softirq.c:633
irq_exit_rcu+0x9/0x30 kernel/softirq.c:645
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1043 [inline]
sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1043
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702
RIP: 0010:deref_stack_reg+0x15/0x260 arch/x86/kernel/unwind_orc.c:402
Code: 00 00 00 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 55 41 57 41 56 41 55 41 54 53 48 83 ec 28 49 89 d6 48 89 34 24 <48> 89 fb 49 bf 00 00 00 00 00 fc ff df e8 69 38 54 00 48 8d 6b 08
RSP: 0000:ffffc90013a0edc8 EFLAGS: 00000292
RAX: fffffffffffffff0 RBX: ffffffff900d22dc RCX: 0000000000000000
RDX: ffffc90013a0ef40 RSI: ffffc90013a0f070 RDI: ffffc90013a0ef00
RBP: ffffc90013a0ef00 R08: 0000000000000005 R09: ffffffff8140a8df
R10: 0000000000000003 R11: ffff88805d6c0000 R12: ffffc90013a0f078
R13: dffffc0000000000 R14: ffffc90013a0ef40 R15: 1ffff92002741de0
unwind_next_frame+0x1ab8/0x2a00 arch/x86/kernel/unwind_orc.c:648
arch_stack_walk+0x151/0x1b0 arch/x86/kernel/stacktrace.c:25
stack_trace_save+0x118/0x1d0 kernel/stacktrace.c:122
save_stack+0xfb/0x1f0 mm/page_owner.c:129
__set_page_owner+0x29/0x380 mm/page_owner.c:195
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_mpol+0x3de/0x650 mm/mempolicy.c:2133
vma_alloc_folio+0xf3/0x3f0 mm/mempolicy.c:2172
folio_prealloc+0x31/0x170
wp_page_copy mm/memory.c:3138 [inline]
do_wp_page+0x1222/0x4c90 mm/memory.c:3525
handle_pte_fault mm/memory.c:5180 [inline]
__handle_mm_fault+0x26ad/0x72d0 mm/memory.c:5305
handle_mm_fault+0x3c2/0x8a0 mm/memory.c:5470
do_user_addr_fault arch/x86/mm/fault.c:1362 [inline]
handle_page_fault arch/x86/mm/fault.c:1505 [inline]
exc_page_fault+0x446/0x890 arch/x86/mm/fault.c:1563
asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:623
RIP: 0023:0xf7304fea
Code: 75 ee 8b 44 24 48 89 28 83 c4 2c 5b 5e 5f 5d c3 8b 7c 24 10 89 ee e9 a8 fd ff ff 8d 74 26 00 90 8b 44 24 08 8b 7c 24 10 89 ee <89> 1c 88 e9 91 fe ff ff 8d b6 00 00 00 00 39 f5 74 9d 8d 7e 10 39
RSP: 002b:00000000f7584a40 EFLAGS: 00010246
RAX: 00000000f7455000 RBX: 0000000081a4e937 RCX: 0000000000000937
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000081a4e05d
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000206 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
Allocated by task 5404:
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:3966 [inline]
__kmalloc+0x233/0x4a0 mm/slub.c:3979
kmalloc include/linux/slab.h:632 [inline]
sk_prot_alloc+0xe0/0x210 net/core/sock.c:2080
sk_alloc+0x38/0x370 net/core/sock.c:2133
packet_create+0x104/0x790 net/packet/af_packet.c:3354
__sock_create+0x490/0x920 net/socket.c:1571
sock_create net/socket.c:1622 [inline]
__sys_socket_create net/socket.c:1659 [inline]
__sys_socket+0x150/0x3c0 net/socket.c:1706
__do_sys_socket net/socket.c:1720 [inline]
__se_sys_socket net/socket.c:1718 [inline]
__ia32_sys_socket+0x7a/0x90 net/socket.c:1718
do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline]
__do_fast_syscall_32+0xbe/0x120 arch/x86/entry/common.c:321
do_fast_syscall_32+0x34/0x80 arch/x86/entry/common.c:346
entry_SYSENTER_compat_after_hwframe+0x7a/0x84
Freed by task 5405:
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+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:2106 [inline]
slab_free mm/slub.c:4280 [inline]
kfree+0x14a/0x380 mm/slub.c:4390
sk_prot_free net/core/sock.c:2116 [inline]
__sk_destruct+0x476/0x5f0 net/core/sock.c:2208
skb_orphan include/linux/skbuff.h:3198 [inline]
ip_defrag+0x20a/0x26b0 net/ipv4/ip_fragment.c:490
nf_ct_ipv4_gather_frags net/ipv4/netfilter/nf_defrag_ipv4.c:32 [inline]
ipv4_conntrack_defrag+0x3de/0x5a0 net/ipv4/netfilter/nf_defrag_ipv4.c:87
nf_hook_entry_hookfn include/linux/netfilter.h:154 [inline]
nf_hook_slow+0xc3/0x220 net/netfilter/core.c:626
nf_hook+0x2c4/0x450 include/linux/netfilter.h:269
__ip_local_out+0x3d9/0x4e0 net/ipv4/ip_output.c:118
ip_local_out+0x26/0x70 net/ipv4/ip_output.c:127
ipvlan_process_v4_outbound+0x3ef/0x700 drivers/net/ipvlan/ipvlan_core.c:442
ipvlan_process_outbound drivers/net/ipvlan/ipvlan_core.c:540 [inline]
ipvlan_xmit_mode_l3 drivers/net/ipvlan/ipvlan_core.c:602 [inline]
ipvlan_queue_xmit+0xaa2/0x11f0 drivers/net/ipvlan/ipvlan_core.c:668
ipvlan_start_xmit+0x4a/0x150 drivers/net/ipvlan/ipvlan_main.c:222
__netdev_start_xmit include/linux/netdevice.h:4903 [inline]
netdev_start_xmit include/linux/netdevice.h:4917 [inline]
xmit_one net/core/dev.c:3531 [inline]
dev_hard_start_xmit+0x26a/0x790 net/core/dev.c:3547
sch_direct_xmit+0x2b6/0x5f0 net/sched/sch_generic.c:343
qdisc_restart net/sched/sch_generic.c:408 [inline]
__qdisc_run+0xbed/0x2150 net/sched/sch_generic.c:416
qdisc_run+0xda/0x270 include/net/pkt_sched.h:127
net_tx_action+0x877/0xa30 net/core/dev.c:5200
__do_softirq+0x2bc/0x943 kernel/softirq.c:554
The buggy address belongs to the object at ffff88807b09c000
which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 18 bytes inside of
freed 4096-byte region [ffff88807b09c000, ffff88807b09d000)
The buggy address belongs to the physical page:
page:ffffea0001ec2600 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7b098
head:ffffea0001ec2600 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0xfff00000000840(slab|head|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000000840 ffff888014c42140 dead000000000122 0000000000000000
raw: 0000000000000000 0000000000040004 00000001ffffffff 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 0x1d2040(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 5098, tgid 5098 (syz-executor.1), ts 74873330040, free_ts 74855963274
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:2175
allocate_slab mm/slub.c:2338 [inline]
new_slab+0x84/0x2f0 mm/slub.c:2391
___slab_alloc+0xc73/0x1260 mm/slub.c:3525
__slab_alloc mm/slub.c:3610 [inline]
__slab_alloc_node mm/slub.c:3663 [inline]
slab_alloc_node mm/slub.c:3835 [inline]
__do_kmalloc_node mm/slub.c:3965 [inline]
__kmalloc+0x2e5/0x4a0 mm/slub.c:3979
kmalloc include/linux/slab.h:632 [inline]
tomoyo_realpath_from_path+0xcf/0x5e0 security/tomoyo/realpath.c:251
tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
tomoyo_check_open_permission+0x255/0x500 security/tomoyo/file.c:771
security_file_open+0x69/0x570 security/security.c:2955
do_dentry_open+0x327/0x15a0 fs/open.c:942
do_open fs/namei.c:3642 [inline]
path_openat+0x2860/0x3240 fs/namei.c:3799
do_filp_open+0x235/0x490 fs/namei.c:3826
do_sys_openat2+0x13e/0x1d0 fs/open.c:1406
do_sys_open fs/open.c:1421 [inline]
__do_compat_sys_openat fs/open.c:1481 [inline]
__se_compat_sys_openat fs/open.c:1479 [inline]
__ia32_compat_sys_openat+0x23f/0x290 fs/open.c:1479
do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline]
__do_fast_syscall_32+0xbe/0x120 arch/x86/entry/common.c:321
page last free pid 5057 tgid 5057 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
discard_slab mm/slub.c:2437 [inline]
__put_partials+0xeb/0x130 mm/slub.c:2906
put_cpu_partial+0x17c/0x250 mm/slub.c:2981
__slab_free+0x2ea/0x3d0 mm/slub.c:4151
qlink_free mm/kasan/quarantine.c:163 [inline]
qlist_free_all+0x5e/0xc0 mm/kasan/quarantine.c:179
kasan_quarantine_reduce+0x14f/0x170 mm/kasan/quarantine.c:286
__kasan_slab_alloc+0x23/0x80 mm/kasan/common.c:322
kasan_slab_alloc include/linux/kasan.h:201 [inline]
slab_post_alloc_hook mm/slub.c:3798 [inline]
slab_alloc_node mm/slub.c:3845 [inline]
kmem_cache_alloc_node+0x194/0x380 mm/slub.c:3888
__alloc_skb+0x1c3/0x440 net/core/skbuff.c:658
alloc_skb_fclone include/linux/skbuff.h:1368 [inline]
tcp_stream_alloc_skb+0x3d/0x310 net/ipv4/tcp.c:873
tcp_sendmsg_locked+0xd94/0x4d00 net/ipv4/tcp.c:1155
tcp_sendmsg+0x30/0x50 net/ipv4/tcp.c:1342
sock_sendmsg_nosec net/socket.c:730 [inline]
__sock_sendmsg+0x1a6/0x270 net/socket.c:745
sock_write_iter+0x2dd/0x400 net/socket.c:1160
call_write_iter include/linux/fs.h:2108 [inline]
new_sync_write fs/read_write.c:497 [inline]
vfs_write+0xa84/0xcb0 fs/read_write.c:590
Memory state around the buggy address:
ffff88807b09bf00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88807b09bf80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88807b09c000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88807b09c080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88807b09c100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
----------------
Code disassembly (best guess):
0: 00 00 add %al,(%rax)
2: 00 00 add %al,(%rax)
4: 90 nop
5: 90 nop
6: 90 nop
7: 90 nop
8: 90 nop
9: 90 nop
a: 90 nop
b: 90 nop
c: 90 nop
d: 90 nop
e: 90 nop
f: 90 nop
10: 90 nop
11: 90 nop
12: 90 nop
13: 90 nop
14: 90 nop
15: 55 push %rbp
16: 41 57 push %r15
18: 41 56 push %r14
1a: 41 55 push %r13
1c: 41 54 push %r12
1e: 53 push %rbx
1f: 48 83 ec 28 sub $0x28,%rsp
23: 49 89 d6 mov %rdx,%r14
26: 48 89 34 24 mov %rsi,(%rsp)
* 2a: 48 89 fb mov %rdi,%rbx <-- trapping instruction
2d: 49 bf 00 00 00 00 00 movabs $0xdffffc0000000000,%r15
34: fc ff df
37: e8 69 38 54 00 call 0x5438a5
3c: 48 8d 6b 08 lea 0x8(%rbx),%rbp