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

Handle EPERM everywhere #845

Open
addisoncrump opened this issue Nov 29, 2023 · 3 comments
Open

Handle EPERM everywhere #845

addisoncrump opened this issue Nov 29, 2023 · 3 comments

Comments

@addisoncrump
Copy link
Contributor

Sometimes, aya programs are executed without xtask -- and require sudo to execute properly, otherwise there are insufficient permissions. Aya does not currently have good error output in this case, e.g.:

Error: error relocating function

Caused by:
    0: error relocating `...`
    1: section `6` not found, referenced by symbol `` #11

For each of the BPF calls, the error should be checked if EPERM and handled explicitly.

@alessandrod
Copy link
Collaborator

For context

[2023-11-29T09:31:41Z DEBUG aya::bpf] BPF Feature Detection: Features {
        bpf_name: false,
        bpf_probe_read_kernel: false,
        bpf_perf_link: false,
        bpf_global_data: false,
        bpf_cookie: false,
        cpumap_prog_id: false,
        devmap_prog_id: false,
        btf: None,
    }
[2023-11-29T09:31:41Z DEBUG aya_obj::relocation] failed relocating map by section index 6

The relocation errors happens because the target map - in this case .rodata - is skipped during load as bpf_global_data is set to false. bpf_global_data is set to false like all the other features because all the probes failed with EPERM.

@dave-tucker
Copy link
Member

Can we be 100% sure that we won't get EPERM from syscalls under any other circumstance than failing the capabilities check?

@alessandrod
Copy link
Collaborator

Can we be 100% sure that we won't get EPERM from syscalls under any other circumstance than failing the capabilities check?

Oh no we definitely will. The point is that we need to handle those cases and output meaningful error messages. From the error you get right now if you run without sudo it gives the impression that there is some kind of relocation bug 😅

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

3 participants