Skip to content

bpf() shim don't follow upstream error conventions #3749

Closed
@lmb

Description

@lmb

Describe the bug

The efW libbpf shim uses the convention of returning -1 and setting errno. Upstream libbpf returns errno directly from most functions, except when returning a pointer. See https://libbpf.readthedocs.io/en/latest/api.html

This problem extends to the bpf() syscall wrapper, which doesn't follow Linux ABI for this reason. See https://man7.org/linux/man-pages/man2/bpf.2.html

OS information

No response

Steps taken to reproduce bug

Call a libbpf function and inspect the return code.

Expected behavior

errno should not be modified, and errors returned according to upstream behaviour.

Actual outcome

errno is modified and -1 returned.

Additional details

No response

Metadata

Metadata

Assignees

Labels

P1bugSomething isn't workingtriagedDiscussed in a triage meeting

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions