Skip to content

tetragon: Check and remove not compatible map pin paths on loading #543

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

Merged
merged 1 commit into from
Dec 8, 2022

Conversation

olsajiri
Copy link
Contributor

Following cilium/ebpf interface creates map from pin path
and checks if the pin is compatible with the map spec:

ebpf.NewMapWithOptions(spec, ebpf.MapOptions{PinPath: path, FullPath: true})

use that in the sensors map loading code

TODO split the cilium/ebpf change and push it separately

Signed-off-by: Jiri Olsa [email protected]

@jrfastab
Copy link
Contributor

yep needs to pass testing but certainly good to have.

@olsajiri
Copy link
Contributor Author

olsajiri commented Nov 16, 2022

yep needs to pass testing but certainly good to have.

sure, it needs the cilium/ebpf change first cilium/ebpf#854

@olsajiri
Copy link
Contributor Author

yep needs to pass testing but certainly good to have.

sure, it needs the cilium/ebpf change first cilium/ebpf#854

got merged, meanwhile I added tetragon local version of that

Checking the compatibility of pinned map before loading the map
from it.

If map is not compatible with pinned map file, remove the pin
and create the map from scratch.

We will use MapSpec.Compatible in future, which will be exported
in cilium/ebpf v0.9.3, meanwhile steal that and make it our own.

Adding following warning to the logs:

...
time="2022-11-25T10:41:46+01:00" level=info msg="tetragon, map loaded." map=execve_map path=/sys/fs/bpf/tetragon/execve_map sensor=__base__
time="2022-11-25T10:41:46+01:00" level=warning msg="tetragon, incompatible map found: expected type PerCPUArray, got Array: map spec is incompatible with existing map" map=execve_map_stats path=/sys/fs/bpf/tetragon/execve_map_stats sensor=__base__
...

Signed-off-by: Jiri Olsa <[email protected]>
@olsajiri olsajiri marked this pull request as ready for review November 26, 2022 15:12
@olsajiri olsajiri requested a review from a team as a code owner November 26, 2022 15:12
@olsajiri olsajiri requested a review from tixxdz November 26, 2022 15:12
@kkourt kkourt merged commit dd29b3f into cilium:main Dec 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants