Eric Dumazet
72b49dd116
netfilter: nftables: avoid overflows in nft_hash_buckets()
[ Upstream commit a54754ec98 ]
Number of buckets being stored in 32bit variables, we have to
ensure that no overflows occur in nft_hash_buckets()
syzbot injected a size == 0x40000000 and reported:
UBSAN: shift-out-of-bounds in ./include/linux/log2.h:57:13
shift exponent 64 is too large for 64-bit type 'long unsigned int'
CPU: 1 PID: 29539 Comm: syz-executor.4 Not tainted 5.12.0-rc7-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:79 [inline]
dump_stack+0x141/0x1d7 lib/dump_stack.c:120
ubsan_epilogue+0xb/0x5a lib/ubsan.c:148
__ubsan_handle_shift_out_of_bounds.cold+0xb1/0x181 lib/ubsan.c:327
__roundup_pow_of_two include/linux/log2.h:57 [inline]
nft_hash_buckets net/netfilter/nft_set_hash.c:411 [inline]
nft_hash_estimate.cold+0x19/0x1e net/netfilter/nft_set_hash.c:652
nft_select_set_ops net/netfilter/nf_tables_api.c:3586 [inline]
nf_tables_newset+0xe62/0x3110 net/netfilter/nf_tables_api.c:4322
nfnetlink_rcv_batch+0xa09/0x24b0 net/netfilter/nfnetlink.c:488
nfnetlink_rcv_skb_batch net/netfilter/nfnetlink.c:612 [inline]
nfnetlink_rcv+0x3af/0x420 net/netfilter/nfnetlink.c:630
netlink_unicast_kernel net/netlink/af_netlink.c:1312 [inline]
netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1338
netlink_sendmsg+0x856/0xd90 net/netlink/af_netlink.c:1927
sock_sendmsg_nosec net/socket.c:654 [inline]
sock_sendmsg+0xcf/0x120 net/socket.c:674
____sys_sendmsg+0x6e8/0x810 net/socket.c:2350
___sys_sendmsg+0xf3/0x170 net/socket.c:2404
__sys_sendmsg+0xe5/0x1b0 net/socket.c:2433
do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
Fixes: 0ed6389c48 ("netfilter: nf_tables: rename set implementations")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: syzbot <syzkaller@googlegroups.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-05-19 10:13:09 +02:00
..
2021-01-19 18:27:23 +01:00
2020-11-27 12:10:46 +01:00
2020-10-12 01:57:34 +02:00
2020-10-15 11:45:19 -07:00
2020-04-09 00:12:48 +09:00
2019-05-21 10:50:45 +02:00
2019-06-19 17:09:55 +02:00
2019-07-16 13:16:59 +02:00
2019-07-16 13:16:59 +02:00
2021-02-17 11:02:26 +01:00
2019-10-26 12:36:42 +02:00
2019-09-13 12:33:06 +02:00
2019-12-17 22:59:31 +01:00
2020-07-16 12:35:15 -07:00
2020-07-22 01:18:05 +02:00
2019-07-16 13:16:59 +02:00
2019-06-19 17:09:52 +02:00
2019-09-13 12:33:06 +02:00
2019-07-16 13:16:59 +02:00
2019-08-27 18:07:03 +02:00
2019-05-30 11:26:32 -07:00
2021-03-30 14:31:59 +02:00
2020-08-28 20:11:38 +02:00
2020-01-08 23:31:22 +01:00
2019-06-19 17:09:55 +02:00
2021-04-10 13:36:08 +02:00
2020-05-27 22:20:34 +02:00
2020-05-27 22:20:34 +02:00
2020-08-20 14:13:49 +02:00
2020-10-20 13:54:53 +02:00
2020-08-29 13:03:06 +02:00
2020-09-08 13:04:54 +02:00
2019-07-16 13:16:59 +02:00
2019-05-31 18:02:45 +02:00
2019-07-16 13:16:59 +02:00
2019-05-30 11:26:32 -07:00
2021-05-07 11:04:31 +02:00
2019-07-16 13:16:59 +02:00
2019-09-13 12:33:06 +02:00
2019-05-24 17:37:51 +02:00
2020-10-22 14:49:36 +02:00
2021-03-30 14:32:01 +02:00
2020-06-25 00:50:31 +02:00
2020-10-12 01:58:10 +02:00
2021-04-21 13:00:55 +02:00
2020-05-27 22:20:34 +02:00
2020-10-14 01:25:14 +02:00
2019-06-19 17:09:55 +02:00
2020-04-27 02:07:40 -04:00
2019-07-16 13:16:59 +02:00
2021-01-19 18:27:33 +01:00
2019-07-16 13:16:59 +02:00
2019-06-22 08:59:24 -04:00
2019-07-16 13:16:59 +02:00
2019-04-11 20:59:34 +02:00
2021-03-17 17:06:12 +01:00
2019-06-22 08:59:24 -04:00
2019-07-16 13:16:59 +02:00
2019-07-16 13:16:59 +02:00
2020-03-29 16:28:29 +02:00
2020-07-24 15:41:54 -07:00
2020-10-30 12:57:39 +01:00
2021-05-19 10:13:08 +02:00
2020-10-04 21:08:33 +02:00
2021-05-14 09:50:40 +02:00
2019-06-19 17:09:55 +02:00
2020-07-29 20:09:18 +02:00
2020-05-25 20:39:14 +02:00
2020-07-22 01:18:05 +02:00
2020-08-28 20:11:58 +02:00
2021-05-19 10:13:08 +02:00
2020-08-28 20:11:58 +02:00
2020-10-30 12:57:39 +01:00
2020-10-04 21:08:33 +02:00
2019-08-26 11:01:00 +02:00
2020-10-12 01:57:34 +02:00
2020-03-06 18:00:43 +01:00
2020-10-30 12:57:39 +01:00
2021-05-14 09:50:40 +02:00
2020-08-10 13:03:36 +02:00
2020-06-25 00:50:31 +02:00
2020-06-25 00:50:31 +02:00
2020-12-09 10:31:58 +01:00
2020-06-25 00:50:31 +02:00
2021-02-03 23:28:44 +01:00
2020-08-10 13:02:43 +02:00
2020-06-25 00:50:31 +02:00
2020-06-25 00:50:31 +02:00
2020-07-22 01:18:05 +02:00
2020-08-29 13:03:06 +02:00
2020-10-22 14:49:36 +02:00
2020-06-25 00:50:31 +02:00
2020-07-15 20:15:19 +02:00
2021-04-21 13:00:56 +02:00
2020-06-25 00:50:31 +02:00
2020-04-05 23:26:36 +02:00
2020-06-25 00:50:31 +02:00
2020-11-27 12:10:47 +01:00
2020-06-25 00:50:31 +02:00
2020-06-25 00:50:31 +02:00
2020-06-25 00:50:31 +02:00
2020-06-25 00:50:31 +02:00
2021-05-14 09:50:40 +02:00
2020-06-25 00:50:31 +02:00
2020-06-25 00:50:31 +02:00
2019-12-09 13:14:03 +01:00
2020-06-25 00:50:31 +02:00
2020-06-25 00:50:31 +02:00
2020-06-30 18:21:02 +02:00
2019-06-19 17:09:55 +02:00
2020-04-05 23:26:36 +02:00
2021-05-19 10:13:09 +02:00
2020-03-15 15:27:46 +01:00
2020-04-09 00:12:48 +09:00
2020-07-29 20:09:18 +02:00
2020-03-15 15:27:46 +01:00
2020-08-21 17:37:36 +02:00
2020-08-29 13:04:44 +02:00
2020-06-25 00:50:31 +02:00
2019-12-26 13:11:40 -08:00
2020-06-25 00:50:31 +02:00
2019-06-19 17:09:55 +02:00
2020-10-30 12:57:39 +01:00
2021-04-16 11:43:21 +02:00
2019-06-19 17:09:55 +02:00
2019-06-19 17:09:55 +02:00
2019-06-19 17:09:55 +02:00
2019-06-19 17:09:55 +02:00
2019-06-19 17:09:55 +02:00
2019-06-19 17:09:55 +02:00
2019-06-19 17:09:55 +02:00
2019-05-21 10:50:45 +02:00
2019-06-19 17:09:55 +02:00
2019-09-13 12:33:06 +02:00
2020-07-29 20:09:18 +02:00
2020-07-29 20:09:18 +02:00
2019-06-19 17:09:55 +02:00
2019-06-19 17:09:55 +02:00
2019-06-19 17:09:55 +02:00
2019-06-19 17:09:55 +02:00
2019-06-19 17:09:55 +02:00
2019-06-19 17:09:55 +02:00
2019-06-22 08:59:24 -04:00
2019-06-19 17:09:55 +02:00
2019-06-19 17:09:55 +02:00
2020-03-15 15:20:16 +01:00
2019-06-19 17:09:55 +02:00
2019-06-19 17:09:55 +02:00
2019-06-22 08:59:24 -04:00
2020-08-28 19:55:51 +02:00
2020-04-05 23:26:37 +02:00
2019-05-30 11:26:32 -07:00
2019-06-25 01:32:59 +02:00
2019-05-21 10:50:45 +02:00
2019-06-19 17:09:55 +02:00
2019-05-30 11:26:38 -07:00
2019-06-19 17:09:55 +02:00
2019-06-19 17:09:55 +02:00
2019-06-19 17:09:55 +02:00
2019-06-19 17:09:55 +02:00
2019-06-19 17:09:55 +02:00
2019-06-19 17:09:55 +02:00
2019-06-19 17:09:55 +02:00
2020-06-25 00:50:31 +02:00
2019-06-19 17:09:55 +02:00
2020-07-29 20:09:18 +02:00
2019-06-19 17:09:55 +02:00
2019-06-19 17:09:55 +02:00
2019-05-21 11:28:45 +02:00
2019-06-25 01:32:59 +02:00
2019-09-13 12:32:48 +02:00
2019-06-19 17:09:55 +02:00
2019-06-19 17:09:55 +02:00
2019-05-21 10:50:45 +02:00
2019-06-19 17:09:55 +02:00
2021-01-12 20:18:26 +01:00
2019-06-19 17:09:55 +02:00
2021-02-17 11:02:25 +01:00
2019-06-19 17:09:55 +02:00
2019-05-21 10:50:45 +02:00
2021-05-19 10:13:06 +02:00
2019-08-13 12:14:26 +02:00
2019-06-19 17:09:55 +02:00
2019-06-19 17:09:55 +02:00
2019-06-19 17:09:55 +02:00
2019-06-19 17:09:55 +02:00
2019-06-19 17:09:55 +02:00
2019-06-22 08:59:24 -04:00
2019-06-22 08:59:24 -04:00
2019-05-21 10:50:45 +02:00
2019-05-21 11:28:40 +02:00
2020-07-29 20:09:18 +02:00
2019-06-19 17:09:55 +02:00
2019-05-21 10:50:45 +02:00
2019-05-21 10:50:45 +02:00