cocci: Detect unlogged missed tail calls#11808
Merged
Conversation
dd975fc to
16ad4f8
Compare
This new Coccinelle script will detect tail calls (ep_tail_call() calls) that are not followed by either a call to send_drop_notify_error(arg1, arg2, DROP_MISSED_TAIL_CALL, ...) or return DROP_MISSED_TAIL_CALL. Tail calls in macros are not analyzed. The script cannot patch such unlogged tail calls as the correct fix depends on the context. It is up to the developer to fix any error found. Signed-off-by: Paul Chaignon <paul@cilium.io>
Without these changes, and because Coccinelle doesn't analyze the values of variables to prune branches, the new Coccinelle script detects the two tail calls as missing a subsequent DROP_MISSED_TAIL_CALL. Signed-off-by: Paul Chaignon <paul@cilium.io>
16ad4f8 to
b80a74e
Compare
The tail calls to tail_handle_ipv{4,6} will not be logged if they fail.
This commit fixes it.
Fixes: 9e108c1 ("nat46: Enable ipv6 containers to talk to an ipv4 container")
Signed-off-by: Paul Chaignon <paul@cilium.io>
b80a74e to
a1d1886
Compare
Member
Author
|
test-me-please |
Member
Author
|
retest-gke |
qmonnet
approved these changes
Jun 3, 2020
Member
qmonnet
left a comment
There was a problem hiding this comment.
Looks great!
Looks like a candidate for at least 1.8 backport to me, in case it helps catch or trace a bug in the future? Plus it should not be difficult to backport to 1.8.
borkmann
approved these changes
Jun 3, 2020
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.
The first commit introduces a new Coccinelle script to detect tail calls not followed by a
DROP_MISSED_TAIL_CALLlog. The second commit adapts the code a bit in two places to allow Coccinelle to detect that all paths from tail call contain aDROP_MISSED_TAIL_CALLlog. The last commit fixes two instances of unlogged missed tail calls (dating from Cilium 0.10.1).@cilium/bpf Do we want to backport the two missing log for the tail calls?
Fixes: #190
Updates: #11257