linux/drivers/net/wireguard
Jason A. Donenfeld c31b14d86d wireguard: allowedips: don't corrupt stack when detecting overflow
In case push_rcu() and related functions are buggy, there's a
WARN_ON(len >= 128), which the selftest tries to hit by being tricky. In
case it is hit, we shouldn't corrupt the kernel's stack, though;
otherwise it may be hard to even receive the report that it's buggy. So
conditionalize the stack write based on that WARN_ON()'s return value.

Note that this never *actually* happens anyway. The WARN_ON() in the
first place is bounded by IS_ENABLED(DEBUG), and isn't expected to ever
actually hit. This is just a debugging sanity check.

Additionally, hoist the constant 128 into a named enum,
MAX_ALLOWEDIPS_BITS, so that it's clear why this value is chosen.

Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Link: https://lore.kernel.org/all/CAHk-=wjJZGA6w_DxA+k7Ejbqsq+uGK==koPai3sqdsfJqemvag@mail.gmail.com/
Fixes: e7096c131e ("net: WireGuard secure network tunnel")
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2022-08-02 13:47:50 -07:00
..
selftest wireguard: allowedips: don't corrupt stack when detecting overflow 2022-08-02 13:47:50 -07:00
allowedips.c wireguard: allowedips: don't corrupt stack when detecting overflow 2022-08-02 13:47:50 -07:00
allowedips.h wireguard: allowedips: free empty intermediate nodes when removing single node 2021-06-04 14:25:14 -07:00
cookie.c
cookie.h
device.c wireguard: device: check for metadata_dst with skb_valid_dst() 2022-04-22 15:59:05 -07:00
device.h wireguard: receive: use ring buffer for incoming handshakes 2021-11-29 19:50:50 -08:00
main.c wireguard: main: rename 'mod_init' & 'mod_exit' functions to be module-specific 2021-11-29 19:50:30 -08:00
Makefile wireguard: do not use -O3 2021-06-04 14:25:14 -07:00
messages.h wireguard: queueing: preserve flow hash across packet scrubbing 2020-05-20 20:55:09 -07:00
netlink.c netlink: consistently use NLA_POLICY_MIN_LEN() 2020-08-18 12:28:45 -07:00
netlink.h
noise.c lib/crypto: blake2s: move hmac construction into wireguard 2022-01-18 13:03:55 +01:00
noise.h wireguard: noise: separate receive counter from send counter 2020-05-20 20:55:09 -07:00
peer.c wireguard: peer: allocate in kmem_cache 2021-06-04 14:25:14 -07:00
peer.h wireguard: peer: allocate in kmem_cache 2021-06-04 14:25:14 -07:00
peerlookup.c wireguard: peerlookup: take lock before checking hash in replace operation 2020-09-09 11:31:38 -07:00
peerlookup.h
queueing.c wireguard: queueing: use CFI-safe ptr_ring cleanup function 2022-03-30 19:14:08 -07:00
queueing.h Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2021-12-02 11:44:56 -08:00
ratelimiter.c wireguard: ratelimiter: use kvcalloc() instead of kvzalloc() 2021-11-29 19:50:50 -08:00
ratelimiter.h
receive.c wireguard: receive: use dev_sw_netstats_rx_add() 2022-06-09 21:53:10 -07:00
send.c wireguard: queueing: get rid of per-peer ring buffers 2021-02-23 15:59:34 -08:00
socket.c wireguard: socket: ignore v6 endpoints when ipv6 is disabled 2022-03-30 19:14:09 -07:00
socket.h
timers.c
timers.h
version.h