In the Linux kernel, the following vulnerability has been resolved:
netfilter: nftables: avoid overflows in nfthashbuckets()
Number of buckets being stored in 32bit variables, we have to ensure that no overflows occur in nfthashbuckets()
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: dumpstack lib/dumpstack.c:79 [inline] dumpstack+0x141/0x1d7 lib/dumpstack.c:120 ubsanepilogue+0xb/0x5a lib/ubsan.c:148 _ubsanhandleshiftoutofbounds.cold+0xb1/0x181 lib/ubsan.c:327 _rounduppowoftwo include/linux/log2.h:57 [inline] nfthashbuckets net/netfilter/nftsethash.c:411 [inline] nfthashestimate.cold+0x19/0x1e net/netfilter/nftsethash.c:652 nftselectsetops net/netfilter/nftablesapi.c:3586 [inline] nftablesnewset+0xe62/0x3110 net/netfilter/nftablesapi.c:4322 nfnetlinkrcvbatch+0xa09/0x24b0 net/netfilter/nfnetlink.c:488 nfnetlinkrcvskbbatch net/netfilter/nfnetlink.c:612 [inline] nfnetlinkrcv+0x3af/0x420 net/netfilter/nfnetlink.c:630 netlinkunicastkernel net/netlink/afnetlink.c:1312 [inline] netlinkunicast+0x533/0x7d0 net/netlink/afnetlink.c:1338 netlinksendmsg+0x856/0xd90 net/netlink/afnetlink.c:1927 socksendmsgnosec net/socket.c:654 [inline] socksendmsg+0xcf/0x120 net/socket.c:674 syssendmsg+0x6e8/0x810 net/socket.c:2350 _syssendmsg+0xf3/0x170 net/socket.c:2404 _syssendmsg+0xe5/0x1b0 net/socket.c:2433 dosyscall64+0x2d/0x70 arch/x86/entry/common.c:46