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

bugfix: Fix Prefix operator with file type in matchArgs #1301

Merged
merged 2 commits into from
Aug 2, 2023

Conversation

tpapagian
Copy link
Member

@tpapagian tpapagian commented Aug 1, 2023

The tracing policy provided in https://raw.githubusercontent.com/cilium/tetragon/main/examples/tracingpolicy/file_monitoring.yaml does not work as expected.

The matchArgs filter with file type and Prefix operator results in events with filenames with different prefixes as what we expected. This means that expect from the events that we care about, we also get a bunch of unrelated events.

More details on commit messages.

Fix Prefix operator with file type in matchArgs.

In
https://raw.githubusercontent.com/cilium/tetragon/main/examples/tracingpolicy/file_monitoring.yaml
Prefix does not seem to work as expected. This means that we also get
events with different prefix compared to /etc/.

The issues for that is that we do not calculate correctly the offsets
inside the buffer of the specific argument. Now we use structs to make
that easier to read and argue about.

Signed-off-by: Anastasios Papagiannis <[email protected]>
@tpapagian tpapagian changed the title test bugfix: Fix Prefix operator in matchArgs with file argument Aug 1, 2023
@tpapagian tpapagian changed the title bugfix: Fix Prefix operator in matchArgs with file argument bugfix: Fix Prefix operator with file type in matchArgs Aug 1, 2023
@tpapagian tpapagian added release-note/bug This PR fixes an issue in a previous release of Tetragon. needs-backport/0.10 labels Aug 1, 2023
@tpapagian tpapagian marked this pull request as ready for review August 1, 2023 16:02
@tpapagian tpapagian requested a review from a team as a code owner August 1, 2023 16:02
Copy link
Contributor

@kkourt kkourt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@@ -649,17 +649,17 @@ filter_char_buf(struct selector_arg_filter *filter, char *args, int value_off)
return 0;
}

struct string_buf {
__u32 len;
char buf[];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, I like that! It makes the format explicit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note/bug This PR fixes an issue in a previous release of Tetragon.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants