bpf: don't use bpf_redirect_neigh() from overlay programs#42000
Merged
julianwiedmann merged 3 commits intomainfrom Oct 6, 2025
Merged
bpf: don't use bpf_redirect_neigh() from overlay programs#42000julianwiedmann merged 3 commits intomainfrom
julianwiedmann merged 3 commits intomainfrom
Conversation
b7d735e to
00d0398
Compare
245e928 to
c27db88
Compare
mcast.h by accident pulls in common.h, but before the various file-wide defines like IS_BPF_OVERLAY are set. This makes them unusable in places like overloadable_skb.h. Fix things up making common.h the first regular header that gets included, as done in all other programs. For this also shuffle the tailcall.h further down, even though it's currently harmless. Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
This reverts commit 3c1b39a. For the following patch we need to tolerate that bpf_redirect_neigh() is not available when egress_gw_fib_lookup_and_redirect_v*() is called from inside bpf_overlay. Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
Yusuke chased down a kernel bug [0] that causes memory leaks when bpf_redirect_neigh() is called from bpf_overlay. As work-around we can opt-out from using the helper, and going down the fallback path in the callers (eg treating it like a call from XDP context). [0]: https://lore.kernel.org/netdev/20251003073418.291171-1-daniel@iogearbox.net/T/#u Reported-by: Yusuke Suzuki <yusuke.suzuki@isovalent.com> Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
c27db88 to
8eb7efa
Compare
Member
Author
|
I'm tempted to add a fine-grained |
Member
Author
|
/test |
julianwiedmann
added a commit
that referenced
this pull request
Oct 7, 2025
#42000 limited the usage of bpf_redirect_neigh() from overlay programs, to work-around a kernel bug that causes a memory leak. This bug only manifests when bpf_redirect_neigh() is called without next-hop information - or in Cilium terms, without a preceding FIB lookup. By annotating such specific usage of bpf_redirect_neigh() with a fine-grained capability check, we can otherwise allow the use of bpf_redirect_neigh() from overlay context. Start by introducing the neigh_resolver_without_nh_available() check in all relevant places. Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
Member
Author
Started this in #42052. |
julianwiedmann
added a commit
that referenced
this pull request
Oct 7, 2025
#42000 limited the usage of bpf_redirect_neigh() from overlay programs, to work-around a kernel bug that causes a memory leak. This bug only manifests when bpf_redirect_neigh() is called without next-hop information - or in Cilium terms, without a preceding FIB lookup. By annotating such specific usage of bpf_redirect_neigh() with a fine-grained capability check, we can otherwise allow the use of bpf_redirect_neigh() from overlay context. Start by introducing the neigh_resolver_without_nh_available() check in all relevant places. Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
github-merge-queue bot
pushed a commit
that referenced
this pull request
Oct 10, 2025
#42000 limited the usage of bpf_redirect_neigh() from overlay programs, to work-around a kernel bug that causes a memory leak. This bug only manifests when bpf_redirect_neigh() is called without next-hop information - or in Cilium terms, without a preceding FIB lookup. By annotating such specific usage of bpf_redirect_neigh() with a fine-grained capability check, we can otherwise allow the use of bpf_redirect_neigh() from overlay context. Start by introducing the neigh_resolver_without_nh_available() check in all relevant places. Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
aditighag
pushed a commit
to aditighag/cilium
that referenced
this pull request
Oct 14, 2025
cilium#42000 limited the usage of bpf_redirect_neigh() from overlay programs, to work-around a kernel bug that causes a memory leak. This bug only manifests when bpf_redirect_neigh() is called without next-hop information - or in Cilium terms, without a preceding FIB lookup. By annotating such specific usage of bpf_redirect_neigh() with a fine-grained capability check, we can otherwise allow the use of bpf_redirect_neigh() from overlay context. Start by introducing the neigh_resolver_without_nh_available() check in all relevant places. Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Yusuke chased down a kernel bug 0 that causes memory leaks when bpf_redirect_neigh() is called from bpf_overlay.
As work-around we can opt-out from using the helper, and going down the fallback path in the callers (eg treating it like a call from XDP context).