-
Notifications
You must be signed in to change notification settings - Fork 362
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
base: main
Are you sure you want to change the base?
tetragon: un/pin fixes #3079
Conversation
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 <[email protected]>
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 <[email protected]>
Add proper 'override' suffix to the link path for kprobe multi attach override link. Signed-off-by: Jiri Olsa <[email protected]>
Add proper 'override' suffix to the link path for fmodret attach override link. Signed-off-by: Jiri Olsa <[email protected]>
It's not used. Signed-off-by: Jiri Olsa <[email protected]>
Make sure we unpin link when closing the link. Signed-off-by: Jiri Olsa <[email protected]>
Now when we remove pins when we unload sensor/program, we can pin links unconditionally. Signed-off-by: Jiri Olsa <[email protected]>
Store KeepSensorsOnExit flag in SensorManager and use it when sensors go down to instruct sensor unload path to unpin or leave all the pins (progs/maps/links). The sensor level support comes in following change. Signed-off-by: Jiri Olsa <[email protected]>
0372a21
to
a74ba3d
Compare
ff5dab6
to
fa5b10d
Compare
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 <[email protected]>
It unloads program and it fits better next to the existing LinkUnloader type. Signed-off-by: Jiri Olsa <[email protected]>
Use sensor manager with the new KeepSensorsOnExit setup instead of loading sensors manually. Signed-off-by: Jiri Olsa <[email protected]>
Add persistent enforcement test that simulates tetragon normal exit, WITHOUT KeepSensorsOnExit and make sure the enforcement is removed. Signed-off-by: Jiri Olsa <[email protected]>
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 <[email protected]>
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?
factor sensors unpin-ing
fixes #3033