foniod / redbpf

Rust library for building and running BPF/eBPF modules
Apache License 2.0
1.71k stars 136 forks source link

Permission Denied (os 13) bpf-tools on install #323

Closed hacker-jak closed 2 years ago

hacker-jak commented 2 years ago

It appears that when installing bpf-tools a symlink is created in /opt/solana-release/bin/sdk/bpf/dependencies which is root owned and write protected, resulting in a Permisison Denied (os 13) error. I couldn't find a way to install bpf-tools without running cargo bulid-bpf when attempting to build a project, so this forces the user to run it using sudo (not ideal).

OS: Arch Linux x86_64 Kernel: 5.17+

hacker-jak commented 2 years ago

I have a temporary workaround that allows bpf-tools to be installed. Adding ACL +rwx permissions for the current user for a single build will install bpf-tools and place the symlink properly.

sudo setfacl -m u:[user]:rwx /opt/solana-release/bin/sdk/bpf/dependencies

I have removed this permission after the first build and all is well.

sudo setfacl -b /opt/solana-release/bin/sdk/bpf/dependencies

Being able to install bpf-tools separately w/ sudo before running cargo build-bpf for a build would be ideal. Or just not requiring the symlinks to be placed in a protected dir.

nbaksalyar commented 2 years ago

This seems more like an issue with the Solana SDK? The cargo-build-bpf script is in the solana-labs repo and as far as I can see they don't actually have a dependency for redbpf.

hacker-jak commented 2 years ago

Yes you are right @nbaksalyar. My apologies, I didn't realize it was that script. Running cargo build-bpf --help shows that it belongs to the solana-cargo-build-bpf crate. Though it's no longer hosted on crates.io and must be included in solana.