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 CI errors #398

Merged
merged 3 commits into from
Oct 3, 2022
Merged

Fix CI errors #398

merged 3 commits into from
Oct 3, 2022

Conversation

vadorovsky
Copy link
Member

@vadorovsky vadorovsky commented Sep 30, 2022

miri has the a warning about integer-to-pointer casts, due to the new Strict Provenance API[0] in Rust nightly which provides methods like from_exposed_addr and compiler intrinsic to do it safely.

We could fix some of the warnings by operating on byte slices instead of pointers. However, sometimes we only have an integer. There is a crate providing the Strict Provenance API methods[1], but it does integer-to-pointer casts itself, so miri issues warnings anyway.

Therefore we need to disable this check for now.

The other CI failure to fix was incompability of integration tests with libbpf 1.0 (we were using legacy maps instead of BTF maps).

[0] https://doc.rust-lang.org/nightly/std/ptr/index.html#strict-provenance
[1] https://crates.io/crates/sptr

Signed-off-by: Michal Rostecki vadorovsky@gmail.com

@netlify
Copy link

netlify bot commented Sep 30, 2022

Deploy Preview for aya-rs-docs ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 3253918
🔍 Latest deploy log https://app.netlify.com/sites/aya-rs-docs/deploys/633aec27a6178d000826bc44
😎 Deploy Preview https://deploy-preview-398--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 settings.

@vadorovsky vadorovsky force-pushed the fix-miri branch 4 times, most recently from db6e67b to 26b27c7 Compare September 30, 2022 05:54
@vadorovsky vadorovsky changed the title Avoid integer to pointer casts Fix miri errors Sep 30, 2022
@vadorovsky vadorovsky force-pushed the fix-miri branch 3 times, most recently from 0468dbc to faddbce Compare September 30, 2022 06:06
@vadorovsky vadorovsky changed the title Fix miri errors Fix CI errors Sep 30, 2022
Copy link
Member

@astoycos astoycos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Miri now passes locally with these fixes and I've also included them here #397

Thanks!

test/integration-ebpf/src/bpf/multimap.bpf.c Outdated Show resolved Hide resolved
.github/workflows/lint.yml Outdated Show resolved Hide resolved
aya/src/obj/btf/types.rs Outdated Show resolved Hide resolved
aya/src/obj/mod.rs Outdated Show resolved Hide resolved
@vadorovsky vadorovsky force-pushed the fix-miri branch 2 times, most recently from fc11055 to b5ef9c6 Compare October 3, 2022 13:49
Instead, operate on byte slices if possible. That's the first step in
getting rid of miri warnings about Strict Provenance[0].

[0] https://doc.rust-lang.org/nightly/std/ptr/index.html#strict-provenance

Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
`override_syscall` performs integer-to-pointer conversion. This is
considered harmful on the newest Rust nightly which provides
`ptr::from_exposed_addr`, but there is no other way on Rust stable than
doing `as *const T`, which is what miri is unhappy about.

Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
libbpf 1.0 doesn't support multimaps defined in `maps` section, it
supports only BTF maps.

At the same time, we already test multimaps loading with the Rust
example (`integration-ebpf/src/bpf/map_test.rs`), so we can just remove
the failing C test.

Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
@vadorovsky vadorovsky merged commit 3f2f3a8 into aya-rs:main Oct 3, 2022
@vadorovsky vadorovsky deleted the fix-miri branch October 3, 2022 20:52
@dave-tucker dave-tucker added aya This is about aya (userspace) fix A PR that is a small change or fixes a bug labels Feb 23, 2023
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) fix A PR that is a small change or fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants