-
Notifications
You must be signed in to change notification settings - Fork 376
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
tetragon: un/pin fixes #3079
tetragon: un/pin fixes #3079
Conversation
0372a21
to
a74ba3d
Compare
fa5b10d
to
d4b21c0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good! The 2 sec sleeps in testing don't really look awesome though, isn't there a way to write something faster and more reliable?
run(1, expected) | ||
|
||
// remove the policy and we should get rid of the enforcement | ||
err = mgr.DeleteTracingPolicy(ctx, tp.TpName(), "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the commit you specify "test that simulates enforcement policy unload (not exit)" but you use Delete
instead of DisableTracingPolicy
, is that intended? You don't exactly test the scenario here #3033, maybe you want to modify one or add another one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, it should be about the same, but I can add that scenario as well, thnx
yea can't think of any now.. but will give it some more thought |
90706c1
to
758340d
Compare
758340d
to
304f7af
Compare
✅ Deploy Preview for tetragon ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Since linux kernel commit [1] we need to have O_RDWR to get link object properly. Use O_RDWR (nil for opts) in ebpf.LoadPinnedMap calls that face the path for the first time and stumble on link pin and fail. [1] 25fc94b2f02d bpf: link: Refuse non-O_RDWR flags in BPF_OBJ_GET Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Now when we create link pins by default all sensor unloads remove link pin and because bpf pinned links removal is asynchronous, we need to wait to be sure it's gone. Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Add proper 'override' suffix to the link path for kprobe multi attach override link. Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Add proper 'override' suffix to the link path for fmodret attach override link. Signed-off-by: Jiri Olsa <jolsa@kernel.org>
It's not used. Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Make sure we unpin link when closing the link. Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Now when we remove pins when we unload sensor/program, we can pin links unconditionally. Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Propage unpin flag from sensor.Unload/Destroy down to the unloader level and unpin progs/maps/links only when instructed by the unpin argument. Signed-off-by: Jiri Olsa <jolsa@kernel.org>
It unloads program and it fits better next to the existing LinkUnloader type. Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Currently we remove the enforcer handle when its sensor is unloaded, which makes enforcer unusable when the tracing policy/sensor is just disabled and we are not able to enable it back. Moving the enforcer handle removal to DestroyHook, which will trigger only when the sensor is removed. Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Use sensor manager with the new KeepSensorsOnExit setup instead of loading sensors manually. Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Add persistent enforcement test that simulates tetragon normal exit, WITHOUT KeepSensorsOnExit and make sure the enforcement is removed. Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Add persistent enforcement test that simulates enforcement policy unload (not exit) with KeepSensorsOnExit and make sure the enforcement is removed. Signed-off-by: Jiri Olsa <jolsa@kernel.org>
304f7af
to
cc12099
Compare
factor sensors unpin-ing
fixes #3033