Cilium: bugtool: Incorrect BPF filesystem path

Created on 18 Sep 2020  路  4Comments  路  Source: cilium/cilium

In bugtool, the path to the BPF filesystem is hardcoded to /sys/fs/bpf:
https://github.com/cilium/cilium/blob/f55458f9bfd412b7334b535c43bab593910c6b31/bugtool/cmd/configuration.go#L67-L70

In some environments, however, the BPF filesystem is mounted elsewhere. Our bugtool should retrieve the correct path automatically. Without this we may be missing some map contents (e.g., CT maps) in some environments.

arebugtool good-first-issue kinbug

Most helpful comment

There might be a simpler solution, we could search for bpffs mountpoints with mount | grep bpf and list all of them (+ fallback on /sys/fs/bpf/ if nothing found, although I'm not sure if there's a case when it wouldn't show up in mount). This way we don't have to ask to the agent.

All 4 comments

Note: the agent retrieve the alternate location with the --bpf-root option and holds it in the option.Config.BPFRoot variable.

Note: the agent retrieve the alternate location with the --bpf-root option and holds it in the option.Config.BPFRoot variable.

I think bugtool should not rely on the agent being up and running. Otherwise, it won't be possible to retrieve its output when cilium-agent is failing to run (e.g. due to OOM).

I think bugtool should not rely on the agent being up and running. Otherwise, it won't be possible to retrieve its output when cilium-agent is failing to run (e.g. due to OOM).

I agree. We should try to get cilium-agent's bpffs path and fallback to our current default otherwise.

There might be a simpler solution, we could search for bpffs mountpoints with mount | grep bpf and list all of them (+ fallback on /sys/fs/bpf/ if nothing found, although I'm not sure if there's a case when it wouldn't show up in mount). This way we don't have to ask to the agent.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

twpayne picture twpayne  路  3Comments

tklauser picture tklauser  路  3Comments

hazelnutsgz picture hazelnutsgz  路  3Comments

christarazi picture christarazi  路  4Comments

brb picture brb  路  4Comments