Eric Dumazet
5b5e7a0de2
net: metrics: add proper netlink validation
Before using nla_get_u32(), better make sure the attribute
is of the proper size.
Code recently was changed, but bug has been there from beginning
of git.
BUG: KMSAN: uninit-value in rtnetlink_put_metrics+0x553/0x960 net/core/rtnetlink.c:746
CPU: 1 PID: 14139 Comm: syz-executor6 Not tainted 4.17.0-rc5+ #103
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+0x185/0x1d0 lib/dump_stack.c:113
kmsan_report+0x149/0x260 mm/kmsan/kmsan.c:1084
__msan_warning_32+0x6e/0xc0 mm/kmsan/kmsan_instr.c:686
rtnetlink_put_metrics+0x553/0x960 net/core/rtnetlink.c:746
fib_dump_info+0xc42/0x2190 net/ipv4/fib_semantics.c:1361
rtmsg_fib+0x65f/0x8c0 net/ipv4/fib_semantics.c:419
fib_table_insert+0x2314/0x2b50 net/ipv4/fib_trie.c:1287
inet_rtm_newroute+0x210/0x340 net/ipv4/fib_frontend.c:779
rtnetlink_rcv_msg+0xa32/0x1560 net/core/rtnetlink.c:4646
netlink_rcv_skb+0x378/0x600 net/netlink/af_netlink.c:2448
rtnetlink_rcv+0x50/0x60 net/core/rtnetlink.c:4664
netlink_unicast_kernel net/netlink/af_netlink.c:1310 [inline]
netlink_unicast+0x1678/0x1750 net/netlink/af_netlink.c:1336
netlink_sendmsg+0x104f/0x1350 net/netlink/af_netlink.c:1901
sock_sendmsg_nosec net/socket.c:629 [inline]
sock_sendmsg net/socket.c:639 [inline]
___sys_sendmsg+0xec0/0x1310 net/socket.c:2117
__sys_sendmsg net/socket.c:2155 [inline]
__do_sys_sendmsg net/socket.c:2164 [inline]
__se_sys_sendmsg net/socket.c:2162 [inline]
__x64_sys_sendmsg+0x331/0x460 net/socket.c:2162
do_syscall_64+0x152/0x230 arch/x86/entry/common.c:287
entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x455a09
RSP: 002b:00007faae5fd8c68 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007faae5fd96d4 RCX: 0000000000455a09
RDX: 0000000000000000 RSI: 0000000020000000 RDI: 0000000000000013
RBP: 000000000072bea0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff
R13: 00000000000005d0 R14: 00000000006fdc20 R15: 0000000000000000
Uninit was stored to memory at:
kmsan_save_stack_with_flags mm/kmsan/kmsan.c:279 [inline]
kmsan_save_stack mm/kmsan/kmsan.c:294 [inline]
kmsan_internal_chain_origin+0x12b/0x210 mm/kmsan/kmsan.c:685
__msan_chain_origin+0x69/0xc0 mm/kmsan/kmsan_instr.c:529
fib_convert_metrics net/ipv4/fib_semantics.c:1056 [inline]
fib_create_info+0x2d46/0x9dc0 net/ipv4/fib_semantics.c:1150
fib_table_insert+0x3e4/0x2b50 net/ipv4/fib_trie.c:1146
inet_rtm_newroute+0x210/0x340 net/ipv4/fib_frontend.c:779
rtnetlink_rcv_msg+0xa32/0x1560 net/core/rtnetlink.c:4646
netlink_rcv_skb+0x378/0x600 net/netlink/af_netlink.c:2448
rtnetlink_rcv+0x50/0x60 net/core/rtnetlink.c:4664
netlink_unicast_kernel net/netlink/af_netlink.c:1310 [inline]
netlink_unicast+0x1678/0x1750 net/netlink/af_netlink.c:1336
netlink_sendmsg+0x104f/0x1350 net/netlink/af_netlink.c:1901
sock_sendmsg_nosec net/socket.c:629 [inline]
sock_sendmsg net/socket.c:639 [inline]
___sys_sendmsg+0xec0/0x1310 net/socket.c:2117
__sys_sendmsg net/socket.c:2155 [inline]
__do_sys_sendmsg net/socket.c:2164 [inline]
__se_sys_sendmsg net/socket.c:2162 [inline]
__x64_sys_sendmsg+0x331/0x460 net/socket.c:2162
do_syscall_64+0x152/0x230 arch/x86/entry/common.c:287
entry_SYSCALL_64_after_hwframe+0x44/0xa9
Uninit was created at:
kmsan_save_stack_with_flags mm/kmsan/kmsan.c:279 [inline]
kmsan_internal_poison_shadow+0xb8/0x1b0 mm/kmsan/kmsan.c:189
kmsan_kmalloc+0x94/0x100 mm/kmsan/kmsan.c:315
kmsan_slab_alloc+0x10/0x20 mm/kmsan/kmsan.c:322
slab_post_alloc_hook mm/slab.h:446 [inline]
slab_alloc_node mm/slub.c:2753 [inline]
__kmalloc_node_track_caller+0xb32/0x11b0 mm/slub.c:4395
__kmalloc_reserve net/core/skbuff.c:138 [inline]
__alloc_skb+0x2cb/0x9e0 net/core/skbuff.c:206
alloc_skb include/linux/skbuff.h:988 [inline]
netlink_alloc_large_skb net/netlink/af_netlink.c:1182 [inline]
netlink_sendmsg+0x76e/0x1350 net/netlink/af_netlink.c:1876
sock_sendmsg_nosec net/socket.c:629 [inline]
sock_sendmsg net/socket.c:639 [inline]
___sys_sendmsg+0xec0/0x1310 net/socket.c:2117
__sys_sendmsg net/socket.c:2155 [inline]
__do_sys_sendmsg net/socket.c:2164 [inline]
__se_sys_sendmsg net/socket.c:2162 [inline]
__x64_sys_sendmsg+0x331/0x460 net/socket.c:2162
do_syscall_64+0x152/0x230 arch/x86/entry/common.c:287
entry_SYSCALL_64_after_hwframe+0x44/0xa9
Fixes: a919525ad8
("net: Move fib_convert_metrics to metrics file")
Fixes: 1da177e4c3
("Linux-2.6.12-rc2")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: syzbot <syzkaller@googlegroups.com>
Cc: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-06-05 12:29:43 -04:00
..
2018-05-29 09:51:44 -04:00
2018-06-03 00:02:05 +02:00
2018-04-29 21:29:55 -04:00
2017-11-03 22:11:17 +08:00
2018-04-05 22:05:03 -04:00
2017-10-21 01:33:19 +01:00
2015-07-29 22:44:04 -07:00
2018-05-29 10:12:45 -04:00
2018-02-27 10:46:01 +01:00
2018-02-13 13:59:03 +01:00
2018-05-29 10:12:45 -04:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-04-23 10:21:24 -04:00
2018-06-05 12:29:43 -04:00
2018-05-24 23:00:31 -04:00
2018-03-27 13:18:09 -04:00
2016-06-30 05:03:36 -04:00
2017-10-08 10:12:15 -07:00
2018-03-27 13:18:09 -04:00
2018-03-27 13:18:09 -04:00
2018-05-10 17:43:55 -04:00
2018-03-12 11:03:42 -04:00
2018-03-31 23:25:39 -04:00
2018-02-01 09:48:42 -05:00
2018-04-07 22:32:32 -04:00
2018-04-09 10:57:35 -04:00
2018-03-04 17:49:17 -05:00
2018-04-04 12:04:59 -04:00
2018-05-21 16:01:54 -04:00
2018-03-22 15:12:56 -04:00
2017-11-02 11:10:55 +01:00
2018-05-21 16:01:54 -04:00
2018-05-26 19:46:15 -04:00
2018-05-10 15:13:33 -04:00
2018-06-01 13:56:29 -04:00
2018-03-27 13:18:09 -04:00
2015-04-03 12:11:15 -04:00
2018-05-13 20:27:25 -04:00
2018-03-27 13:18:09 -04:00
2018-06-05 12:26:41 -04:00
2018-04-23 10:21:24 -04:00
2018-03-01 13:13:23 -05:00
2018-05-23 15:14:12 -04:00
2018-06-05 12:29:43 -04:00
2018-01-08 18:11:02 +01:00
2018-05-23 15:14:12 -04:00
2018-05-11 12:00:58 -04:00
2018-05-18 11:40:27 -04:00
2017-03-24 13:17:07 -07:00
2017-08-07 11:39:22 -07:00
2018-03-27 13:18:09 -04:00
2018-05-24 22:20:51 -04:00
2018-03-25 20:53:54 -04:00
2018-06-04 17:13:35 -04:00
2018-05-02 11:12:32 -04:00
2017-08-06 21:25:10 -07:00
2017-10-16 21:24:25 +01:00
2017-11-15 14:09:52 +09:00
2017-08-06 21:25:10 -07:00
2016-12-06 11:34:24 -05:00
2017-12-20 14:00:25 -05:00
2017-12-13 15:51:12 -05:00
2017-08-06 21:25:10 -07:00
2017-08-06 21:25:10 -07:00
2016-11-21 13:20:17 -05:00
2018-02-28 12:03:47 -05:00
2018-06-05 10:09:27 -04:00
2018-06-04 17:13:35 -04:00
2017-05-17 16:06:01 -04:00
2018-03-27 13:18:09 -04:00
2018-06-05 10:45:24 -04:00
2018-01-31 10:26:30 -05:00
2018-01-22 16:01:30 -05:00
2018-05-21 16:01:54 -04:00
2017-12-08 10:07:02 -05:00
2018-05-18 13:28:40 -04:00
2017-08-06 21:25:10 -07:00
2018-05-18 11:40:27 -04:00
2018-02-06 11:39:31 +01:00
2017-09-29 06:07:00 +01:00
2017-11-02 11:10:55 +01:00
2017-08-06 21:25:10 -07:00
2017-08-30 11:20:08 -07:00
2017-08-06 21:25:10 -07:00
2018-05-18 11:40:27 -04:00
2018-02-28 11:43:28 -05:00
2017-08-07 11:39:22 -07:00
2017-11-02 11:10:55 +01:00
2018-05-11 12:29:42 -04:00
2017-07-24 13:52:59 -07:00
2018-06-05 10:55:05 -04:00
2018-03-27 13:18:09 -04:00
2017-12-19 08:23:21 +01:00
2017-06-16 11:48:39 -04:00
2017-04-14 10:07:39 +02:00
2018-03-07 10:54:29 +01:00
2018-03-04 17:49:17 -05:00
2018-03-27 13:18:09 -04:00
2017-02-09 10:22:17 +01:00
2017-11-02 11:10:55 +01:00