2021-01-13 20:50:04

by syzbot

[permalink] [raw]
Subject: KMSAN: uninit-value in ip_route_output_key_hash_rcu (4)

Hello,

syzbot found the following issue on:

HEAD commit: 73d62e81 kmsan: random: prevent boot-time reports in _mix_..
git tree: https://github.com/google/kmsan.git master
console output: https://syzkaller.appspot.com/x/log.txt?x=10998e93500000
kernel config: https://syzkaller.appspot.com/x/.config?x=2cdf4151c9653e32
dashboard link: https://syzkaller.appspot.com/bug?extid=549e451574ba8bfd0fd6
compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project.git ca2dcbd030eadbf0aa9b660efe864ff08af6e18b)

Unfortunately, I don't have any reproducer for this issue yet.

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: [email protected]

=====================================================
BUG: KMSAN: uninit-value in ip_route_output_key_hash_rcu+0xe77/0x1f20 net/ipv4/route.c:2588
CPU: 1 PID: 8547 Comm: syz-executor.0 Not tainted 5.10.0-rc4-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x21c/0x280 lib/dump_stack.c:118
kmsan_report+0xf7/0x1e0 mm/kmsan/kmsan_report.c:118
__msan_warning+0x5f/0xa0 mm/kmsan/kmsan_instr.c:197
ip_route_output_key_hash_rcu+0xe77/0x1f20 net/ipv4/route.c:2588
ip_route_output_key_hash+0x21b/0x2d0 net/ipv4/route.c:2507
__ip_route_output_key include/net/route.h:126 [inline]
xfrmi_xmit+0x4cb/0x1fd0 net/xfrm/xfrm_interface.c:376
__netdev_start_xmit include/linux/netdevice.h:4718 [inline]
netdev_start_xmit include/linux/netdevice.h:4732 [inline]
xmit_one+0x2b9/0x770 net/core/dev.c:3564
dev_hard_start_xmit net/core/dev.c:3580 [inline]
__dev_queue_xmit+0x33f2/0x4520 net/core/dev.c:4140
dev_queue_xmit+0x4b/0x60 net/core/dev.c:4173
packet_snd net/packet/af_packet.c:2992 [inline]
packet_sendmsg+0x86f9/0x99d0 net/packet/af_packet.c:3017
sock_sendmsg_nosec net/socket.c:651 [inline]
sock_sendmsg net/socket.c:671 [inline]
____sys_sendmsg+0xc7a/0x1240 net/socket.c:2353
___sys_sendmsg net/socket.c:2407 [inline]
__sys_sendmmsg+0xa56/0x1060 net/socket.c:2497
__do_sys_sendmmsg net/socket.c:2526 [inline]
__se_sys_sendmmsg+0xbd/0xe0 net/socket.c:2523
__x64_sys_sendmmsg+0x56/0x70 net/socket.c:2523
do_syscall_64+0x9f/0x140 arch/x86/entry/common.c:48
entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x45e219
Code: 0d b4 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 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 0f 83 db b3 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f2026f42c68 EFLAGS: 00000246 ORIG_RAX: 0000000000000133
RAX: ffffffffffffffda RBX: 0000000000000004 RCX: 000000000045e219
RDX: 0000000000000001 RSI: 00000000200066c0 RDI: 0000000000000003
RBP: 000000000119c070 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000119c034
R13: 00000000016afb5f R14: 00007f2026f439c0 R15: 000000000119c034

Uninit was stored to memory at:
kmsan_save_stack_with_flags mm/kmsan/kmsan.c:121 [inline]
kmsan_internal_chain_origin+0xad/0x130 mm/kmsan/kmsan.c:289
__msan_chain_origin+0x57/0xa0 mm/kmsan/kmsan_instr.c:147
decode_session4 net/xfrm/xfrm_policy.c:3285 [inline]
__xfrm_decode_session+0x15d5/0x3890 net/xfrm/xfrm_policy.c:3481
xfrm_decode_session include/net/xfrm.h:1137 [inline]
xfrmi_xmit+0x243/0x1fd0 net/xfrm/xfrm_interface.c:369
__netdev_start_xmit include/linux/netdevice.h:4718 [inline]
netdev_start_xmit include/linux/netdevice.h:4732 [inline]
xmit_one+0x2b9/0x770 net/core/dev.c:3564
dev_hard_start_xmit net/core/dev.c:3580 [inline]
__dev_queue_xmit+0x33f2/0x4520 net/core/dev.c:4140
dev_queue_xmit+0x4b/0x60 net/core/dev.c:4173
packet_snd net/packet/af_packet.c:2992 [inline]
packet_sendmsg+0x86f9/0x99d0 net/packet/af_packet.c:3017
sock_sendmsg_nosec net/socket.c:651 [inline]
sock_sendmsg net/socket.c:671 [inline]
____sys_sendmsg+0xc7a/0x1240 net/socket.c:2353
___sys_sendmsg net/socket.c:2407 [inline]
__sys_sendmmsg+0xa56/0x1060 net/socket.c:2497
__do_sys_sendmmsg net/socket.c:2526 [inline]
__se_sys_sendmmsg+0xbd/0xe0 net/socket.c:2523
__x64_sys_sendmmsg+0x56/0x70 net/socket.c:2523
do_syscall_64+0x9f/0x140 arch/x86/entry/common.c:48
entry_SYSCALL_64_after_hwframe+0x44/0xa9

Uninit was created at:
kmsan_save_stack_with_flags mm/kmsan/kmsan.c:121 [inline]
kmsan_internal_poison_shadow+0x5c/0xf0 mm/kmsan/kmsan.c:104
kmsan_slab_alloc+0x8d/0xe0 mm/kmsan/kmsan_hooks.c:76
slab_alloc_node mm/slub.c:2906 [inline]
__kmalloc_node_track_caller+0xc61/0x15f0 mm/slub.c:4512
__kmalloc_reserve net/core/skbuff.c:142 [inline]
__alloc_skb+0x309/0xae0 net/core/skbuff.c:210
alloc_skb include/linux/skbuff.h:1094 [inline]
alloc_skb_with_frags+0x1f3/0xc20 net/core/skbuff.c:5832
sock_alloc_send_pskb+0xc73/0xe40 net/core/sock.c:2329
packet_alloc_skb net/packet/af_packet.c:2840 [inline]
packet_snd net/packet/af_packet.c:2935 [inline]
packet_sendmsg+0x6aa3/0x99d0 net/packet/af_packet.c:3017
sock_sendmsg_nosec net/socket.c:651 [inline]
sock_sendmsg net/socket.c:671 [inline]
____sys_sendmsg+0xc7a/0x1240 net/socket.c:2353
___sys_sendmsg net/socket.c:2407 [inline]
__sys_sendmmsg+0xa56/0x1060 net/socket.c:2497
__do_sys_sendmmsg net/socket.c:2526 [inline]
__se_sys_sendmmsg+0xbd/0xe0 net/socket.c:2523
__x64_sys_sendmmsg+0x56/0x70 net/socket.c:2523
do_syscall_64+0x9f/0x140 arch/x86/entry/common.c:48
entry_SYSCALL_64_after_hwframe+0x44/0xa9
=====================================================


---
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 [email protected].

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.


2023-12-07 13:36:55

by lee bruce

[permalink] [raw]
Subject: Re: KMSAN: uninit-value in ip_route_output_key_hash_rcu (4)

Hello

I reproduced this bug in the latest upstream linux with repro.c and repro.txt

When fuzzing the latest upstream linux 6.7-rc4, the following crash
was triggered.
HEAD commit: bee0e7762ad2c6025b9f5245c040fcc36ef2bde8

If you fix this issue, please add the following tag to the commit:
Reported-by: xingwei Lee <[email protected]>

console_log: https://gist.github.com/xrivendell7/195eb3c1946ea466f9d8f5977b90c6ed#file-console_log
report: https://gist.github.com/xrivendell7/195eb3c1946ea466f9d8f5977b90c6ed#file-report
kernel commit: bee0e7762ad2c6025b9f5245c040fcc36ef2bde8
kernel config: https://syzkaller.appspot.com/text?tag=KernelConfig&x=ce27066613dacbb6
repro.c: https://gist.github.com/xrivendell7/195eb3c1946ea466f9d8f5977b90c6ed#file-repro-c
repro.txt: https://gist.github.com/xrivendell7/195eb3c1946ea466f9d8f5977b90c6ed#file-repro-txt

In the lasted kernel: bee0e7762ad2c6025b9f5245c040fcc36ef2bde8 the
crash likes below:
[ 209.523497][ T8593] =====================================================
[ 209.530316][ T8593] BUG: KMSAN: uninit-value in
ip_route_output_key_hash_rcu+0x1ee8/0x3810
[ 209.533357][ T8593] ip_route_output_key_hash_rcu+0x1ee8/0x3810
[ 209.535524][ T8593] ip_route_output_flow+0x14f/0x320
[ 209.537312][ T8593] ip_tunnel_xmit+0x1450/0x3e80
[ 209.538995][ T8593] ipgre_xmit+0xd1c/0xe20
[ 209.540511][ T8593] dev_hard_start_xmit+0x247/0xa10
[ 209.542211][ T8593] __dev_queue_xmit+0x33b8/0x5130
[ 209.543742][ T8593] __bpf_redirect+0xdd7/0x1600
[ 209.545235][ T8593] bpf_clone_redirect+0x328/0x470
[ 209.546807][ T8593] ___bpf_prog_run+0x2180/0xdb80
[ 209.548288][ T8593] __bpf_prog_run512+0xb5/0xe0
[ 209.549864][ T8593] bpf_test_run+0x482/0xb00
[ 209.551178][ T8593] bpf_prog_test_run_skb+0x14e5/0x1f20
[ 209.552612][ T8593] bpf_prog_test_run+0x6af/0xac0
[ 209.553902][ T8593] __sys_bpf+0x649/0xd60
[ 209.555000][ T8593] __x64_sys_bpf+0xa0/0xe0
[ 209.556114][ T8593] do_syscall_64+0x44/0x110
[ 209.557249][ T8593] entry_SYSCALL_64_after_hwframe+0x63/0x6b
[ 209.558676][ T8593]
[ 209.559232][ T8593] Uninit was stored to memory at:
[ 209.560528][ T8593] ip_tunnel_xmit+0x1161/0x3e80
[ 209.561676][ T8593] ipgre_xmit+0xd1c/0xe20
[ 209.562711][ T8593] dev_hard_start_xmit+0x247/0xa10
[ 209.563864][ T8593] __dev_queue_xmit+0x33b8/0x5130
[ 209.564963][ T8593] __bpf_redirect+0xdd7/0x1600
[ 209.566044][ T8593] bpf_clone_redirect+0x328/0x470
[ 209.567151][ T8593] ___bpf_prog_run+0x2180/0xdb80
[ 209.568184][ T8593] __bpf_prog_run512+0xb5/0xe0
[ 209.569187][ T8593] bpf_test_run+0x482/0xb00
[ 209.570201][ T8593] bpf_prog_test_run_skb+0x14e5/0x1f20
[ 209.571308][ T8593] bpf_prog_test_run+0x6af/0xac0
[ 209.572284][ T8593] __sys_bpf+0x649/0xd60
[ 209.573131][ T8593] __x64_sys_bpf+0xa0/0xe0
[ 209.574010][ T8593] do_syscall_64+0x44/0x110
[ 209.574902][ T8593] entry_SYSCALL_64_after_hwframe+0x63/0x6b
[ 209.576008][ T8593]
[ 209.576456][ T8593] Uninit was created at:
[ 209.577301][ T8593] slab_post_alloc_hook+0x129/0xa70
[ 209.578284][ T8593] kmem_cache_alloc_node+0x5e9/0xb10
[ 209.579233][ T8593] kmalloc_reserve+0x13d/0x4a0
[ 209.580177][ T8593] pskb_expand_head+0x226/0x1a00
[ 209.581096][ T8593] skb_ensure_writable+0x3d3/0x460
[ 209.582015][ T8593] bpf_clone_redirect+0x17f/0x470
[ 209.582963][ T8593] ___bpf_prog_run+0x2180/0xdb80
[ 209.583859][ T8593] __bpf_prog_run512+0xb5/0xe0
[ 209.584725][ T8593] bpf_test_run+0x482/0xb00
[ 209.585556][ T8593] bpf_prog_test_run_skb+0x14e5/0x1f20
[ 209.586527][ T8593] bpf_prog_test_run+0x6af/0xac0
[ 209.587347][ T8593] __sys_bpf+0x649/0xd60
[ 209.588058][ T8593] __x64_sys_bpf+0xa0/0xe0
[ 209.588802][ T8593] do_syscall_64+0x44/0x110
[ 209.589613][ T8593] entry_SYSCALL_64_after_hwframe+0x63/0x6b

2023-12-07 14:24:40

by Eric Dumazet

[permalink] [raw]
Subject: Re: KMSAN: uninit-value in ip_route_output_key_hash_rcu (4)

On Thu, Dec 7, 2023 at 2:36 PM xingwei lee <[email protected]> wrote:
>
> Hello
>
> I reproduced this bug in the latest upstream linux with repro.c and repro.txt
>
> When fuzzing the latest upstream linux 6.7-rc4, the following crash
> was triggered.
> HEAD commit: bee0e7762ad2c6025b9f5245c040fcc36ef2bde8
>
> If you fix this issue, please add the following tag to the commit:
> Reported-by: xingwei Lee <[email protected]>
>
> console_log: https://gist.github.com/xrivendell7/195eb3c1946ea466f9d8f5977b90c6ed#file-console_log
> report: https://gist.github.com/xrivendell7/195eb3c1946ea466f9d8f5977b90c6ed#file-report
> kernel commit: bee0e7762ad2c6025b9f5245c040fcc36ef2bde8
> kernel config: https://syzkaller.appspot.com/text?tag=KernelConfig&x=ce27066613dacbb6
> repro.c: https://gist.github.com/xrivendell7/195eb3c1946ea466f9d8f5977b90c6ed#file-repro-c
> repro.txt: https://gist.github.com/xrivendell7/195eb3c1946ea466f9d8f5977b90c6ed#file-repro-txt
>
> In the lasted kernel: bee0e7762ad2c6025b9f5245c040fcc36ef2bde8 the
> crash likes below:
> [ 209.523497][ T8593] =====================================================
> [ 209.530316][ T8593] BUG: KMSAN: uninit-value in
> ip_route_output_key_hash_rcu+0x1ee8/0x3810
> [ 209.533357][ T8593] ip_route_output_key_hash_rcu+0x1ee8/0x3810
> [ 209.535524][ T8593] ip_route_output_flow+0x14f/0x320
> [ 209.537312][ T8593] ip_tunnel_xmit+0x1450/0x3e80
> [ 209.538995][ T8593] ipgre_xmit+0xd1c/0xe20
> [ 209.540511][ T8593] dev_hard_start_xmit+0x247/0xa10
> [ 209.542211][ T8593] __dev_queue_xmit+0x33b8/0x5130
> [ 209.543742][ T8593] __bpf_redirect+0xdd7/0x1600
> [ 209.545235][ T8593] bpf_clone_redirect+0x328/0x470
> [ 209.546807][ T8593] ___bpf_prog_run+0x2180/0xdb80
> [ 209.548288][ T8593] __bpf_prog_run512+0xb5/0xe0
> [ 209.549864][ T8593] bpf_test_run+0x482/0xb00
> [ 209.551178][ T8593] bpf_prog_test_run_skb+0x14e5/0x1f20
> [ 209.552612][ T8593] bpf_prog_test_run+0x6af/0xac0
> [ 209.553902][ T8593] __sys_bpf+0x649/0xd60
> [ 209.555000][ T8593] __x64_sys_bpf+0xa0/0xe0
> [ 209.556114][ T8593] do_syscall_64+0x44/0x110
> [ 209.557249][ T8593] entry_SYSCALL_64_after_hwframe+0x63/0x6b
> [ 209.558676][ T8593]
> [ 209.559232][ T8593] Uninit was stored to memory at:
> [ 209.560528][ T8593] ip_tunnel_xmit+0x1161/0x3e80
> [ 209.561676][ T8593] ipgre_xmit+0xd1c/0xe20
> [ 209.562711][ T8593] dev_hard_start_xmit+0x247/0xa10
> [ 209.563864][ T8593] __dev_queue_xmit+0x33b8/0x5130
> [ 209.564963][ T8593] __bpf_redirect+0xdd7/0x1600
> [ 209.566044][ T8593] bpf_clone_redirect+0x328/0x470
> [ 209.567151][ T8593] ___bpf_prog_run+0x2180/0xdb80
> [ 209.568184][ T8593] __bpf_prog_run512+0xb5/0xe0
> [ 209.569187][ T8593] bpf_test_run+0x482/0xb00
> [ 209.570201][ T8593] bpf_prog_test_run_skb+0x14e5/0x1f20
> [ 209.571308][ T8593] bpf_prog_test_run+0x6af/0xac0
> [ 209.572284][ T8593] __sys_bpf+0x649/0xd60
> [ 209.573131][ T8593] __x64_sys_bpf+0xa0/0xe0
> [ 209.574010][ T8593] do_syscall_64+0x44/0x110
> [ 209.574902][ T8593] entry_SYSCALL_64_after_hwframe+0x63/0x6b
> [ 209.576008][ T8593]
> [ 209.576456][ T8593] Uninit was created at:
> [ 209.577301][ T8593] slab_post_alloc_hook+0x129/0xa70
> [ 209.578284][ T8593] kmem_cache_alloc_node+0x5e9/0xb10
> [ 209.579233][ T8593] kmalloc_reserve+0x13d/0x4a0
> [ 209.580177][ T8593] pskb_expand_head+0x226/0x1a00
> [ 209.581096][ T8593] skb_ensure_writable+0x3d3/0x460
> [ 209.582015][ T8593] bpf_clone_redirect+0x17f/0x470
> [ 209.582963][ T8593] ___bpf_prog_run+0x2180/0xdb80
> [ 209.583859][ T8593] __bpf_prog_run512+0xb5/0xe0
> [ 209.584725][ T8593] bpf_test_run+0x482/0xb00
> [ 209.585556][ T8593] bpf_prog_test_run_skb+0x14e5/0x1f20
> [ 209.586527][ T8593] bpf_prog_test_run+0x6af/0xac0
> [ 209.587347][ T8593] __sys_bpf+0x649/0xd60
> [ 209.588058][ T8593] __x64_sys_bpf+0xa0/0xe0
> [ 209.588802][ T8593] do_syscall_64+0x44/0x110
> [ 209.589613][ T8593] entry_SYSCALL_64_after_hwframe+0x63/0x6b

Please double check the latest net tree.