Eric Dumazet
350a6640fa
ip6_tunnel: make sure to pull inner header in __ip6_tnl_rcv()
...
[ Upstream commit 8d975c15c0cd744000ca386247432d57b21f9df0 ]
syzbot found __ip6_tnl_rcv() could access unitiliazed data [1].
Call pskb_inet_may_pull() to fix this, and initialize ipv6h
variable after this call as it can change skb->head.
[1]
BUG: KMSAN: uninit-value in __INET_ECN_decapsulate include/net/inet_ecn.h:253 [inline]
BUG: KMSAN: uninit-value in INET_ECN_decapsulate include/net/inet_ecn.h:275 [inline]
BUG: KMSAN: uninit-value in IP6_ECN_decapsulate+0x7df/0x1e50 include/net/inet_ecn.h:321
__INET_ECN_decapsulate include/net/inet_ecn.h:253 [inline]
INET_ECN_decapsulate include/net/inet_ecn.h:275 [inline]
IP6_ECN_decapsulate+0x7df/0x1e50 include/net/inet_ecn.h:321
ip6ip6_dscp_ecn_decapsulate+0x178/0x1b0 net/ipv6/ip6_tunnel.c:727
__ip6_tnl_rcv+0xd4e/0x1590 net/ipv6/ip6_tunnel.c:845
ip6_tnl_rcv+0xce/0x100 net/ipv6/ip6_tunnel.c:888
gre_rcv+0x143f/0x1870
ip6_protocol_deliver_rcu+0xda6/0x2a60 net/ipv6/ip6_input.c:438
ip6_input_finish net/ipv6/ip6_input.c:483 [inline]
NF_HOOK include/linux/netfilter.h:314 [inline]
ip6_input+0x15d/0x430 net/ipv6/ip6_input.c:492
ip6_mc_input+0xa7e/0xc80 net/ipv6/ip6_input.c:586
dst_input include/net/dst.h:461 [inline]
ip6_rcv_finish+0x5db/0x870 net/ipv6/ip6_input.c:79
NF_HOOK include/linux/netfilter.h:314 [inline]
ipv6_rcv+0xda/0x390 net/ipv6/ip6_input.c:310
__netif_receive_skb_one_core net/core/dev.c:5532 [inline]
__netif_receive_skb+0x1a6/0x5a0 net/core/dev.c:5646
netif_receive_skb_internal net/core/dev.c:5732 [inline]
netif_receive_skb+0x58/0x660 net/core/dev.c:5791
tun_rx_batched+0x3ee/0x980 drivers/net/tun.c:1555
tun_get_user+0x53af/0x66d0 drivers/net/tun.c:2002
tun_chr_write_iter+0x3af/0x5d0 drivers/net/tun.c:2048
call_write_iter include/linux/fs.h:2084 [inline]
new_sync_write fs/read_write.c:497 [inline]
vfs_write+0x786/0x1200 fs/read_write.c:590
ksys_write+0x20f/0x4c0 fs/read_write.c:643
__do_sys_write fs/read_write.c:655 [inline]
__se_sys_write fs/read_write.c:652 [inline]
__x64_sys_write+0x93/0xd0 fs/read_write.c:652
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0x6d/0x140 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x63/0x6b
Uninit was created at:
slab_post_alloc_hook+0x129/0xa70 mm/slab.h:768
slab_alloc_node mm/slub.c:3478 [inline]
kmem_cache_alloc_node+0x5e9/0xb10 mm/slub.c:3523
kmalloc_reserve+0x13d/0x4a0 net/core/skbuff.c:560
__alloc_skb+0x318/0x740 net/core/skbuff.c:651
alloc_skb include/linux/skbuff.h:1286 [inline]
alloc_skb_with_frags+0xc8/0xbd0 net/core/skbuff.c:6334
sock_alloc_send_pskb+0xa80/0xbf0 net/core/sock.c:2787
tun_alloc_skb drivers/net/tun.c:1531 [inline]
tun_get_user+0x1e8a/0x66d0 drivers/net/tun.c:1846
tun_chr_write_iter+0x3af/0x5d0 drivers/net/tun.c:2048
call_write_iter include/linux/fs.h:2084 [inline]
new_sync_write fs/read_write.c:497 [inline]
vfs_write+0x786/0x1200 fs/read_write.c:590
ksys_write+0x20f/0x4c0 fs/read_write.c:643
__do_sys_write fs/read_write.c:655 [inline]
__se_sys_write fs/read_write.c:652 [inline]
__x64_sys_write+0x93/0xd0 fs/read_write.c:652
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0x6d/0x140 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x63/0x6b
CPU: 0 PID: 5034 Comm: syz-executor331 Not tainted 6.7.0-syzkaller-00562-g9f8413c4a66f #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/2023
Fixes: 0d3c703a9d17 ("ipv6: Cleanup IPv6 tunnel receive path")
Reported-by: syzbot <syzkaller@googlegroups.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20240125170557.2663942-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-02-05 20:14:35 +00:00
..
2024-01-01 12:42:41 +00:00
2024-01-31 16:19:01 -08:00
2023-12-20 17:01:50 +01:00
2023-12-20 17:01:48 +01:00
2023-09-18 12:56:58 +01:00
2023-08-24 10:51:39 -07:00
2024-02-05 20:14:25 +00:00
2024-02-05 20:14:20 +00:00
2024-02-05 20:14:25 +00:00
2023-06-24 15:50:13 -07:00
2023-10-06 12:54:33 +02:00
2023-10-09 13:35:24 +02:00
2024-01-31 16:19:05 -08:00
2023-08-01 21:07:46 -07:00
2023-11-20 11:59:35 +01:00
2023-10-06 15:56:46 -07:00
2024-01-25 15:35:41 -08:00
2023-08-09 13:08:09 -07:00
2024-01-25 15:36:00 -08:00
2023-10-23 10:19:33 -07:00
2023-11-20 11:59:34 +01:00
2023-08-29 17:39:15 -07:00
2024-01-01 12:42:30 +00:00
2024-01-31 16:19:09 -08:00
2024-02-05 20:14:35 +00:00
2024-02-05 20:14:25 +00:00
2023-08-18 12:44:56 -07:00
2023-11-20 11:58:56 +01:00
2024-01-31 16:19:01 -08:00
2024-01-31 16:19:00 -08:00
2023-06-24 15:41:46 -07:00
2023-10-10 19:43:22 -07:00
2023-08-15 15:26:18 -07:00
2024-01-25 15:35:59 -08:00
2024-01-25 15:35:20 -08:00
2024-01-31 16:19:06 -08:00
2024-01-25 15:35:14 -08:00
2024-01-31 16:19:02 -08:00
2023-08-28 06:58:46 +01:00
2024-01-20 11:51:46 +01:00
2023-06-10 00:11:41 -07:00
2023-11-20 11:59:37 +01:00
2023-12-13 18:45:23 +01:00
2023-06-24 15:50:13 -07:00
2023-12-13 18:45:10 +01:00
2024-01-20 11:51:47 +01:00
2024-01-31 16:19:01 -08:00
2024-01-01 12:42:41 +00:00
2024-01-01 12:42:31 +00:00
2024-02-05 20:14:16 +00:00
2024-01-31 16:19:02 -08:00
2024-01-25 15:35:30 -08:00
2024-02-05 20:14:25 +00:00
2024-02-05 20:14:17 +00:00
2023-07-21 08:54:03 +01:00
2023-11-28 17:19:51 +00:00
2024-01-25 15:35:58 -08:00
2024-01-25 15:35:30 -08:00
2024-01-25 15:35:26 -08:00
2024-02-05 20:14:34 +00:00
2023-06-24 15:50:13 -07:00
2024-01-31 16:19:04 -08:00
2023-10-17 18:21:13 -07:00
2023-07-19 10:07:27 -07:00
2024-01-10 17:16:51 +01:00
2023-08-15 15:26:17 -07:00