[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+nYHL_BrPZY1KHiFoC5YRYw0D5_5Gyn8XHxgtAijc7-RiLnBA@mail.gmail.com>
Date: Fri, 18 Oct 2024 13:00:00 +0800
From: Xia Chu <jiangmo9@...il.com>
To: jmaloy@...hat.com, ying.xue@...driver.com, davem@...emloft.net,
edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com,
netdev@...r.kernel.org, tipc-discussion@...ts.sourceforge.net,
linux-kernel@...r.kernel.org, syzkaller@...glegroups.com
Subject: KASAN: use-after-free Read in tipc_udp_send_msg
Hi,
We would like to report the following bug which has been found by our modified
version of syzkaller.
======================================================
description: KASAN: use-after-free Read in tipc_udp_send_msg
affected file: net/tipc/udp_media.c
kernel version: 4.20.0-rc6
kernel commit: f5d582777bcb1c7ff19a5a2343f66ea01de401c6
git tree: upstream
kernel config: attached
crash reproducer: attached
======================================================
Crash log:
BUG: KASAN: use-after-free in atomic_read
include/asm-generic/atomic-instrumented.h:21 [inline]
BUG: KASAN: use-after-free in refcount_read include/linux/refcount.h:43
[inline]
BUG: KASAN: use-after-free in skb_unref include/linux/skbuff.h:969 [inline]
BUG: KASAN: use-after-free in kfree_skb+0xb1/0x430 net/core/skbuff.c:655
Read of size 4 at addr ffff88804efd5ba4 by task syz-executor.6/14936
CPU: 0 PID: 14936 Comm: syz-executor.6 Not tainted 4.20.0-rc6+ #1
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
1.13.0-1ubuntu1.1 04/01/2014
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x1e4/0x2fd lib/dump_stack.c:113
print_address_description.cold.7+0x9/0x1ff mm/kasan/report.c:256
kasan_report_error mm/kasan/report.c:354 [inline]
kasan_report.cold.8+0x242/0x309 mm/kasan/report.c:412
check_memory_region_inline mm/kasan/kasan.c:260 [inline]
check_memory_region+0x13e/0x1b0 mm/kasan/kasan.c:267
kasan_check_read+0x11/0x20 mm/kasan/kasan.c:272
atomic_read include/asm-generic/atomic-instrumented.h:21 [inline]
refcount_read include/linux/refcount.h:43 [inline]
skb_unref include/linux/skbuff.h:969 [inline]
kfree_skb+0xb1/0x430 net/core/skbuff.c:655
tipc_udp_send_msg+0x48a/0x4a0 net/tipc/udp_media.c:249
tipc_bearer_xmit_skb+0x11c/0x280 net/tipc/bearer.c:502
tipc_enable_bearer+0x9d6/0xac0 net/tipc/bearer.c:327
__tipc_nl_bearer_enable+0x264/0x300 net/tipc/bearer.c:897
tipc_nl_bearer_enable+0x22/0x30 net/tipc/bearer.c:905
genl_family_rcv_msg+0x579/0x950 net/netlink/genetlink.c:601
genl_rcv_msg+0x84/0xe7 net/netlink/genetlink.c:626
netlink_rcv_skb+0x10b/0x2c0 net/netlink/af_netlink.c:2477
genl_rcv+0x28/0x40 net/netlink/genetlink.c:637
netlink_unicast_kernel net/netlink/af_netlink.c:1310 [inline]
netlink_unicast+0x407/0x4c0 net/netlink/af_netlink.c:1336
netlink_sendmsg+0x53b/0x880 net/netlink/af_netlink.c:1917
sock_sendmsg_nosec net/socket.c:621 [inline]
sock_sendmsg+0x8f/0xb0 net/socket.c:631
___sys_sendmsg+0x5ba/0x5d0 net/socket.c:2116
__sys_sendmsg+0x119/0x1e0 net/socket.c:2154
__do_sys_sendmsg net/socket.c:2163 [inline]
__se_sys_sendmsg net/socket.c:2161 [inline]
__x64_sys_sendmsg+0x48/0x50 net/socket.c:2161
do_syscall_64+0x182/0x570 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x466fdd
Code: 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 f3 0f 1e fa 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 bc ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f664f4ddc48 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 000000000054bf00 RCX: 0000000000466fdd
RDX: 0000000000000080 RSI: 0000000020001e40 RDI: 0000000000000003
RBP: 00000000ffffffff R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f664f4de6bc
R13: 00000000000009d5 R14: 00000000004ce48d R15: 00000000005085e0
Allocated by task 14936:
save_stack+0x43/0xd0 mm/kasan/kasan.c:448
set_track mm/kasan/kasan.c:460 [inline]
kasan_kmalloc+0xc7/0xe0 mm/kasan/kasan.c:553
kasan_slab_alloc+0x12/0x20 mm/kasan/kasan.c:490
kmem_cache_alloc_node+0x144/0x730 mm/slab.c:3644
__alloc_skb+0x10a/0x500 net/core/skbuff.c:193
__pskb_copy_fclone+0x109/0x720 net/core/skbuff.c:1385
__pskb_copy include/linux/skbuff.h:1053 [inline]
pskb_copy include/linux/skbuff.h:2915 [inline]
tipc_udp_send_msg+0x33e/0x4a0 net/tipc/udp_media.c:241
tipc_bearer_xmit_skb+0x11c/0x280 net/tipc/bearer.c:502
tipc_enable_bearer+0x9d6/0xac0 net/tipc/bearer.c:327
__tipc_nl_bearer_enable+0x264/0x300 net/tipc/bearer.c:897
tipc_nl_bearer_enable+0x22/0x30 net/tipc/bearer.c:905
genl_family_rcv_msg+0x579/0x950 net/netlink/genetlink.c:601
genl_rcv_msg+0x84/0xe7 net/netlink/genetlink.c:626
netlink_rcv_skb+0x10b/0x2c0 net/netlink/af_netlink.c:2477
genl_rcv+0x28/0x40 net/netlink/genetlink.c:637
netlink_unicast_kernel net/netlink/af_netlink.c:1310 [inline]
netlink_unicast+0x407/0x4c0 net/netlink/af_netlink.c:1336
netlink_sendmsg+0x53b/0x880 net/netlink/af_netlink.c:1917
sock_sendmsg_nosec net/socket.c:621 [inline]
sock_sendmsg+0x8f/0xb0 net/socket.c:631
___sys_sendmsg+0x5ba/0x5d0 net/socket.c:2116
__sys_sendmsg+0x119/0x1e0 net/socket.c:2154
__do_sys_sendmsg net/socket.c:2163 [inline]
__se_sys_sendmsg net/socket.c:2161 [inline]
__x64_sys_sendmsg+0x48/0x50 net/socket.c:2161
do_syscall_64+0x182/0x570 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe
Freed by task 14936:
save_stack+0x43/0xd0 mm/kasan/kasan.c:448
set_track mm/kasan/kasan.c:460 [inline]
__kasan_slab_free+0x102/0x150 mm/kasan/kasan.c:521
kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
__cache_free mm/slab.c:3498 [inline]
kmem_cache_free+0x83/0x290 mm/slab.c:3760
kfree_skbmem+0x138/0x1b0 net/core/skbuff.c:582
__kfree_skb net/core/skbuff.c:642 [inline]
kfree_skb+0x176/0x430 net/core/skbuff.c:659
tipc_udp_xmit.isra.14+0x25e/0x630 net/tipc/udp_media.c:207
tipc_udp_send_msg+0x2a7/0x4a0 net/tipc/udp_media.c:247
tipc_bearer_xmit_skb+0x11c/0x280 net/tipc/bearer.c:502
tipc_enable_bearer+0x9d6/0xac0 net/tipc/bearer.c:327
__tipc_nl_bearer_enable+0x264/0x300 net/tipc/bearer.c:897
tipc_nl_bearer_enable+0x22/0x30 net/tipc/bearer.c:905
genl_family_rcv_msg+0x579/0x950 net/netlink/genetlink.c:601
genl_rcv_msg+0x84/0xe7 net/netlink/genetlink.c:626
netlink_rcv_skb+0x10b/0x2c0 net/netlink/af_netlink.c:2477
genl_rcv+0x28/0x40 net/netlink/genetlink.c:637
netlink_unicast_kernel net/netlink/af_netlink.c:1310 [inline]
netlink_unicast+0x407/0x4c0 net/netlink/af_netlink.c:1336
netlink_sendmsg+0x53b/0x880 net/netlink/af_netlink.c:1917
sock_sendmsg_nosec net/socket.c:621 [inline]
sock_sendmsg+0x8f/0xb0 net/socket.c:631
___sys_sendmsg+0x5ba/0x5d0 net/socket.c:2116
__sys_sendmsg+0x119/0x1e0 net/socket.c:2154
__do_sys_sendmsg net/socket.c:2163 [inline]
__se_sys_sendmsg net/socket.c:2161 [inline]
__x64_sys_sendmsg+0x48/0x50 net/socket.c:2161
do_syscall_64+0x182/0x570 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe
The buggy address belongs to the object at ffff88804efd5ac0
which belongs to the cache skbuff_head_cache of size 232
The buggy address is located 228 bytes inside of
232-byte region [ffff88804efd5ac0, ffff88804efd5ba8)
The buggy address belongs to the page:
page:ffffea00013bf540 count:1 mapcount:0 mapping:ffff88806bea5780
index:0xffff88804efd5e80
flags: 0x1fffc0000000200(slab)
raw: 01fffc0000000200 ffffea00019c9048 ffffea0001245908 ffff88806bea5780
raw: ffff88804efd5e80 ffff88804efd50c0 0000000100000008 0000000000000000
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffff88804efd5a80: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
ffff88804efd5b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88804efd5b80: fb fb fb fb fb fc fc fc fc fc fc fc fc fc fc fc
^
ffff88804efd5c00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88804efd5c80: fb fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc
======================================================
Wishing you a nice day!
Best regards,
Ditto
Content of type "text/html" skipped
Download attachment "fuzz_config" of type "application/octet-stream" (157373 bytes)
Download attachment "repro.cprog" of type "application/octet-stream" (40825 bytes)
Download attachment "repro.prog" of type "application/octet-stream" (1797 bytes)
Powered by blists - more mailing lists