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

policies with the same symbols are broken #2947

Closed
kkourt opened this issue Sep 23, 2024 · 1 comment · Fixed by #3121
Closed

policies with the same symbols are broken #2947

kkourt opened this issue Sep 23, 2024 · 1 comment · Fixed by #3121
Labels
kind/bug Something isn't working

Comments

@kkourt
Copy link
Contributor

kkourt commented Sep 23, 2024

Policies that use the same symbols do not currently work. Here's an example:

apiVersion: cilium.io/v1alpha1
kind: TracingPolicy
metadata:
  name: "multiple-symbols"
spec:
  kprobes:
  - call: __x64_sys_prctl
    args:
    - index: 0
      type: int64
    selectors:
    - matchArgs:
      - index: 0
        operator: Equal
        values:
        - "3"
    syscall: true
    tags:
    - pr_get_dumpable
  - call: __x64_sys_prctl
    args:
    - index: 0
      type: int64
    selectors:
    - matchArgs:
      - index: 0
        operator: Equal
        values:
        - "7"
    syscall: true
    tags:
    - pr_get_keepcaps

When using multi-kprobes, using this policy leads to the following error:

level=fatal msg="Failed to start tetragon" error="failed to get sensors from parser policy: sensor generic_kprobe from collection auditd-policy failed to load: failed prog /home/kkourt/src/hubble-fgs/bpf/objs/bpf_multi_kprobe_v61.o kern_version 394509 loadInstance: attaching 'generic_kprobe_event' failed: couldn't find one or more symbols: file does not exist" 

Disabling multi-kprobes, only part of the policy is applied (typically the one that is defined last).
The reason for this seems to be that when using the new bpffs hierarchy (#2128), the two calls will end up in the same directory, using the same maps.

Note that in 1.2 this works as expected, because we use different maps for each different hook. e.g.,

gkp-sensor-1-gkp-0-argfilter_maps
gkp-sensor-1-gkp-1-argfilter_maps
@kkourt kkourt added the kind/bug Something isn't working label Sep 23, 2024
@kkourt
Copy link
Contributor Author

kkourt commented Sep 23, 2024

@olsajiri can you PTAL?

When we are not using multi-kprobes, I think it would make sense to add an id to the call in the directory, so that we can separate the two.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant