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

BPFTool Prog Loadall command Deletes /sys/fs/cgroup virtual file system directory #127

Closed
ndejaco2 opened this issue Dec 7, 2023 · 3 comments

Comments

@ndejaco2
Copy link

ndejaco2 commented Dec 7, 2023

I am using the following BPFTool version:

bpftool v7.3.0
using libbpf v1.3
Linux version: 4.14.328-248.540.amzn2.aarch64

I am running a command to load my BPF program like so:

sudo ./bpftool prog loadall myProgram.o /sys/fs/bpf/ pinmaps /sys/fs/bpf/

The strange behavior I am seeing is that the result of this command is that the /sys/fs/cgroup directory is deleted when it existed prior to calling this command:

$ sudo ls -l /sys/fs/cgroup
ls: cannot access /sys/fs/cgroup: No such file or directory

This causes issues for initialization of systemd services which are using cgroup to limit memory consumption which I am trying to initialize after loading the BPF program. Is this behavior expected and is there some workaround I can apply?

@ndejaco2 ndejaco2 changed the title BPFTool command Deletes /sys/fs/cgroup virtual file system directory. BPFTool command Deletes /sys/fs/cgroup virtual file system directory Dec 7, 2023
@ndejaco2 ndejaco2 changed the title BPFTool command Deletes /sys/fs/cgroup virtual file system directory BPFTool Prog Loadall command Deletes /sys/fs/cgroup virtual file system directory Dec 7, 2023
@qmonnet
Copy link
Member

qmonnet commented Dec 8, 2023

Hi, thanks for the report!

This looks like a consequence of #100, with bpftool mistakenly re-mounting the bpffs on top of the parent directory of your path (/sys/fs/) and masking the previous contents of the directory.

This needs to be fixed, but in the meantime, you can probably work around it by passing another path to pin your programs? bpftool prog loadall ... pinmaps /sys/fs/bpf/myProgram?

@ndejaco2
Copy link
Author

ndejaco2 commented Dec 8, 2023

Thanks! I found this command properly loaded the program without deleting /sys/fs/cgroup:

sudo ./bpftool prog loadall myProgram.o /sys/fs/bpf/myProgram/ pinmaps /sys/fs/bpf/myProgram/

@qmonnet
Copy link
Member

qmonnet commented Dec 8, 2023

OK, great! I'll try to work on a proper fix when I find a moment.

@qmonnet qmonnet closed this as completed Dec 8, 2023
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

No branches or pull requests

2 participants