sst-linux/net
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
..
6lowpan
9p
802
8021q
appletalk
atm
ax25
batman-adv
bluetooth Bluetooth: hci_sync: Ignore errors from HCI_OP_REMOTE_NAME_REQ_CANCEL 2024-10-17 15:20:42 +02:00
bpf
bpfilter
bridge net: bridge: br_fdb_external_learn_add(): always set EXT_LEARN 2024-09-12 11:10:22 +02:00
caif
can can: bcm: Clear bo->bcm_proc_read after remove_proc_entry(). 2024-10-17 15:20:42 +02:00
ceph
core bpf: Zero former ARG_PTR_TO_{LONG,INT} args in case of error 2024-10-17 15:21:00 +02:00
dcb
dccp tcp/dccp: do not care about families in inet_twsk_purge() 2024-08-29 17:30:44 +02:00
devlink
dns_resolver
dsa net: mscc: ocelot: use ocelot_xmit_get_vlan_info() also for FDMA and register injection 2024-08-29 17:30:43 +02:00
ethernet
ethtool ethtool: check device is present when getting link settings 2024-09-04 13:25:01 +02:00
hsr
ieee802154
ife
ipv4 fou: fix initialization of grc 2024-09-18 19:23:05 +02:00
ipv6 ipv6: avoid possible NULL deref in rt6_uncached_list_flush_dev() 2024-10-17 15:20:44 +02:00
iucv s390/iucv: fix receive buffer virtual vs physical address confusion 2024-08-29 17:30:39 +02:00
kcm kcm: Serialise kcm_sendmsg() for the same socket. 2024-08-29 17:30:44 +02:00
key
l2tp
l3mdev
lapb
llc
mac80211 wifi: mac80211: use two-phase skb reclamation in ieee80211_do_stop() 2024-10-17 15:20:42 +02:00
mac802154
mctp net: mctp: test: Use correct skb for route input check 2024-08-29 17:30:44 +02:00
mpls
mptcp mptcp: pm: Fix uaf in __timer_delete_sync 2024-09-18 19:23:03 +02:00
ncsi
netfilter netfilter: nf_tables: remove annotation to access set timeout while holding lock 2024-10-17 15:20:39 +02:00
netlabel
netlink netlink: hold nlk->cb_mutex longer in __netlink_dump_start() 2024-08-29 17:30:36 +02:00
netrom
nfc
nsh
openvswitch
packet
phonet
psample
qrtr
rds net:rds: Fix possible deadlock in rds_message_put 2024-08-29 17:30:20 +02:00
rfkill
rose
rxrpc
sched sched: sch_cake: fix bulk flow accounting logic for host fairness 2024-09-12 11:10:18 +02:00
sctp sctp: fix association labeling in the duplicate COOKIE-ECHO case 2024-09-04 13:25:02 +02:00
smc
strparser
sunrpc
switchdev
tipc net: tipc: avoid possible garbage value 2024-10-17 15:20:44 +02:00
tls
unix af_unix: Remove put_pid()/put_cred() in copy_peercred(). 2024-09-12 11:10:19 +02:00
vmw_vsock
wireless wifi: cfg80211: fix two more possible UBSAN-detected off-by-one errors 2024-10-17 15:20:41 +02:00
x25
xdp
xfrm
compat.c
devres.c
Kconfig
Kconfig.debug
Makefile
socket.c
sysctl_net.c