summaryrefslogtreecommitdiff
path: root/tools/lib/python/jobserver.py
diff options
context:
space:
mode:
authorMartin Teichmann <martin.teichmann@xfel.eu>2025-11-19 17:03:52 +0100
committerAlexei Starovoitov <ast@kernel.org>2025-11-21 17:45:30 -0800
commite3245f8990431950d20631c72236d4e8cb2dcde8 (patch)
tree9823be6a8289d954fbc84c4c3f7379859bab1407 /tools/lib/python/jobserver.py
parent4dd3a48d13a3bbe7a48e0ab3f7362be26f534de8 (diff)
bpf: properly verify tail call behavior
A successful ebpf tail call does not return to the caller, but to the caller-of-the-caller, often just finishing the ebpf program altogether. Any restrictions that the verifier needs to take into account - notably the fact that the tail call might have modified packet pointers - are to be checked on the caller-of-the-caller. Checking it on the caller made the verifier refuse perfectly fine programs that would use the packet pointers after a tail call, which is no problem as this code is only executed if the tail call was unsuccessful, i.e. nothing happened. This patch simulates the behavior of a tail call in the verifier. A conditional jump to the code after the tail call is added for the case of an unsucessful tail call, and a return to the caller is simulated for a successful tail call. For the successful case we assume that the tail call returns an int, as tail calls are currently only allowed in functions that return and int. We always assume that the tail call modified the packet pointers, as we do not know what the tail call did. For the unsuccessful case we know nothing happened, so we do not need to add new constraints. This approach also allows to check other problems that may occur with tail calls, namely we are now able to check that precision is properly propagated into subprograms using tail calls, as well as checking the live slots in such a subprogram. Fixes: 1a4607ffba35 ("bpf: consider that tail calls invalidate packet pointers") Link: https://lore.kernel.org/bpf/20251029105828.1488347-1-martin.teichmann@xfel.eu/ Signed-off-by: Martin Teichmann <martin.teichmann@xfel.eu> Acked-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20251119160355.1160932-2-martin.teichmann@xfel.eu Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/lib/python/jobserver.py')
0 files changed, 0 insertions, 0 deletions