Skip to content

Conversation

olsajiri
Copy link
Contributor

@olsajiri olsajiri commented Apr 1, 2025

assorted changes to be able to run on rhel7

@olsajiri olsajiri requested a review from tixxdz April 1, 2025 08:50
@olsajiri olsajiri added the release-note/minor This PR introduces a minor user-visible change label Apr 1, 2025
@olsajiri olsajiri force-pushed the pr/olsajiri/fixes branch from b1fd3b3 to 2985325 Compare April 1, 2025 10:34
@olsajiri olsajiri marked this pull request as ready for review April 1, 2025 13:19
@olsajiri olsajiri requested a review from a team as a code owner April 1, 2025 13:19
@olsajiri olsajiri force-pushed the pr/olsajiri/fixes branch 5 times, most recently from 882bda0 to dfaa857 Compare April 3, 2025 13:38
Currently we won't start tetragon if requested namespace
is not supported, like:

time="2025-04-01T04:31:23-04:00" level=fatal msg="Failed to initialize host namespaces" error="namespace '/proc/1/ns/pid_for_children' readlink /proc/1/ns/pid_for_childy" procfs=/proc/

Instead let's warn user about missing namespace and let tetragon
continue.

Signed-off-by: Jiri Olsa <[email protected]>
@olsajiri olsajiri force-pushed the pr/olsajiri/fixes branch 3 times, most recently from 5d01bda to 0d3b3f0 Compare April 3, 2025 15:32
olsajiri added 7 commits April 3, 2025 15:40
Adding rhel7 base sensor bpf object variants for running
tetragon on rhel7.

Signed-off-by: Jiri Olsa <[email protected]>
Some of the new namespace errors make the tetragon log too loud on rhel7,
because they are display for each process, display them just once.

Signed-off-by: Jiri Olsa <[email protected]>
The rhel7 kernel uses different context struct name,
change it for rhel7 objects.

Signed-off-by: Jiri Olsa <[email protected]>
Display object file name in debug mode, like:

  # sudo DEBUG=1 TETRAGONDIR=/home/jolsa/tetragon/bpf/objs go test contrib/verify/verify_test.go -v
  === RUN   TestVerifyTetragonPrograms
  [bpf_cgroup.o]
  tg_cgroup_rmdir:
            ; struct cgroup *cgrp = (struct cgroup *)ctx->args[0];
           0: LdXMemDW dst: r3 src: r1 off: 0 imm: 0
           1: MovImm dst: r6 imm: 0
            ; struct kernfs_node *kn = NULL;
           2: StXMemDW dst: rfp src: r6 off: -8 imm: 0

Signed-off-by: Jiri Olsa <[email protected]>
Rhel7 is special, *310.o objects load fail on standard kernel.

Signed-off-by: Jiri Olsa <[email protected]>
Adding core field checks and use appropriate reads based on that.

Signed-off-by: Jiri Olsa <[email protected]>
The cgroup retrieval is bit different on rhel7, disabling it for now
in rhel7 objects.

Signed-off-by: Jiri Olsa <[email protected]>
@olsajiri olsajiri force-pushed the pr/olsajiri/fixes branch from 0d3b3f0 to cd88491 Compare April 3, 2025 15:47
@olsajiri olsajiri changed the title tetragon: Do not bail on missing namespace tetragon: rhel7 changes Apr 4, 2025
@olsajiri olsajiri requested a review from kkourt April 4, 2025 07:16
Copy link
Member

@tixxdz tixxdz left a comment

Choose a reason for hiding this comment

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

LGTM, minor maybe would have been better to have separate bpf_execve_v310.c source with all branches? hmm don't know... since it misses core functionality... maybe...

@olsajiri
Copy link
Contributor Author

olsajiri commented Apr 7, 2025

LGTM, minor maybe would have been better to have separate bpf_execve_v310.c source with all branches? hmm don't know... since it misses core functionality... maybe...

well, we use the __RHEL7_BPF_PROG which seems enough atm.. let's see if there are more changes in future

@olsajiri olsajiri merged commit 8053828 into main Apr 7, 2025
46 checks passed
@olsajiri olsajiri deleted the pr/olsajiri/fixes branch April 7, 2025 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note/minor This PR introduces a minor user-visible change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants