4
0

CHANGELOG.md 30 KB

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

v0.2.1 (2024-10-09)

Chore

  • Rename bpf -> ebpf

Documentation

  • reword rustdocs a bit

New Features

  • 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.
  • Rename BpfLogger to EbpfLogger

Bug Fixes

  • print &[u8] using full width Otherwise &[1u8, 0u8] cannot be distinguished from &[0x10u8] (they both become 10)

Other

  • remove unwrap and NonZero* in info Addresses the feedback from #1007:
    • remove panic from unwrap and expect
    • Option => Option with 0 mapping to None
    • 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.
    • 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.

    • Allow logging core::net::Ipv4Addr and core::net::Ipv6Addr IP address types are available in core, so they can be used also in eBPF programs. This change adds support of these types in aya-log.

      • Add implementation of WriteTuBuf to these types.
      • Support these types in Ipv4Formatter and Ipv6Formatter.
      • Support them with DisplayHint::Ip.
      • Add support for formatting [u8; 4], to be able to handle Ipv4Addr::octets.
    • allow re-attach and read previously created logs This feature is useful if someone wants to view the log contents of a program that is already running. For e.g. a pinned program or an XDP program attached to a net interface.

    Test

    • 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.

    Commit Statistics

    • 20 commits contributed to the release.
    • 223 days passed between releases.
    • 11 commits were understood as conventional.
    • 1 unique issue was worked on: #1008

    Commit Details

    view details * **[#1008](https://github.com/aya-rs/aya/issues/1008)** - Print &[u8] using full width ([`55ed9e0`](https://github.com/aya-rs/aya/commit/55ed9e0546)) * **Uncategorized** - Release aya-log-common v0.1.15, aya-log-ebpf v0.1.1 ([`04bbbcc`](https://github.com/aya-rs/aya/commit/04bbbccffa)) - Release aya-obj v0.2.0, aya v0.13.0, safety bump aya v0.13.0 ([`c169b72`](https://github.com/aya-rs/aya/commit/c169b727e6)) - Reduce duplication in `{nr,possible}_cpus` ([`f3b2744`](https://github.com/aya-rs/aya/commit/f3b2744072)) - Remove unwrap and NonZero* in info ([`02d1db5`](https://github.com/aya-rs/aya/commit/02d1db5fc0)) - Merge pull request #1007 from tyrone-wu/aya/info-api ([`15eb935`](https://github.com/aya-rs/aya/commit/15eb935bce)) - Revamp MapInfo be more friendly with older kernels ([`fbb0930`](https://github.com/aya-rs/aya/commit/fbb09304a2)) - Revamp ProgramInfo be more friendly with older kernels ([`88f5ac3`](https://github.com/aya-rs/aya/commit/88f5ac3114)) - Merge pull request #974 from Billy99/billy99-arch-ppc64-s390x ([`ab5e688`](https://github.com/aya-rs/aya/commit/ab5e688fd4)) - Adjust test byte arrays for big endian ([`eef7346`](https://github.com/aya-rs/aya/commit/eef7346fb2)) - Revert "Remove unused `allow(dead_code)`" ([`4161993`](https://github.com/aya-rs/aya/commit/41619933d6)) - Remove unused `allow(dead_code)` ([`5397c1c`](https://github.com/aya-rs/aya/commit/5397c1ca4b)) - Allow logging `core::net::Ipv4Addr` and `core::net::Ipv6Addr` ([`a75fc2f`](https://github.com/aya-rs/aya/commit/a75fc2f769)) - Merge pull request #900 from catalin-h/log_init_from_program_id ([`e5d107d`](https://github.com/aya-rs/aya/commit/e5d107dd50)) - Reword rustdocs a bit ([`8830c0b`](https://github.com/aya-rs/aya/commit/8830c0bc20)) - Allow re-attach and read previously created logs ([`e66f954`](https://github.com/aya-rs/aya/commit/e66f9540c9)) - Merge pull request #528 from dave-tucker/rename-all-the-things ([`63d8d4d`](https://github.com/aya-rs/aya/commit/63d8d4d34b)) - Rename Bpf to Ebpf ([`8c79b71`](https://github.com/aya-rs/aya/commit/8c79b71bd5)) - Rename BpfLogger to EbpfLogger ([`a93e354`](https://github.com/aya-rs/aya/commit/a93e354620)) - Rename bpf -> ebpf ([`41c6156`](https://github.com/aya-rs/aya/commit/41c61560ea))

    v0.2.0 (2024-02-28)

    Chore

    • Don't use path deps in workspace This moves the path dependencies back into the per-crate Cargo.toml. It is required such that the release tooling can correctly calculate which version constraints require changing when we perform a release.
    • Use the cargo workspace package table This allows for inheritance of common fields from the workspace root. The following fields have been made common:

      • authors
      • license
      • repository
      • homepage
      • edition

    Documentation

    • Add CHANGELOG

    New Features

    • check format and value type in proc macro

    Bug Fixes

    • remove some useless code

    Other

    • group_imports = "StdExternalCrate" High time we stop debating this; let the robots do the work.
    • s/Result/Option/ Option<NonZeroUsize> is guaranteed to have the same size as usize, which is not guarnateed for Result. This is a minor optimization, but also results in simpler code.
    • Define dependencies on the workspace level This way we will avoid version mismatches and make differences in features across our crates clearer.
    • add formatter and check in CI
    • Unify IP format hints into one, repsesent it by :i token Having separate format hints and tokens per IP address family is unnecessary, since they are represented by different types and we handle format hints for each type separately. So we can just have one format hint.
    • Also, we should be consistent with the format strings grammar in Rust[0]. The type token, which is mapped to formatting traits, usually consists of one letter1. It shouldn't consist of multiple letters. Our :ipv4 and :ipv6 tokens were clearly breaking that convention, so we should rather switch to something with one letter - hence :i.

      [0] https://doc.rust-lang.org/std/fmt/#syntax [1] https://doc.rust-lang.org/std/fmt/#formatting-traits

      • support logging byte slices These only support LowerHex and UpperHex hints for now.
      • check errors in tests
      • Move the Pod implementations from aya-log-common to aya-log Keeping the Pod implementations and optional dependency on aya in aya-log-common breaks the clippy checks (which are made on the entire workspace).

      The reason is that when different crates inside the workspace have the same dependency with different features, that dependency is built only once with the sum of features needed by all crates. It's not being built separately with different feature sets.

      That's why, before this change, aya-log-common was built once for the entire workspace with userspace feature enabled. That made importing aya-log-ebpf inside integration-ebpf impossible. The aya-log-common build, with userspace feature enabled, was pulling std as a dependency. Therefore, importing aya-log-ebpf inside integration-ebpf resulted in including std and errors like:

        error[E0152]: found duplicate lang item `panic_impl`
          --> test/integration-ebpf/src/log.rs:23:1
           |
        23 | fn panic(_info: &core::panic::PanicInfo) -> ! {
           | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
           |
           = note: the lang item is first defined in crate `std` (which `aya` depends on)
      

      This change fixes the problem by removing the userspace feature from aya-log-common and moving the Pod implementations to aya-log.


      updated-dependencies:

      • dependency-name: env_logger dependency-type: direct:production ...

      Commit Statistics

      • 38 commits contributed to the release.
      • 469 days passed between releases.
      • 14 commits were understood as conventional.
      • 0 issues like '(#ID)' were seen in commit messages

      Commit Details

      view details * **Uncategorized** - Release aya-log-common v0.1.14, aya-log v0.2.0 ([`b6a84b6`](https://github.com/aya-rs/aya/commit/b6a84b658a)) - Add CHANGELOG ([`9abb716`](https://github.com/aya-rs/aya/commit/9abb7160e5)) - Release aya-log-common v0.1.14, aya-log v0.2.0 ([`c22a696`](https://github.com/aya-rs/aya/commit/c22a6963d4)) - Release aya-obj v0.1.0, aya v0.12.0, safety bump aya-log v0.2.0 ([`0e99fa0`](https://github.com/aya-rs/aya/commit/0e99fa0f34)) - Don't use path deps in workspace ([`13b1fc6`](https://github.com/aya-rs/aya/commit/13b1fc63ef)) - Merge pull request #882 from dave-tucker/metadata ([`0fadd69`](https://github.com/aya-rs/aya/commit/0fadd69537)) - Use the cargo workspace package table ([`b3e7ef7`](https://github.com/aya-rs/aya/commit/b3e7ef741c)) - Appease rustc dead_code lint ([`963dd13`](https://github.com/aya-rs/aya/commit/963dd13219)) - Merge pull request #797 from aya-rs/rustfmt-group-imports ([`373fb7b`](https://github.com/aya-rs/aya/commit/373fb7bf06)) - Group_imports = "StdExternalCrate" ([`d16e607`](https://github.com/aya-rs/aya/commit/d16e607fd4)) - Merge pull request #736 from aya-rs/logging-better ([`45df251`](https://github.com/aya-rs/aya/commit/45df2519b6)) - Merge pull request #735 from aya-rs/log-option-not-result ([`ecf0dd9`](https://github.com/aya-rs/aya/commit/ecf0dd9739)) - S/Result/Option/ ([`ca3f70b`](https://github.com/aya-rs/aya/commit/ca3f70b16a)) - Remove pointless DefaultLogger ([`00d265c`](https://github.com/aya-rs/aya/commit/00d265c51b)) - Merge pull request #667 from vadorovsky/workspace-dependencies ([`f554d42`](https://github.com/aya-rs/aya/commit/f554d42105)) - Define dependencies on the workspace level ([`96fa08b`](https://github.com/aya-rs/aya/commit/96fa08bd82)) - Merge pull request #666 from aya-rs/toml-fmt ([`dc3b0b8`](https://github.com/aya-rs/aya/commit/dc3b0b8730)) - Add formatter and check in CI ([`c8bf646`](https://github.com/aya-rs/aya/commit/c8bf646ef0)) - Merge pull request #650 from aya-rs/test-cleanup ([`61608e6`](https://github.com/aya-rs/aya/commit/61608e6458)) - Remove "async" feature ([`fa91fb4`](https://github.com/aya-rs/aya/commit/fa91fb4f59)) - Unify IP format hints into one, repsesent it by `:i` token ([`84e5e28`](https://github.com/aya-rs/aya/commit/84e5e2894f)) - Remove some useless code ([`d999a95`](https://github.com/aya-rs/aya/commit/d999a95b41)) - Check format and value type in proc macro ([`0970300`](https://github.com/aya-rs/aya/commit/0970300d1f)) - Merge pull request #585 from probulate/tag-len-value ([`5165bf2`](https://github.com/aya-rs/aya/commit/5165bf2f99)) - Support logging byte slices ([`d9f966e`](https://github.com/aya-rs/aya/commit/d9f966ec9e)) - Aya-log, aya-log-common: economize bytes ([`a4a69a6`](https://github.com/aya-rs/aya/commit/a4a69a6bcf)) - Check errors in tests ([`e4537e3`](https://github.com/aya-rs/aya/commit/e4537e389a)) - Aya-log, aya-log-common: Remove duplicate struct ([`490d7d5`](https://github.com/aya-rs/aya/commit/490d7d587a)) - Merge pull request #591 from vadorovsky/aya-log-impl-pod ([`3d3ce8b`](https://github.com/aya-rs/aya/commit/3d3ce8bfa2)) - Move the `Pod` implementations from aya-log-common to aya-log ([`5603d72`](https://github.com/aya-rs/aya/commit/5603d7248a)) - Merge pull request #484 from vadorovsky/update-tokio ([`bea0e83`](https://github.com/aya-rs/aya/commit/bea0e83512)) - Update Tokio and inventory ([`dad75f4`](https://github.com/aya-rs/aya/commit/dad75f45ac)) - Don't panic in init when bpf programs don't log ([`12927cf`](https://github.com/aya-rs/aya/commit/12927cf699)) - Merge pull request #456 from dmitris/uninlined_format_args ([`16b029e`](https://github.com/aya-rs/aya/commit/16b029ed37)) - Fix uninlined_format_args clippy issues ([`055d94f`](https://github.com/aya-rs/aya/commit/055d94f58b)) - Merge pull request #449 from aya-rs/dependabot/cargo/env_logger-0.10 ([`f9bef9f`](https://github.com/aya-rs/aya/commit/f9bef9f8c0)) - Update env_logger requirement from 0.9 to 0.10 ([`1c8088b`](https://github.com/aya-rs/aya/commit/1c8088b16c)) - Revert "aya-log, aya-log-common: temporarily revert to old map API so we can release" ([`0b41018`](https://github.com/aya-rs/aya/commit/0b41018ee2))

      v0.1.13 (2022-11-16)

      Other

      • release version 0.1.13
      • Add format hints for MAC addresses Add {:mac} (for lower-case hex representation) and {:MAC} (for upper-case hex representation) format hints for the [u8; 6] type, which is the standard one in Linux to store physical addresses in.

      Tested with: https://github.com/vadorovsky/aya-examples/tree/main/xdp-mac

      • Make miri happy Miri took issue about using slice::from_raw_parts without checking for alignment. Instead, we can simply convert to a [u8;16] into a [u16;8] by iterating in chunks of 2 and bitshifting (remembering that these arrays are in network-endian order).
      • Add display hints This change adds optional display hints:

        • {:x}, {:X} - for hex representation of numbers
        • {:ipv4}, {:IPv4} - for IPv4 addresses
        • {:ipv6}, {:IPv6} - for IPv6 addresses

      It also gets rid of dyn-fmt and instead comes with our own parser implementation.

      Tested on: https://github.com/vadorovsky/aya-examples/tree/main/tc

      • Fix links to aya-log repo The aya-log repo ([0]) has been archived, use the link to aya repo instead.
      • Remove i128 and u128 types They are not supported by eBPF VM and we are going to use arrays for IPv6.
      • use new PerCpuArray::get_ptr_mut API
      • Add example This ensures that macro expansion works properly and that expanded code compiles
      • Ensure the bounds of log buffer eBPF verifier rejects programs which are not checking the bounds of the log buffer before writing any arguments. This change ensures that written log arguments.

      In practice, it means that doing this kind of checks is not going to be needed in eBPF program code anymore:

      • Bump the buffer size 1024 is too small for many kernel string limits (i.e. PATH_MAX, which is 4096).
      • do not release
      • use stricter version for the aya-log-common dep
      • inline write_record_header This seems to help the verifier keep track of where we're writing into LOG_BUF
      • initialize AYA_LOGS with max_entries=0 This way aya will create one perf buffer for each cpu

      Commit Statistics

      • 59 commits contributed to the release.
      • 14 commits were understood as conventional.
      • 0 issues like '(#ID)' were seen in commit messages

      Commit Details

      view details * **Uncategorized** - Release version 0.1.13 ([`832bdd2`](https://github.com/aya-rs/aya/commit/832bdd280c)) - Aya-log, aya-log-common: temporarily revert to old map API so we can release ([`0d040d2`](https://github.com/aya-rs/aya/commit/0d040d2290)) - Merge pull request #436 from vadorovsky/aya-log-mac-addr ([`3adb9b0`](https://github.com/aya-rs/aya/commit/3adb9b049f)) - Add format hints for MAC addresses ([`2223ab8`](https://github.com/aya-rs/aya/commit/2223ab828d)) - Merge pull request #397 from astoycos/refactor-map-api2 ([`d6cb1a1`](https://github.com/aya-rs/aya/commit/d6cb1a16ad)) - Make map APIs return an option ([`f3262e8`](https://github.com/aya-rs/aya/commit/f3262e87bd)) - Core refactor of Map API ([`1aefa2e`](https://github.com/aya-rs/aya/commit/1aefa2e5e6)) - Merge pull request #390 from dave-tucker/clippy-up ([`367ab20`](https://github.com/aya-rs/aya/commit/367ab20305)) - Make miri happy ([`b2924a3`](https://github.com/aya-rs/aya/commit/b2924a3a26)) - Aya-log, aya-log-common: start next development iteration 0.1.12-dev.0 ([`6f0637a`](https://github.com/aya-rs/aya/commit/6f0637a6c8)) - Aya-log, aya-log-common: release version 0.1.11 ([`ba927ac`](https://github.com/aya-rs/aya/commit/ba927ac204)) - Add display hints ([`83ec27f`](https://github.com/aya-rs/aya/commit/83ec27f06b)) - Change from Rust edition 2018 to 2021 ([`944d6b8`](https://github.com/aya-rs/aya/commit/944d6b8a16)) - Merge pull request #361 from chenhengqi/fix-aya-log-links ([`632ea30`](https://github.com/aya-rs/aya/commit/632ea300ed)) - Fix links to aya-log repo ([`b8b291c`](https://github.com/aya-rs/aya/commit/b8b291c51b)) - Merge pull request #357 from vadorovsky/env_logger ([`3d5ab0b`](https://github.com/aya-rs/aya/commit/3d5ab0b17d)) - Aya-log, test: Switch from simplelog to env_logger ([`3664e1e`](https://github.com/aya-rs/aya/commit/3664e1ea0d)) - Merge pull request #353 from vadorovsky/log-remove-u128 ([`d968094`](https://github.com/aya-rs/aya/commit/d968094b66)) - Remove i128 and u128 types ([`611f967`](https://github.com/aya-rs/aya/commit/611f967cd1)) - Merge pull request #350 from dave-tucker/monorepo ([`f37a514`](https://github.com/aya-rs/aya/commit/f37a51433f)) - Re-organize into a single workspace ([`dc31e11`](https://github.com/aya-rs/aya/commit/dc31e11691)) - Fix the log buffer bounds ([`28abaec`](https://github.com/aya-rs/aya/commit/28abaece2a)) - Ensure log buffer bounds ([`2e07028`](https://github.com/aya-rs/aya/commit/2e0702854b)) - Use new PerCpuArray::get_ptr_mut API ([`6aea880`](https://github.com/aya-rs/aya/commit/6aea880890)) - Aya-log, aya-log-common: start next development iteration 0.1.11-dev.0 ([`526493b`](https://github.com/aya-rs/aya/commit/526493b444)) - Aya-log, aya-log-common: release version 0.1.10 ([`3abd973`](https://github.com/aya-rs/aya/commit/3abd97307e)) - Update aya requirement from 0.10.7 to 0.11.0 ([`060ba45`](https://github.com/aya-rs/aya/commit/060ba45153)) - Add CI ([`0038b43`](https://github.com/aya-rs/aya/commit/0038b43627)) - Add vim/vscode rust-analyzer settings ([`c1bb790`](https://github.com/aya-rs/aya/commit/c1bb790c0d)) - Add rustfmt.toml ([`3f00851`](https://github.com/aya-rs/aya/commit/3f0085195f)) - Add example ([`5789585`](https://github.com/aya-rs/aya/commit/5789585994)) - Add Tests ([`5d82d9a`](https://github.com/aya-rs/aya/commit/5d82d9a73e)) - Ensure the bounds of log buffer ([`628b473`](https://github.com/aya-rs/aya/commit/628b473e09)) - Bump the buffer size ([`70b4e68`](https://github.com/aya-rs/aya/commit/70b4e68130)) - Aya-log, aya-log-common: start next development iteration 0.1.10-dev.0 ([`bd9a5c8`](https://github.com/aya-rs/aya/commit/bd9a5c8fdf)) - Aya-log, aya-log-common: release version 0.1.9 ([`8bc1bbb`](https://github.com/aya-rs/aya/commit/8bc1bbb3ab)) - Add cargo-release config ([`a8d133f`](https://github.com/aya-rs/aya/commit/a8d133f6b0)) - Do not release ([`d1a0ce5`](https://github.com/aya-rs/aya/commit/d1a0ce51ee)) - Use stricter version for the aya-log-common dep ([`c4d89fa`](https://github.com/aya-rs/aya/commit/c4d89fa13c)) - Inline write_record_header ([`bdb2750`](https://github.com/aya-rs/aya/commit/bdb2750e66)) - Update aya to 0.10.7 ([`81befa0`](https://github.com/aya-rs/aya/commit/81befa0661)) - Format arguments in userspace ([`ca1fe7e`](https://github.com/aya-rs/aya/commit/ca1fe7e05f)) - Don't recompute the record length ([`9b229d0`](https://github.com/aya-rs/aya/commit/9b229d00e1)) - Initialize AYA_LOGS with max_entries=0 ([`7f8d705`](https://github.com/aya-rs/aya/commit/7f8d7057df)) - Fix clippy warning ([`2800454`](https://github.com/aya-rs/aya/commit/2800454763)) - Add copy of README.md inside aya-log/ ([`8bde15d`](https://github.com/aya-rs/aya/commit/8bde15dad7)) - Add missing manifest fields ([`5e18a71`](https://github.com/aya-rs/aya/commit/5e18a715b2)) - (cargo-release) version 0.1.1 ([`31e71f8`](https://github.com/aya-rs/aya/commit/31e71f8db5)) - (cargo-release) version 0.1.1 ([`29955b2`](https://github.com/aya-rs/aya/commit/29955b2287)) - Git add .cargo and xtask ([`6d14a16`](https://github.com/aya-rs/aya/commit/6d14a16d8e)) - Update to aya 0.10.5 ([`cced3da`](https://github.com/aya-rs/aya/commit/cced3da5c8)) - Simplify BpfLogger::init ([`9ab9c80`](https://github.com/aya-rs/aya/commit/9ab9c80183)) - Minor tweaks to make the verifier's job easier ([`2ac4334`](https://github.com/aya-rs/aya/commit/2ac433449c)) - Switch to aya-ufmt ([`b14d4ba`](https://github.com/aya-rs/aya/commit/b14d4bab2f)) - Use aya_bpf::maps::PerfEventByteArray to output logs ([`22d8f86`](https://github.com/aya-rs/aya/commit/22d8f86fbb)) - Use aya_log_ebpf::ufmt instead of ::ufmt ([`741957f`](https://github.com/aya-rs/aya/commit/741957f945)) - Add ufmt to readme ([`0d7ac3e`](https://github.com/aya-rs/aya/commit/0d7ac3eb3e)) - Update readme ([`5df853c`](https://github.com/aya-rs/aya/commit/5df853cfb0)) - Initial commit ([`b29a061`](https://github.com/aya-rs/aya/commit/b29a061bce))