Răsfoiți Sursa

Release aya v0.13.1

Signed-off-by: Dave Tucker <[email protected]>
Dave Tucker 4 luni în urmă
părinte
comite
2791badd94
4 a modificat fișierele cu 297 adăugiri și 9 ștergeri
  1. 1 1
      aya-log/Cargo.toml
  2. 294 6
      aya/CHANGELOG.md
  3. 1 1
      aya/Cargo.toml
  4. 1 1
      test/integration-test/Cargo.toml

+ 1 - 1
aya-log/Cargo.toml

@@ -12,7 +12,7 @@ homepage.workspace = true
 edition.workspace = true
 
 [dependencies]
-aya = { path = "../aya", version = "^0.13.0", features = ["async_tokio"] }
+aya = { path = "../aya", version = "^0.13.1", features = ["async_tokio"] }
 aya-log-common = { path = "../aya-log-common", version = "^0.1.15", default-features = false }
 bytes = { workspace = true }
 log = { workspace = true }

+ 294 - 6
aya/CHANGELOG.md

@@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file.
 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
 
-## 0.13.0 (2024-10-09)
+## 0.13.1 (2024-11-01)
 
 ### Chore
 
@@ -37,6 +37,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 ### Bug Fixes
 
+ - <csr-id-ca0c32d1076af81349a52235a4b6fb3937a697b3/> Fill bss maps with zeros
+   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.
  - <csr-id-3d57d358e40591acf23dfde740697fbfff026410/> Fix PerfEventArray resize logic
    There was a logic bug in the previously merged patch where we
    set the correctly calculated max_entries size with the original.
@@ -262,9 +273,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 <csr-read-only-do-not-edit/>
 
- - 65 commits contributed to the release.
- - 223 days passed between releases.
- - 31 commits were understood as [conventional](https://www.conventionalcommits.org).
+ - 69 commits contributed to the release over the course of 241 calendar days.
+ - 247 days passed between releases.
+ - 32 commits were understood as [conventional](https://www.conventionalcommits.org).
  - 0 issues like '(#ID)' were seen in commit messages
 
 ### Commit Details
@@ -274,6 +285,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 <details><summary>view details</summary>
 
  * **Uncategorized**
+    - Release aya-obj v0.2.1 ([`c6a34ca`](https://github.com/aya-rs/aya/commit/c6a34cade195d682e1eece5b71e3ab48e48f3cda))
+    - Merge pull request #1073 from dave-tucker/reloc-bug ([`b2ac9fe`](https://github.com/aya-rs/aya/commit/b2ac9fe85db6c25d0b8155a75a2df96a80a19811))
+    - Fill bss maps with zeros ([`ca0c32d`](https://github.com/aya-rs/aya/commit/ca0c32d1076af81349a52235a4b6fb3937a697b3))
+    - Release aya-obj v0.2.0, aya v0.13.0, safety bump aya v0.13.0 ([`c169b72`](https://github.com/aya-rs/aya/commit/c169b727e6b8f8c2dda57f54b8c77f8b551025c6))
     - Implement TCX ([`5478cac`](https://github.com/aya-rs/aya/commit/5478cac008471bdb80aa30733e4456b70ec1a5bd))
     - Cache `nr_cpus` in a thread_local ([`d05110f`](https://github.com/aya-rs/aya/commit/d05110fd86f9b317d47ffb7cf5c00e588635d4cd))
     - Clarify `Arc` usage ([`afd777b`](https://github.com/aya-rs/aya/commit/afd777b705312b7bafec2a116041a2318d3aa70f))
@@ -341,6 +356,279 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
     - Appease new nightly clippy lints ([`e38eac6`](https://github.com/aya-rs/aya/commit/e38eac6352ccb5c2b44d621161a27898744ea397))
 </details>
 
+## 0.13.0 (2024-10-09)
+
+<csr-id-e575712c596d03b93f75d160e3d95241eb895d39/>
+<csr-id-70ac91dc1e6f209a701cd868db215763d65efa73/>
+<csr-id-481b73b6d8dd9a796d891bba137400c2a43a0afe/>
+<csr-id-c44f8b0f5bddd820a4a98cff293126c0146b827a/>
+<csr-id-02d1db5fc043fb7af90c14d13de6419ec5b9bcb5/>
+<csr-id-fbb09304a2de0d8baf7ea20c9727fcd2e4fb7f41/>
+<csr-id-88f5ac31142f1657b41b1ee0f217dcd9125b210a/>
+<csr-id-1634fa7188e40ed75da53517f1fdb7396c348c34/>
+<csr-id-cb8e47880082ccfcd75b02209b686e15426e9b6a/>
+<csr-id-cd1db86fd490b3c0f03229bd8999a2e67ccecfc4/>
+<csr-id-a25f501ecebaceaacdd1212fac34f528b51ad0fd/>
+<csr-id-fa6af6a20439cccd8ab961f83dce545fb5884dd4/>
+<csr-id-d413e2f285643cbeb665fd3c517e2c9d93d45825/>
+<csr-id-462514ed4c4c06e9618d029a57708c7fa14ab748/>
+<csr-id-e6e1bfeb58ac392637061640365b057182ee1b39/>
+<csr-id-b06ff402780b80862933791831c578e4c339fc96/>
+<csr-id-a4e68ebdbf0e0b591509f36316d12d9689d23f89/>
+<csr-id-e38eac6352ccb5c2b44d621161a27898744ea397/>
+<csr-id-eef7346fb2231f8741410381198015cceeebfac9/>
+
+### Chore
+
+ - <csr-id-e575712c596d03b93f75d160e3d95241eb895d39/> Add comments in `*_wrong_map` tests
+ - <csr-id-70ac91dc1e6f209a701cd868db215763d65efa73/> Rename bpf -> ebpf
+ - <csr-id-481b73b6d8dd9a796d891bba137400c2a43a0afe/> Fix unused_qualifications lints
+   This was failing the docs build.
+
+### Documentation
+
+ - <csr-id-f1773d5af43f5f29b100572e65a60d58f2ce7fac/> fix typo
+ - <csr-id-57a69fe9d28e858562a429bacd9a0a7700b96726/> Use `Ebpf` instead of `Bpf`
+
+### New Features
+
+ - <csr-id-5478cac008471bdb80aa30733e4456b70ec1a5bd/> Implement TCX
+   This commit adds the initial support for TCX
+   bpf links. This is a new, multi-program, attachment
+   type allows for the caller to specify where
+   they would like to be attached relative to other
+   programs at the attachment point using the LinkOrder
+   type.
+ - <csr-id-110a76cb9a1b2ab5c5ad3b6c0828a4ae670e67a0/> Provide a deprecated `BpfError` alias
+ - <csr-id-8c79b71bd5699a686f33360520aa95c1a2895fa5/> Rename Bpf to Ebpf
+   And BpfLoader to EbpfLoader.
+   This also adds type aliases to preserve the use of the old names, making
+   updating to a new Aya release less of a burden. These aliases are marked
+   as deprecated since we'll likely remove them in a later release.
+
+### Bug Fixes
+
+ - <csr-id-3d57d358e40591acf23dfde740697fbfff026410/> Fix PerfEventArray resize logic
+   There was a logic bug in the previously merged patch where we
+   set the correctly calculated max_entries size with the original.
+   
+   To fix this and prevent regressions a unit test was added.
+   This highlighted that the original map definition needs to be
+   mutated in order for the max_entries change to be properly applied.
+   
+   As such, this resize logic moved out of aya::sys into aya::maps
+ - <csr-id-25d986a26d9c88cd499a8b795054d583f01476b2/> Set PerfEventArray max_entries to nCPUs
+   Both libbpf and cilium/ebpf have will set the max_entries of a
+   BPF_MAP_TYPE_PERF_EVENT_ARRAY to the number of online CPUs if
+   it was omitted at map definition time. This adds that same
+   logic to Aya.
+ - <csr-id-38d8e32baa5a4538de9daa6fae634aea6372573c/> fix panic when creating map on custom ubuntu kernel
+ - <csr-id-5e13283f59b0c3b4cb47de1e31d8d0960e80b4cc/> fix rustdocs-args ordering in taplo to -D warnings
+   This fixes the current rustdoc build error by correcting the ordering of
+   `rustdoc-args` to `-D warnings`. Additionally, this also removes the
+   `recorder_arrays` field (defaults to false) so that the order is not
+   modified, which is what caused the error in the first place.
+
+### Other
+
+ - <csr-id-c44f8b0f5bddd820a4a98cff293126c0146b827a/> use FdLink in SockOps programs
+ - <csr-id-02d1db5fc043fb7af90c14d13de6419ec5b9bcb5/> remove unwrap and NonZero* in info
+   Addresses the feedback from #1007:
+   - remove panic from `unwrap` and `expect`
+   - Option<NonZero*> => Option<int> with `0` mapping to `None`
+ - <csr-id-fbb09304a2de0d8baf7ea20c9727fcd2e4fb7f41/> revamp MapInfo be more friendly with older kernels
+   Adds detection for whether a field is available in `MapInfo`:
+   - For `map_type()`, we treturn new enum `MapType` instead of the integer
+     representation.
+   - For fields that can't be zero, we return `Option<NonZero*>` type.
+   - For `name_as_str()`, it now uses the feature probe `bpf_name()` to
+     detect if field is available.
+     Although the feature probe checks for program name, it can also be
+     used for map name since they were both introduced in the same commit.
+ - <csr-id-88f5ac31142f1657b41b1ee0f217dcd9125b210a/> revamp ProgramInfo be more friendly with older kernels
+   Purpose of this commit is to add detections for whether a field is
+   available in `ProgramInfo`.
+   - For `program_type()`, we return the new enum `ProgramType` instead of
+     the integer representation.
+   - For fields that we know cannot be zero, we return `Option<NonZero*>`
+     type.
+   - For `name_as_str()`, it now also uses the feature probe `bpf_name()`
+     to detect if field is available or not.
+   - Two additional feature probes are added for the fields:
+     - `prog_info_map_ids()` probe -> `map_ids()` field
+     - `prog_info_gpl_compatible()` probe -> `gpl_compatible()` field
+   
+   With the `prog_info_map_ids()` probe, the previous implementation that
+   I had for `bpf_prog_get_info_by_fd()` is shortened to use the probe
+   instead of having to make 2 potential syscalls.
+   
+   The `test_loaded_at()` test is also moved into info tests since it is
+   better related to the info tests.
+ - <csr-id-1634fa7188e40ed75da53517f1fdb7396c348c34/> add conversion u32 to enum type for prog, link, & attach type
+   Add conversion from u32 to program type, link type, and attach type.
+   Additionally, remove duplicate match statement for u32 conversion to
+   `BPF_MAP_TYPE_BLOOM_FILTER` & `BPF_MAP_TYPE_CGRP_STORAGE`.
+   
+   New error `InvalidTypeBinding<T>` is created to represent when a
+   parsed/received value binding to a type is invalid.
+   This is used in the new conversions added here, and also replaces
+   `InvalidMapTypeError` in `TryFrom` for `bpf_map_type`.
+ - <csr-id-cb8e47880082ccfcd75b02209b686e15426e9b6a/> improve integration tests for info API
+   Improves the existing integraiton tests for `loaded_programs()` and
+   `loaded_maps()` in consideration for older kernels:
+     - Opt for `SocketFilter` program in tests since XDP requires v4.8 and
+       fragments requires v5.18.
+     - For assertion tests, first perform the assertion, if the assertion
+       fails, then it checks the host kernel version to see if it is above
+       the minimum version requirement. If not, then continue with test,
+       otherwise fail.
+       For assertions that are skipped, they're logged in stderr which can
+       be observed with `-- --nocapture`.
+   
+   This also fixes the `bpf_prog_get_info_by_fd()` call for kernels below
+   v4.15. If calling syscall  on kernels below v4.15, it can produce an
+   `E2BIG` error  because `check_uarg_tail_zero()` expects the entire
+   struct to all-zero bytes (which is caused from the map info).
+   
+   Instead, we first attempt the syscall with the map info filled, if it
+   returns `E2BIG`, then perform syscall again with empty closure.
+   
+   Also adds doc for which version a kernel feature was introduced for
+   better  awareness.
+   
+   The tests have been verified kernel versions:
+     - 4.13.0
+     - 4.15.0
+     - 6.1.0
+ - <csr-id-cd1db86fd490b3c0f03229bd8999a2e67ccecfc4/> adjust bpf programs for big endian
+   In aya/src/sys/bpf.rs, there are several simple bpf programs written as
+   byte arrays. These need to be adjusted to account for big endian.
+ - <csr-id-a25f501ecebaceaacdd1212fac34f528b51ad0fd/> expose run_time_ns and run_cnt fields in ProgramInfo
+   Added functions to expose `run_time_ns` & `run_cnt` statistics from
+   ProgramInfo/bpf_prog_info.
+ - <csr-id-fa6af6a20439cccd8ab961f83dce545fb5884dd4/> add BPF_ENABLE_STATS syscall function
+   Add bpf syscall function for BPF_ENABLE_STATS to enable stats tracking
+   for benchmarking purposes.
+   
+   Additionally, move `#[cfg(test)]` annotation around the `Drop` trait
+   instead. Having separate functions causes some complications when
+   needing ownership/moving of the inner value `OwnedFd` when `Drop` is
+   manually implemented.
+ - <csr-id-d413e2f285643cbeb665fd3c517e2c9d93d45825/> :programs::uprobe: fix bad variable name
+   The variable fn_name was very much *not* the fn_name, but rather the
+   object file path.
+ - <csr-id-462514ed4c4c06e9618d029a57708c7fa14ab748/> adjust symbol lookup tests for object crate alignment requirements
+   The object::File::parse API requires parameter to be aligned with 8 bytes.
+   Adjusted the Vec in the tests with miri to meet this requirement.
+ - <csr-id-e6e1bfeb58ac392637061640365b057182ee1b39/> add symbol lookup in associated debug files
+   This change enhances the logic for symbol lookup in uprobe or uretprobe.
+   If the symbol is not found in the original binary, the search continues
+   in the debug file associated through the debuglink section. Before
+   searching the symbol table, it compares the build IDs of the two files.
+   The symbol lookup will only be terminated if both build IDs exist and do
+   not match. This modification does not affect the existing symbol lookup
+   logic.
+ - <csr-id-b06ff402780b80862933791831c578e4c339fc96/> Generate new bindings
+ - <csr-id-a4e68ebdbf0e0b591509f36316d12d9689d23f89/> include license in crate workspace
+   This PR includes the licenses files in the crate workspace subdirectory.
+   Without this, they won't be showing on crates.io and would be giving out
+   errors on tooling such as rust2rpm.
+ - <csr-id-e38eac6352ccb5c2b44d621161a27898744ea397/> appease new nightly clippy lints
+   ```
+     error: unnecessary qualification
+        --> aya/src/maps/ring_buf.rs:434:22
+         |
+     434 |                 ptr: ptr::NonNull::new(ptr).ok_or(
+         |                      ^^^^^^^^^^^^^^^^^
+         |
+     note: the lint level is defined here
+        --> aya/src/lib.rs:72:5
+         |
+     72  |     unused_qualifications,
+         |     ^^^^^^^^^^^^^^^^^^^^^
+     help: remove the unnecessary path segments
+         |
+     434 -                 ptr: ptr::NonNull::new(ptr).ok_or(
+     434 +                 ptr: NonNull::new(ptr).ok_or(
+         |
+   
+     error: unnecessary qualification
+        --> aya/src/maps/mod.rs:225:21
+         |
+     225 |     let mut limit = std::mem::MaybeUninit::<rlimit>::uninit();
+         |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+         |
+     help: remove the unnecessary path segments
+         |
+     225 -     let mut limit = std::mem::MaybeUninit::<rlimit>::uninit();
+     225 +     let mut limit = mem::MaybeUninit::<rlimit>::uninit();
+         |
+   
+     error: unnecessary qualification
+        --> aya/src/programs/mod.rs:614:9
+         |
+     614 |         crate::obj::Program {
+         |         ^^^^^^^^^^^^^^^^^^^
+         |
+     help: remove the unnecessary path segments
+         |
+     614 -         crate::obj::Program {
+     614 +         obj::Program {
+         |
+   
+     error: unnecessary qualification
+        --> aya/src/util.rs:373:14
+         |
+     373 |     unsafe { std::slice::from_raw_parts(bpf_name.as_ptr() as
+         *const _, length) }
+         |              ^^^^^^^^^^^^^^^^^^^^^^^^^^
+         |
+     help: remove the unnecessary path segments
+         |
+     373 -     unsafe { std::slice::from_raw_parts(bpf_name.as_ptr() as
+         *const _, length) }
+     373 +     unsafe { slice::from_raw_parts(bpf_name.as_ptr() as *const _,
+         length) }
+         |
+   
+     error: unnecessary qualification
+         --> aya/src/maps/mod.rs:1130:47
+          |
+     1130 |                     .copy_from_slice(unsafe {
+          std::mem::transmute(TEST_NAME) });
+          |                                               ^^^^^^^^^^^^^^^^^^^
+          |
+     note: the lint level is defined here
+         --> aya/src/lib.rs:72:5
+          |
+     72   |     unused_qualifications,
+          |     ^^^^^^^^^^^^^^^^^^^^^
+     help: remove the unnecessary path segments
+          |
+     1130 -                     .copy_from_slice(unsafe {
+          std::mem::transmute(TEST_NAME) });
+     1130 +                     .copy_from_slice(unsafe {
+          mem::transmute(TEST_NAME) });
+          |
+   ```
+
+### Performance
+
+ - <csr-id-d05110fd86f9b317d47ffb7cf5c00e588635d4cd/> cache `nr_cpus` in a thread_local
+
+### Test
+
+ - <csr-id-eef7346fb2231f8741410381198015cceeebfac9/> adjust test byte arrays for big endian
+   Adding support for s390x (big endian architecture) and found that some
+   of the unit tests have structures and files implemented as byte arrays.
+   They are all coded as little endian and need a bug endian version to
+   work properly.
+
+### New Features (BREAKING)
+
+ - <csr-id-fd48c55466a23953ce7a4912306e1acf059b498b/> Rename BpfRelocationError -> EbpfRelocationError
+ - <csr-id-cf3e2ca677c81224368fb2838ebc5b10ee98419a/> Rename BpfSectionKind to EbpfSectionKind
+
 ## 0.12.0 (2024-02-28)
 
 <csr-id-b3e7ef741c5b8d09fc7dc8302576f8174be75ff4/>
@@ -1713,7 +2001,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 <csr-read-only-do-not-edit/>
 
- - 45 commits contributed to the release.
+ - 45 commits contributed to the release over the course of 57 calendar days.
  - 79 days passed between releases.
  - 13 commits were understood as [conventional](https://www.conventionalcommits.org).
  - 3 unique issues were worked on: [#256](https://github.com/aya-rs/aya/issues/256), [#264](https://github.com/aya-rs/aya/issues/264), [#268](https://github.com/aya-rs/aya/issues/268)
@@ -2704,7 +2992,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 <csr-read-only-do-not-edit/>
 
- - 121 commits contributed to the release.
+ - 121 commits contributed to the release over the course of 110 calendar days.
  - 102 commits were understood as [conventional](https://www.conventionalcommits.org).
  - 0 issues like '(#ID)' were seen in commit messages
 

+ 1 - 1
aya/Cargo.toml

@@ -1,6 +1,6 @@
 [package]
 name = "aya"
-version = "0.13.0"
+version = "0.13.1"
 description = "An eBPF library with a focus on developer experience and operability."
 keywords = ["bpf", "ebpf", "kernel", "linux"]
 readme = "README.md"

+ 1 - 1
test/integration-test/Cargo.toml

@@ -11,7 +11,7 @@ edition.workspace = true
 [dependencies]
 anyhow = { workspace = true, features = ["std"] }
 assert_matches = { workspace = true }
-aya = { path = "../../aya", version = "^0.13.0", default-features = false }
+aya = { path = "../../aya", version = "^0.13.1", default-features = false }
 aya-log = { path = "../../aya-log", version = "^0.2.1", default-features = false }
 aya-obj = { path = "../../aya-obj", version = "^0.2.1", default-features = false }
 env_logger = { workspace = true }