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

fix(aya): BSS Sections must be filled with zeros #1073

Merged
merged 3 commits into from
Nov 1, 2024

Conversation

dave-tucker
Copy link
Member

See individual commits.

In summary, we need to fill BSS sections with 0's up to the size of the ELF section.
Otherwise access to these variables will fail with the following verifier error:

cannot access ptr member ops with moff 0 in struct bpf_map with off 0 size 4

Fixes: #1002

Users have reported issues with programs failing the verifier when they
are attempting to read or write to variables that the compiler places in
the .bss section. Add a test that places variables in each section and
exercises read and write operations on them.

Signed-off-by: Dave Tucker <[email protected]>
This provides more useful failure messages when integration tests fail

Signed-off-by: Dave Tucker <[email protected]>
The loader should fill bss maps with zeros according to the size of the
ELF section.
Failure to do so yields weird verifier messages as follows:

```
cannot access ptr member ops with moff 0 in struct bpf_map with off 0 size 4
```

Reference to this in the cilium/ebpf code is here [1].
I could not find a reference in libbpf.

1: https://github.com/cilium/ebpf/blob/d0c8fc19376a9276cf5310c288d1eae99ed39eb3/elf_reader.go#L1159-L1165

Signed-off-by: Dave Tucker <[email protected]>
Copy link

netlify bot commented Nov 1, 2024

Deploy Preview for aya-rs-docs ready!

Name Link
🔨 Latest commit ca0c32d
🔍 Latest deploy log https://app.netlify.com/sites/aya-rs-docs/deploys/6724c65140e632000857d9f4
😎 Deploy Preview https://deploy-preview-1073--aya-rs-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@mergify mergify bot added aya This is about aya (userspace) aya-obj Relating to the aya-obj crate test A PR that improves test cases or CI labels Nov 1, 2024
@dave-tucker dave-tucker merged commit b2ac9fe into aya-rs:main Nov 1, 2024
27 checks passed
@dave-tucker dave-tucker deleted the reloc-bug branch November 1, 2024 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aya This is about aya (userspace) aya-obj Relating to the aya-obj crate test A PR that improves test cases or CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error: the BPF_PROG_LOAD syscall failed.
2 participants