Re: [syzbot] KMSAN: uninit-value in tipc_nl_compat_name_table_dump (3)

From: Xin Long
Date: Fri Nov 04 2022 - 11:39:25 EST


On Thu, Nov 3, 2022 at 12:28 PM syzbot
<syzbot+e5dbaaa238680ce206ea@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: 8f4ae27df775 Revert "Revert "crypto: kmsan: disable accele..
> git tree: https://github.com/google/kmsan.git master
> console+strace: https://syzkaller.appspot.com/x/log.txt?x=142d16cf080000
> kernel config: https://syzkaller.appspot.com/x/.config?x=121c7ef28ec597bd
> dashboard link: https://syzkaller.appspot.com/bug?extid=e5dbaaa238680ce206ea
> compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project.git 610139d2d9ce6746b3c617fb3e2f7886272d26ff), GNU ld (GNU Binutils for Debian) 2.35.2
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=176a716f080000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=140256a0880000
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+e5dbaaa238680ce206ea@xxxxxxxxxxxxxxxxxxxxxxxxx
>
> =====================================================
> BUG: KMSAN: uninit-value in tipc_nl_compat_name_table_dump+0x841/0xea0 net/tipc/netlink_compat.c:934
looks we need this:

@@ -880,7 +880,7 @@ static int
tipc_nl_compat_name_table_dump_header(struct tipc_nl_compat_msg *msg)
};

ntq = (struct tipc_name_table_query *)TLV_DATA(msg->req);
- if (TLV_GET_DATA_LEN(msg->req) < sizeof(struct tipc_name_table_query))
+ if (TLV_GET_DATA_LEN(msg->req) < (int)sizeof(struct
tipc_name_table_query))
return -EINVAL;

depth = ntohl(ntq->depth);

as a follow-up of:

commit 974cb0e3e7c963ced06c4e32c5b2884173fa5e01
Author: Ying Xue <ying.xue@xxxxxxxxxxxxx>
Date: Mon Jan 14 17:22:28 2019 +0800

tipc: fix uninit-value in tipc_nl_compat_name_table_dump

> tipc_nl_compat_name_table_dump+0x841/0xea0 net/tipc/netlink_compat.c:934
> __tipc_nl_compat_dumpit+0xab2/0x1320 net/tipc/netlink_compat.c:238
> tipc_nl_compat_dumpit+0x991/0xb50 net/tipc/netlink_compat.c:321
> tipc_nl_compat_recv+0xb6e/0x1640 net/tipc/netlink_compat.c:1324
> genl_family_rcv_msg_doit net/netlink/genetlink.c:731 [inline]
> genl_family_rcv_msg net/netlink/genetlink.c:775 [inline]
> genl_rcv_msg+0x103f/0x1260 net/netlink/genetlink.c:792
> netlink_rcv_skb+0x3a5/0x6c0 net/netlink/af_netlink.c:2501
> genl_rcv+0x3c/0x50 net/netlink/genetlink.c:803
> netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline]
> netlink_unicast+0xf3b/0x1270 net/netlink/af_netlink.c:1345
> netlink_sendmsg+0x1288/0x1440 net/netlink/af_netlink.c:1921
> sock_sendmsg_nosec net/socket.c:714 [inline]
> sock_sendmsg net/socket.c:734 [inline]
> ____sys_sendmsg+0xabc/0xe90 net/socket.c:2482
> ___sys_sendmsg+0x2a1/0x3f0 net/socket.c:2536
> __sys_sendmsg net/socket.c:2565 [inline]
> __do_sys_sendmsg net/socket.c:2574 [inline]
> __se_sys_sendmsg net/socket.c:2572 [inline]
> __x64_sys_sendmsg+0x367/0x540 net/socket.c:2572
> 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
>
> Uninit was created at:
> slab_post_alloc_hook mm/slab.h:732 [inline]
> slab_alloc_node mm/slub.c:3258 [inline]
> __kmalloc_node_track_caller+0x814/0x1250 mm/slub.c:4970
> kmalloc_reserve net/core/skbuff.c:362 [inline]
> __alloc_skb+0x346/0xcf0 net/core/skbuff.c:434
> alloc_skb include/linux/skbuff.h:1257 [inline]
> netlink_alloc_large_skb net/netlink/af_netlink.c:1191 [inline]
> netlink_sendmsg+0xb71/0x1440 net/netlink/af_netlink.c:1896
> sock_sendmsg_nosec net/socket.c:714 [inline]
> sock_sendmsg net/socket.c:734 [inline]
> ____sys_sendmsg+0xabc/0xe90 net/socket.c:2482
> ___sys_sendmsg+0x2a1/0x3f0 net/socket.c:2536
> __sys_sendmsg net/socket.c:2565 [inline]
> __do_sys_sendmsg net/socket.c:2574 [inline]
> __se_sys_sendmsg net/socket.c:2572 [inline]
> __x64_sys_sendmsg+0x367/0x540 net/socket.c:2572
> 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
>
> CPU: 1 PID: 3490 Comm: syz-executor155 Not tainted 6.0.0-rc5-syzkaller-48538-g8f4ae27df775 #0
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/26/2022
> =====================================================
>
>
> ---
> 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 syzkaller@xxxxxxxxxxxxxxxx.
>
> syzbot will keep track of this issue. See:
> https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
> syzbot can test patches for this issue, for details see:
> https://goo.gl/tpsmEJ#testing-patches