-
Notifications
You must be signed in to change notification settings - Fork 151
bpf: tail calls do not modify packet data #10136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Upstream branch: 2cbb259 |
87c66e9 to
6f7697d
Compare
|
Upstream branch: 14a7f23 |
a748822 to
07d99c7
Compare
6f7697d to
55ff712
Compare
|
Upstream branch: be708ed |
07d99c7 to
15015d2
Compare
55ff712 to
1af0040
Compare
|
Upstream branch: ba36dd5 |
15015d2 to
a4ce3e2
Compare
|
Upstream branch: ba36dd5 |
a4ce3e2 to
eff193a
Compare
1af0040 to
7ea1d98
Compare
|
Upstream branch: 6146a0f |
The bpf verifier checks whether packet data is modified within a helper function, and if so invalidates the pointer to that data. Currently the verifier always invalidates if the helper function called is a tail call, as it cannot tell whether the called function does or does not modify the packet data. However, in this case, the fact that the packet might be modified is irrelevant in the code following the helper call, as the tail call only returns if there is nothing to execute, otherwise the calling (sub)program will return directly after the tail call finished. So it is this (sub)program for which the pointer to packet data needs to be invalidated. Fortunately, there are already two distinct points in the code for invalidating packet pointers directly after a helper call, and for entire (sub)programs. This commit assures that the pointer is only invalidated in the relevant case. Note that this is a regression bug: taking care of tail calls only became necessary when subprograms were introduced, before commit 1a4607f using a packet pointer after a tail call was working fine, as it should. Fixes: 1a4607f ("bpf: consider that tail calls invalidate packet pointers") Signed-off-by: Martin Teichmann <[email protected]>
eff193a to
e6c8a38
Compare
7ea1d98 to
8b55cb4
Compare
|
At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=1017201 expired. Closing PR. |
Pull request for series with
subject: bpf: tail calls do not modify packet data
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1017201