sst-linux/net/core
Daniel Borkmann 8397bf7898 bpf: Zero former ARG_PTR_TO_{LONG,INT} args in case of error
[ Upstream commit 4b3786a6c5397dc220b1483d8e2f4867743e966f ]

For all non-tracing helpers which formerly had ARG_PTR_TO_{LONG,INT} as input
arguments, zero the value for the case of an error as otherwise it could leak
memory. For tracing, it is not needed given CAP_PERFMON can already read all
kernel memory anyway hence bpf_get_func_arg() and bpf_get_func_ret() is skipped
in here.

Also, the MTU helpers mtu_len pointer value is being written but also read.
Technically, the MEM_UNINIT should not be there in order to always force init.
Removing MEM_UNINIT needs more verifier rework though: MEM_UNINIT right now
implies two things actually: i) write into memory, ii) memory does not have
to be initialized. If we lift MEM_UNINIT, it then becomes: i) read into memory,
ii) memory must be initialized. This means that for bpf_*_check_mtu() we're
readding the issue we're trying to fix, that is, it would then be able to
write back into things like .rodata BPF maps. Follow-up work will rework the
MEM_UNINIT semantics such that the intent can be better expressed. For now
just clear the *mtu_len on error path which can be lifted later again.

Fixes: 8a67f2de9b ("bpf: expose bpf_strtol and bpf_strtoul to all program types")
Fixes: d7a4cb9b67 ("bpf: Introduce bpf_strtol and bpf_strtoul helpers")
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/e5edd241-59e7-5e39-0ee5-a51e31b6840a@iogearbox.net
Link: https://lore.kernel.org/r/20240913191754.13290-5-daniel@iogearbox.net
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-10-17 15:21:00 +02:00
..
bpf_sk_storage.c bpf: Refactor some inode/task/sk storage functions for reuse 2024-07-18 13:18:34 +02:00
datagram.c net: fix rc7's __skb_datagram_iter() 2024-07-18 13:18:33 +02:00
dev_addr_lists_test.c
dev_addr_lists.c
dev_ioctl.c
dev.c
dev.h
drop_monitor.c
dst_cache.c
dst.c
failover.c
fib_notifier.c
fib_rules.c
filter.c bpf: Zero former ARG_PTR_TO_{LONG,INT} args in case of error 2024-10-17 15:21:00 +02:00
flow_dissector.c net: flow_dissector: use DEBUG_NET_WARN_ON_ONCE 2024-08-03 08:49:24 +02:00
flow_offload.c
gen_estimator.c
gen_stats.c
gro_cells.c
gro.c
hwbm.c
link_watch.c net: linkwatch: use system_unbound_wq 2024-08-14 13:52:44 +02:00
lwt_bpf.c
lwtunnel.c
Makefile
neighbour.c
net_namespace.c netns: Make get_net_ns() handle zero refcount net 2024-06-27 13:46:19 +02:00
net-procfs.c
net-sysfs.c ethtool: check device is present when getting link settings 2024-09-04 13:25:01 +02:00
net-sysfs.h
net-traces.c
netclassid_cgroup.c
netevent.c
netpoll.c netpoll: Fix race condition in netpoll_owner_active 2024-06-27 13:46:15 +02:00
netprio_cgroup.c
of_net.c
page_pool.c
pktgen.c
ptp_classifier.c
request_sock.c
rtnetlink.c rtnetlink: Don't ignore IFLA_TARGET_NETNSID when ifname is specified in rtnl_dellink(). 2024-08-11 12:35:57 +02:00
scm.c
secure_seq.c
selftests.c
skbuff.c net: dsa: tag_ocelot: call only the relevant portion of __skb_vlan_pop() on TX 2024-08-29 17:30:43 +02:00
skmsg.c skmsg: Skip zero length skb in sk_msg_recvmsg 2024-07-18 13:18:33 +02:00
sock_destructor.h
sock_diag.c
sock_map.c sock_map: Add a cond_resched() in sock_hash_free() 2024-10-17 15:20:42 +02:00
sock_reuseport.c
sock.c net: do not leave a dangling sk pointer, when socket creation fails 2024-06-27 13:46:21 +02:00
stream.c
sysctl_net_core.c
timestamping.c
tso.c
utils.c
xdp.c xdp: fix invalid wait context of page_pool_destroy() 2024-08-03 08:49:09 +02:00