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: Use shared string maps in kprobe-multi #1582

Merged
merged 3 commits into from
Oct 12, 2023
Merged

Conversation

tpapagian
Copy link
Member

@tpapagian tpapagian commented Oct 11, 2023

This PR first introduces a test showing that we have a bug in the case of kprobe-multi, which uses matchArgs where both use maps to do string operations.

The problem is due to overriding string maps after processing each kprobe. To fix that we use shared maps for all selectors for all attach points in the case of kprobe-multi.

Non kprobe-multi cases and tracepoints/uprobes work exactly as before.

@tpapagian tpapagian added the release-note/bug This PR fixes an issue in a previous release of Tetragon. label Oct 11, 2023
@tpapagian tpapagian force-pushed the pr/apapag/sel_multi_fix branch from f60cccc to 3e1547d Compare October 11, 2023 15:39
@netlify
Copy link

netlify bot commented Oct 11, 2023

Deploy Preview for tetragon ready!

Name Link
🔨 Latest commit 3e1547d
🔍 Latest deploy log https://app.netlify.com/sites/tetragon/deploys/6526c1babe4c9900081a3688
😎 Deploy Preview https://deploy-preview-1582--tetragon.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@tpapagian tpapagian force-pushed the pr/apapag/sel_multi_fix branch from 9e6c24d to d80341d Compare October 12, 2023 06:20
Signed-off-by: Anastasios Papagiannis <tasos.papagiannnis@gmail.com>
This test uses a tracing policy with 2 kprobes. Each of them has a
selector with 2 filters. Now this test fails in the case of
kprobe-multi. The next commit will fix that issue.

Only for kernels >= 5.4 as older kernels do not support matchArgs for
more than one arguments.

Signed-off-by: Anastasios Papagiannis <tasos.papagiannnis@gmail.com>
@tpapagian tpapagian force-pushed the pr/apapag/sel_multi_fix branch from d80341d to 0232844 Compare October 12, 2023 07:18
@tpapagian tpapagian changed the title Test bugfix: Use shared string maps in kprobe-multi Oct 12, 2023
@tpapagian tpapagian marked this pull request as ready for review October 12, 2023 08:17
@tpapagian tpapagian requested a review from a team as a code owner October 12, 2023 08:17
@tpapagian tpapagian requested a review from kevsecurity October 12, 2023 08:17
pkg/selectors/selectors.go Outdated Show resolved Hide resolved
@tpapagian tpapagian force-pushed the pr/apapag/sel_multi_fix branch 3 times, most recently from c8feb91 to b4e38d4 Compare October 12, 2023 09:26
@tpapagian tpapagian requested a review from kkourt October 12, 2023 10:10
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!

The previous commit shows a test that we have a bug in the case of
kprobe-multi, that uses matchArgs where both of these use maps to do
equals/prefix/postfix operations.

The problem is due to overriding string maps after processing each
kprobe. To fix that we use shared maps for all selectors for all attach
points in te case of kprobe-multi.

Non kprobe-multi cases and tracepoints/uprobes work exactly as before.

Signed-off-by: Anastasios Papagiannis <tasos.papagiannnis@gmail.com>
@tpapagian tpapagian force-pushed the pr/apapag/sel_multi_fix branch from b4e38d4 to e83af73 Compare October 12, 2023 13:15
@jrfastab jrfastab merged commit 6a1c80d into main Oct 12, 2023
28 checks passed
@jrfastab jrfastab deleted the pr/apapag/sel_multi_fix branch October 12, 2023 19:57
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.

4 participants