linux-stable/tools
Eduard Zingerman 1a4607ffba bpf: consider that tail calls invalidate packet pointers
Tail-called programs could execute any of the helpers that invalidate
packet pointers. Hence, conservatively assume that each tail call
invalidates packet pointers.

Making the change in bpf_helper_changes_pkt_data() automatically makes
use of check_cfg() logic that computes 'changes_pkt_data' effect for
global sub-programs, such that the following program could be
rejected:

    int tail_call(struct __sk_buff *sk)
    {
    	bpf_tail_call_static(sk, &jmp_table, 0);
    	return 0;
    }

    SEC("tc")
    int not_safe(struct __sk_buff *sk)
    {
    	int *p = (void *)(long)sk->data;
    	... make p valid ...
    	tail_call(sk);
    	*p = 42; /* this is unsafe */
    	...
    }

The tc_bpf2bpf.c:subprog_tc() needs change: mark it as a function that
can invalidate packet pointers. Otherwise, it can't be freplaced with
tailcall_freplace.c:entry_freplace() that does a tail call.

Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
Link: https://lore.kernel.org/r/20241210041100.1898468-8-eddyz87@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2024-12-10 10:24:57 -08:00
..
accounting
arch The biggest change here is eliminating the awful idea that KVM had, of 2024-11-23 16:00:50 -08:00
bootconfig
bpf BPF fixes: 2024-12-06 15:07:48 -08:00
build perf tools changes for v6.13 2024-11-26 14:54:00 -08:00
certs
cgroup
counter
crypto crypto: tools/ccp - Remove unused variable 2024-08-30 18:22:30 +08:00
debugging
firewire tools/firewire: Fix several incorrect format specifiers 2024-11-14 09:12:04 +09:00
firmware
gpio tools: gpio: Fix several incorrect format specifiers 2024-11-13 16:30:05 +01:00
hv hyperv-next for v6.12 2024-09-19 08:15:30 +02:00
iio iio: Add channel type for attention 2024-11-03 20:33:43 +00:00
include - The series "resource: A couple of cleanups" from Andy Shevchenko 2024-11-25 16:09:48 -08:00
kvm/kvm_stat
laptop
leds
lib perf tools changes for v6.13 2024-11-26 14:54:00 -08:00
memory-model tools/memory-model: simple.txt: Fix stale reference to recipes-pairs.txt 2024-09-13 23:56:44 -07:00
mm - The series "zram: optimal post-processing target selection" from 2024-11-23 09:58:07 -08:00
net NFSD 6.13 Release Notes 2024-11-26 12:59:30 -08:00
objtool Kbuild updates for v6.13 2024-11-30 13:41:50 -08:00
pci tools: PCI: Fix incorrect printf format specifiers 2024-11-20 14:20:51 -06:00
pcmcia
perf perf tools changes for v6.13 2024-11-26 14:54:00 -08:00
power turbostat version 2024.11.30 2024-11-30 18:30:22 -08:00
rcu tools/rcu: Remove RCU Tasks Rude asynchronous APIs from rcu-updaters.sh 2024-07-29 07:39:32 +05:30
sched_ext sched_ext: Rename scx_bpf_dispatch[_vtime]_from_dsq*() -> scx_bpf_dsq_move[_vtime]*() 2024-11-11 07:06:16 -10:00
scripts tools: Override makefile ARCH variable if defined, but empty 2024-11-29 17:04:25 +01:00
sound ASoC: dapm-graph: show path name for non-static routes 2024-08-23 11:03:00 +01:00
spi spi: spidev_test: add support for word delay 2024-11-07 15:25:50 +00:00
testing bpf: consider that tail calls invalidate packet pointers 2024-12-10 10:24:57 -08:00
thermal tools/thermal: Fix common realloc mistake 2024-11-15 14:29:03 +01:00
time
tracing tracing/tools: Updates for 6.13 2024-11-22 13:24:22 -08:00
usb usbip: tools: Fix detach_port() invalid port error path 2024-10-29 04:23:23 +01:00
verification verification/dot2: Improve dot parser robustness 2024-11-19 08:57:13 -05:00
virtio Fix typo in vringh_test.c 2024-11-06 04:40:07 -05:00
wmi
workqueue
writeback
Makefile sched_ext: Add scx_simple and scx_example_qmap example schedulers 2024-06-18 10:09:17 -10:00