Commit Graph

994 Commits (6a25d4ddec42e3408bd823fccc6e64c33575bc5c)
 

Author SHA1 Message Date
Alessandro Decina f81b1b9f3e
Merge pull request #501 from alessandrod/fix-enum32-relocs
aya: btf: fix relocations for signed enums (32 bits)
2 years ago
Alessandro Decina 4482db42d8 aya: btf: fix relocations for signed enums (32 bits)
Enums now carry a signed bit in the info flags. Take it into account
when applying enum relocations.
2 years ago
Alessandro Decina d6b976c6f1 aya: btf: switch ComputedRelocationValue::value to u64
This is in preparation of adding Enum64 relocation support
2 years ago
Alessandro Decina 9d7c950d1b
Merge pull request #506 from alessandrod/macos-tests
Speed up integration tests
2 years ago
Alessandro Decina 455cc95e8f integration-tests: run on macos to get nested virtualization
Switch integration-test host to macos as only macos runners support nested
virtualization. Adjust integration test runner accordingly.
2 years ago
Alessandro Decina 8e9608eedd test/run.sh: output `uname -a` after starting the vm 2 years ago
Alessandro Decina c7b262641b Run integration tests under fedora37 2 years ago
Michal Rostecki d2a999d27a
Merge pull request #504 from vadorovsky/unpin-nightly
Unpin Rust nightly
2 years ago
Michal Rostecki 7d19bde66b Unpin Rust nightly
The issues with core::sync::atomic got fixed.

Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
2 years ago
Alessandro Decina 3e9d85f871
Merge pull request #500 from vadorovsky/bpf-macros-visibility
aya-bpf-macros: Allow to make programs public
2 years ago
Alessandro Decina 7e5637bb9c
Merge pull request #471 from banditopazzo/tracefs_mount_select
add tracefs mount point select function
2 years ago
banditopazzo 48fdf5a250 chore: tracefs review fixes 2 years ago
banditopazzo c6c4ac7eea feat: get_tracefs function 2 years ago
Michal Rostecki 6ad2c3c373 aya-bpf-macros: Allow to make programs public
Allow to define programs as public functions (even in library crates)
and then import them.

For example, we can have library crate with `libfoo/src/lib.rs`
containing:

```rust
pub fn my_xdp_program(ctx: XdpContext) -> u32 {
    xdp_action::XDP_PASS
}
```

And then a binary importing it:

```rust
pub use libfoo::my_xdp_program;
```

This way, commonly used eBPF programs can be distributed as lib crates.

Tested with: https://github.com/vadorovsky/aya-examples/tree/main/pub-progs

Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
2 years ago
Alessandro Decina 556463a85f ebpf: SkbBuff: add some accessors 2 years ago
Andre Fredette d43879d991 Updates after rebase due to changes in define_link_wrapper
Signed-off-by: Andre Fredette <afredette@redhat.com>
2 years ago
Andre Fredette 6766532341 Remove SchedClassifierLink description
It was redundant with the one provided in define_link_wrapper

Signed-off-by: Andre Fredette <afredette@redhat.com>
2 years ago
Andre Fredette 2972d462a5 Address review comments
- Rename `new_tc_link` to `attached`
- Simplified example for `attached`

The following was not requested in reviews:
- Moved example from `SchedClassifierLink` tor
  `SchedClassifierLink::attached' since we're only showing an
  example of that one method

Signed-off-by: Andre Fredette <afredette@redhat.com>
2 years ago
Andre Fredette 65f5b76593 Address review comments
Signed-off-by: Andre Fredette <afredette@redhat.com>
2 years ago
Andre Fredette 849796c420 rename SchedClassifierLink:new() to new_tc_link()
Avoids name confilct with pr #462

Signed-off-by: Andre Fredette <afredette@redhat.com>
2 years ago
Andre Fredette 67efc33414 Additional edits to SchedClassifierLink documentation.
Signed-off-by: Andre Fredette <afredette@redhat.com>
2 years ago
Andre Fredette 6563e6cc06 Combine updates to SchedClassifierLink example made by Dave Tucker
Co-authored-by: Dave Tucker <dave@dtucker.co.uk>
Signed-off-by: Andre Fredette <afredette@redhat.com>
2 years ago
Andre Fredette c3a8400e4d Add example for SchedClassifierLink::new()
Also modified the impl a bit to work as described in the example.

Signed-off-by: Andre Fredette <afredette@redhat.com>
2 years ago
Andre Fredette f46fd17cc3 Support reconstruction of `SchedClassifierLink`
This is the proposed solution for Step 2 of issue #414

“For cases where you have done program.take_link() to manage
ownership of TcLink we need an API similar to PinnedLink::from_pin
that can reconstruct a TcLink”

As long as a user application continues to run after executing
`take_link()`, the `SchedClassifierLink` returned can be used to
detach the program.  However, if we want to handle cases where the
application exits or crashes, we need a way to save and reconstruct
the link, and to do that, we also need to know the information
required for the reconstruction -- namely, the `interface`,
`attach_type`, `priority`, and `handle`.  The user knows the first
two because they are required to execute `attach()` in the first
place; however, the user will not know the others if they let the
system choose them.

This pr solves the problems by adding an `impl` for
`SchedClassifierLink` with an accessor for `tc_options` and a `new()`
function.

Signed-off-by: Andre Fredette <afredette@redhat.com>
2 years ago
Andrew Stoycos 1899d5f4fd Expose inner errors
Currently aya will just report a standard outer level
error on failure.  Ensure that we also report the inner
error condition back to the user

Signed-off-by: Andrew Stoycos <astoycos@redhat.com>
2 years ago
Alessandro Decina 9f4ef6f67d Fix lints 2 years ago
Alessandro Decina d33ed21fc4 Pin nightly to nightly-2023-01-10
This until https://github.com/rust-lang/rust/pull/106796 gets fixed
2 years ago
Alessandro Decina 405c6a8533
Merge pull request #485 from MatteoNardi/remove_libbpf_dependency
Remove libbpf dependency from relocation tests
2 years ago
Michal Rostecki e2b3be6b31
Merge pull request #486 from vadorovsky/integration-smoke-fix-version-check
integration-test: Fix the kernel version chceck for smoke test
2 years ago
Michal Rostecki bea0e83512
Merge pull request #484 from vadorovsky/update-tokio
Update Tokio and inventory
2 years ago
Michal Rostecki 42c4a8be7c
Merge pull request #487 from vadorovsky/new-map-types
aya-obj: Add new map types
2 years ago
Michal Rostecki 3d03c8a8e0 aya-obj: Add new map types
Include all new map types which were included in the last libbpf update
(5d13fd5aca).

Fixes: cb28533e2f ("aya-obj: Update `BPF_MAP_TYPE_CGROUP_STORAGE` name to `BPF_MAP_TYPE_CGRP_STORAGE`")
Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
2 years ago
Michal Rostecki 0399991383
Merge pull request #483 from aya-rs/codegen
Update libbpf to 3423d5e7cdab356d115aef7f987b4a1098ede448
2 years ago
Michal Rostecki cb28533e2f aya-obj: Update `BPF_MAP_TYPE_CGROUP_STORAGE` name to `BPF_MAP_TYPE_CGRP_STORAGE`
It changed in libbpf

Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
2 years ago
Michal Rostecki 75336e5a35 integration-test: Fix the kernel version chceck for smoke test
Before this chane, the check was always negative if the minor version
was less then 9. So, for example, the smoke test was skipped for kernel
6.1:

```
skipping as 6.1 does not meet version requirement of 5.9
```

Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
2 years ago
Matteo Nardi 3000949bcc Remove libbpf dependency from relocation tests
Simplifiy the relocation tests build process by removing the need for libbpf
at runtime. Its usage is replaced with local `__builtin_*` attributes.
This removes the need for the `LIBBPF_INCLUDE` env variable.
2 years ago
Michal Rostecki dad75f45ac Update Tokio and inventory
Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
2 years ago
alessandrod 5d13fd5aca [codegen] Update libbpf to 3423d5e7cdab356d115aef7f987b4a1098ede448Update libbpf to 3423d5e7cdab356d115aef7f987b4a1098ede448
Files changed:
M	aya-obj/src/generated/linux_bindings_aarch64.rs
M	aya-obj/src/generated/linux_bindings_armv7.rs
M	aya-obj/src/generated/linux_bindings_riscv64.rs
M	aya-obj/src/generated/linux_bindings_x86_64.rs
M	bpf/aya-bpf-bindings/src/aarch64/bindings.rs
M	bpf/aya-bpf-bindings/src/aarch64/helpers.rs
M	bpf/aya-bpf-bindings/src/armv7/bindings.rs
M	bpf/aya-bpf-bindings/src/armv7/helpers.rs
M	bpf/aya-bpf-bindings/src/riscv64/bindings.rs
M	bpf/aya-bpf-bindings/src/riscv64/helpers.rs
M	bpf/aya-bpf-bindings/src/x86_64/bindings.rs
M	bpf/aya-bpf-bindings/src/x86_64/helpers.rs
2 years ago
Alessandro Decina 4cc0ea09e0
Merge pull request #467 from MatteoNardi/relocation_tests
Add integration tests for BTF relocations
2 years ago
Matteo Nardi 34e040b8e9 tests: use libtest-mimic and fix CI 2 years ago
Michal Rostecki c0b243930e
Merge pull request #402 from vadorovsky/array-get-ptr
aya-bpf/maps: Add `get_ptr` and `get_mut_ptr` methods to Array
2 years ago
Michal Rostecki 33baf7ef22 aya-bpf/maps: Add `get_ptr` and `get_mut_ptr` methods to Array
Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
2 years ago
Matteo Nardi 27f22f205d Make relocations tests actually pass 2 years ago
Matteo Nardi 702f77b565 tests: explain libbpf env variable 2 years ago
Matteo Nardi b72abcc7de tests: add pointer relocation test 2 years ago
Matteo Nardi 7e6a7d9005 btf: add integration tests for relocations
Add new integrations tests for BTF relocations.
2 years ago
Alessandro Decina 897957ac84
Merge pull request #475 from yesh0/aya-obj
aya-obj: move code for object file loading and relocation into a separate crate
2 years ago
Shenghui Ye 9c451a3357 aya-obj: update documentation and versioning info
- Set the version number of `aya-obj` to `0.1.0`.
- Update the description of the `aya-obj` crate.
- Add a section in README and rustdoc warning about the unstable API.
2 years ago
Shenghui Ye 772af170ae aya-obj: add documentation on program names
This commit adds documentation on how program names are parsed from
section names, as is used by `aya_obj::Object.programs` as HashMap keys,
and updates the examples into using program names.
2 years ago
Shenghui Ye 9ec3447e89 aya-obj: fix rustfmt diffs and typos 2 years ago