Ziyang Xuan
ea30388bae
ipv6: Fix an uninit variable access bug in __ip6_make_skb()
...
Syzbot reported a bug as following:
=====================================================
BUG: KMSAN: uninit-value in arch_atomic64_inc arch/x86/include/asm/atomic64_64.h:88 [inline]
BUG: KMSAN: uninit-value in arch_atomic_long_inc include/linux/atomic/atomic-long.h:161 [inline]
BUG: KMSAN: uninit-value in atomic_long_inc include/linux/atomic/atomic-instrumented.h:1429 [inline]
BUG: KMSAN: uninit-value in __ip6_make_skb+0x2f37/0x30f0 net/ipv6/ip6_output.c:1956
arch_atomic64_inc arch/x86/include/asm/atomic64_64.h:88 [inline]
arch_atomic_long_inc include/linux/atomic/atomic-long.h:161 [inline]
atomic_long_inc include/linux/atomic/atomic-instrumented.h:1429 [inline]
__ip6_make_skb+0x2f37/0x30f0 net/ipv6/ip6_output.c:1956
ip6_finish_skb include/net/ipv6.h:1122 [inline]
ip6_push_pending_frames+0x10e/0x550 net/ipv6/ip6_output.c:1987
rawv6_push_pending_frames+0xb12/0xb90 net/ipv6/raw.c:579
rawv6_sendmsg+0x297e/0x2e60 net/ipv6/raw.c:922
inet_sendmsg+0x101/0x180 net/ipv4/af_inet.c:827
sock_sendmsg_nosec net/socket.c:714 [inline]
sock_sendmsg net/socket.c:734 [inline]
____sys_sendmsg+0xa8e/0xe70 net/socket.c:2476
___sys_sendmsg+0x2a1/0x3f0 net/socket.c:2530
__sys_sendmsg net/socket.c:2559 [inline]
__do_sys_sendmsg net/socket.c:2568 [inline]
__se_sys_sendmsg net/socket.c:2566 [inline]
__x64_sys_sendmsg+0x367/0x540 net/socket.c:2566
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:766 [inline]
slab_alloc_node mm/slub.c:3452 [inline]
__kmem_cache_alloc_node+0x71f/0xce0 mm/slub.c:3491
__do_kmalloc_node mm/slab_common.c:967 [inline]
__kmalloc_node_track_caller+0x114/0x3b0 mm/slab_common.c:988
kmalloc_reserve net/core/skbuff.c:492 [inline]
__alloc_skb+0x3af/0x8f0 net/core/skbuff.c:565
alloc_skb include/linux/skbuff.h:1270 [inline]
__ip6_append_data+0x51c1/0x6bb0 net/ipv6/ip6_output.c:1684
ip6_append_data+0x411/0x580 net/ipv6/ip6_output.c:1854
rawv6_sendmsg+0x2882/0x2e60 net/ipv6/raw.c:915
inet_sendmsg+0x101/0x180 net/ipv4/af_inet.c:827
sock_sendmsg_nosec net/socket.c:714 [inline]
sock_sendmsg net/socket.c:734 [inline]
____sys_sendmsg+0xa8e/0xe70 net/socket.c:2476
___sys_sendmsg+0x2a1/0x3f0 net/socket.c:2530
__sys_sendmsg net/socket.c:2559 [inline]
__do_sys_sendmsg net/socket.c:2568 [inline]
__se_sys_sendmsg net/socket.c:2566 [inline]
__x64_sys_sendmsg+0x367/0x540 net/socket.c:2566
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
It is because icmp6hdr does not in skb linear region under the scenario
of SOCK_RAW socket. Access icmp6_hdr(skb)->icmp6_type directly will
trigger the uninit variable access bug.
Use a local variable icmp6_type to carry the correct value in different
scenarios.
Fixes: 14878f75abd5 ("[IPV6]: Add ICMPMsgStats MIB (RFC 4293) [rev 2]")
Reported-by: syzbot+8257f4dcef79de670baf@syzkaller.appspotmail.com
Link: https://syzkaller.appspot.com/bug?id=3d605ec1d0a7f2a269a1a6936ac7f2b85975ee9c
Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2023-04-03 10:17:28 +01:00
..
2023-03-01 08:52:49 -08:00
2022-12-25 13:38:09 -08:00
2022-10-28 20:13:54 -07:00
2022-11-24 17:12:15 +01:00
2022-11-16 13:31:03 +00:00
2023-01-21 19:01:59 +01:00
2023-03-23 13:09:38 -07:00
2023-03-06 11:15:54 -08:00
2023-02-22 21:25:23 -08:00
2023-03-02 22:22:07 -08:00
2023-03-27 14:40:45 +02:00
2023-02-21 18:24:12 -08:00
2023-04-02 13:26:21 +01:00
2023-01-20 09:33:22 +00:00
2023-02-10 19:53:42 -08:00
2023-02-20 11:38:35 +00:00
2022-11-01 10:04:52 -07:00
2023-03-30 11:32:46 -07:00
2022-12-07 20:02:44 -08:00
2023-02-21 09:05:01 -08:00
2023-03-16 21:11:03 -07:00
2023-03-17 09:13:53 +01:00
2023-03-31 21:37:06 -07:00
2023-04-03 10:17:28 +01:00
2023-03-16 17:34:40 -07:00
2023-01-23 11:26:50 +00:00
2023-02-13 09:30:14 +00:00
2023-03-31 09:25:12 +01:00
2023-03-30 11:19:53 +02:00
2023-02-20 16:40:52 -08:00
2023-01-28 00:26:09 -08:00
2023-02-15 10:26:37 +00:00
2023-03-10 21:42:56 -08:00
2023-03-16 17:41:28 +00:00
2023-03-08 12:26:42 +01:00
2023-02-09 22:30:24 -08:00
2023-01-30 07:30:47 +00:00
2023-03-07 13:37:05 -08:00
2023-02-23 17:55:40 -08:00
2023-02-15 10:25:21 +00:00
2023-01-23 11:26:50 +00:00
2023-04-03 10:15:45 +01:00
2023-02-13 09:33:39 +00:00
2023-02-14 12:21:14 +01:00
2023-01-28 00:19:57 -08:00
2023-02-21 18:24:12 -08:00
2023-03-16 21:25:45 -07:00
2023-04-02 13:44:58 +01:00
2023-03-15 08:15:19 +00:00
2023-03-25 13:32:43 -07:00
2023-02-21 18:24:12 -08:00
2023-03-06 13:26:16 -08:00
2023-03-08 23:26:03 -08:00
2023-03-31 09:42:30 +01:00
2023-03-17 13:31:16 -07:00
2023-01-25 09:51:04 +00:00
2023-03-16 16:02:55 +01:00
2023-03-16 17:23:48 -07:00
2022-11-25 13:01:55 -05:00
2023-01-05 22:12:00 -08:00
2023-03-08 23:26:51 -08:00