Skip to content

Conversation

@kernel-patches-daemon-bpf-rc
Copy link

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

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]>
@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: 2cbb259
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1017201
version: 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants