Skip to content
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

bpf: fix error handling for invoke_tailcall_if() #26118

Merged

Conversation

julianwiedmann
Copy link
Member

@julianwiedmann julianwiedmann commented Jun 12, 2023

invoke_tailcall_if() either inlines the target function, or calls it via
tail-call. In the inline variant, the return causes us to skip over any
subsequent error handling (eg drop notification) in the caller.

Rework the macro so that it properly assigns the ret value.

Also fix up one user that didn't handle returned errors.

@julianwiedmann julianwiedmann added kind/bug This is a bug in the Cilium logic. sig/datapath Impacts bpf/ or low-level forwarding details, including map management and monitor messages. release-note/bug This PR fixes an issue in a previous release of Cilium. needs-backport/1.13 This PR / issue needs backporting to the v1.13 branch labels Jun 12, 2023
@julianwiedmann
Copy link
Member Author

/test

@julianwiedmann
Copy link
Member Author

Bit of a funky fail in the runtime tests (#26150), re-running.

@julianwiedmann
Copy link
Member Author

/test-runtime

@julianwiedmann julianwiedmann marked this pull request as ready for review June 13, 2023 05:55
@julianwiedmann julianwiedmann requested a review from a team as a code owner June 13, 2023 05:55
bpf/bpf_host.c Outdated Show resolved Hide resolved
invoke_tailcall_if() either inlines the target function, or calls it via
tail-call. In the inline variant, the `return` causes us to skip over any
subsequent error handling (eg drop notification) in the caller.

Rework the macro so that it properly assigns the `ret` value.

Suggested-by: Anton Protopopov <aspsk@isovalent.com>
Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
If the invoked function is inlined, it can return error that we need to
handle. If the function is tail-called, we still need to handle the
DROP_MISSED_TAIL_CALL.

Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
@julianwiedmann
Copy link
Member Author

/test

@julianwiedmann
Copy link
Member Author

Picked up @aspsk's suggestion on how to build the macro, rebased. Also fixed up one user of the macro.

@maintainer-s-little-helper maintainer-s-little-helper bot added the ready-to-merge This PR has passed all tests and received consensus from code owners to merge. label Jun 14, 2023
@julianwiedmann julianwiedmann merged commit fb48741 into cilium:main Jun 14, 2023
65 checks passed
@julianwiedmann julianwiedmann deleted the 1.14-bpf-conditional-tail-call branch June 14, 2023 06:51
@nbusseneau
Copy link
Member

@julianwiedmann Backporting the changes in this PR to v1.13 yields conflicts as they depend on changes made in #23831, which was not backported to v1.13. I'm not competent enough in BPF to fully understand what's going on, can you double-check if it's OK to backport #23831 to v1.13?

@nbusseneau nbusseneau mentioned this pull request Jun 22, 2023
19 tasks
@tklauser tklauser added the backport/author The backport will be carried out by the author of the PR. label Jun 26, 2023
@julianwiedmann
Copy link
Member Author

@julianwiedmann Backporting the changes in this PR to v1.13 yields conflicts as they depend on changes made in #23831, which was not backported to v1.13. I'm not competent enough in BPF to fully understand what's going on, can you double-check if it's OK to backport #23831 to v1.13?

Yep, v1.13 has less occurences of invoke_tailcall_if(). It's fine to ignore the non-existent ones.

But I see @tklauser has already decided how to progress, I'll queue up a backport PR then 😁 .

@tklauser
Copy link
Member

Was just about to write a reply 😄 Also happy to incorporate the patch in a 1.13 backport this week if it's reasonably easy. But I guess @julianwiedmann will have more context doing it.

@julianwiedmann julianwiedmann added backport-pending/1.13 The backport for Cilium 1.13.x for this PR is in progress. and removed needs-backport/1.13 This PR / issue needs backporting to the v1.13 branch backport-pending/1.13 The backport for Cilium 1.13.x for this PR is in progress. labels Jun 27, 2023
@julianwiedmann julianwiedmann added the backport-done/1.13 The backport for Cilium 1.13.x for this PR is done. label Jun 29, 2023
@julianwiedmann julianwiedmann added backport-pending/1.12 backport-done/1.12 The backport for Cilium 1.12.x for this PR is done. and removed backport-pending/1.12 labels Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/author The backport will be carried out by the author of the PR. backport-done/1.12 The backport for Cilium 1.12.x for this PR is done. backport-done/1.13 The backport for Cilium 1.13.x for this PR is done. kind/bug This is a bug in the Cilium logic. ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-note/bug This PR fixes an issue in a previous release of Cilium. sig/datapath Impacts bpf/ or low-level forwarding details, including map management and monitor messages.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants