From 3a3c45100942c903c21e69595eff9e4289910835 Mon Sep 17 00:00:00 2001 From: Alessandro Decina Date: Wed, 29 Oct 2025 19:09:38 +1100 Subject: [PATCH 01/46] aya: restore must_exist argument to set_global In https://github.com/aya-rs/aya/commit/03e84871773e09badf08bdef8e83b4f1256850a4 we deprecated set_global but accidentally broke its API by deleting the must_exist argument. --- aya/src/bpf.rs | 9 +++++++-- xtask/public-api/aya.txt | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/aya/src/bpf.rs b/aya/src/bpf.rs index 6280d070..609ae553 100644 --- a/aya/src/bpf.rs +++ b/aya/src/bpf.rs @@ -293,8 +293,13 @@ impl<'a> EbpfLoader<'a> { /// Override the value of a global variable. #[deprecated(since = "0.13.2", note = "please use `override_global` instead")] - pub fn set_global>>(&mut self, name: &'a str, value: T) -> &mut Self { - self.override_global(name, value, false) + pub fn set_global>>( + &mut self, + name: &'a str, + value: T, + must_exist: bool, + ) -> &mut Self { + self.override_global(name, value, must_exist) } /// Set the max_entries for specified map. diff --git a/xtask/public-api/aya.txt b/xtask/public-api/aya.txt index 60309344..bc861f4c 100644 --- a/xtask/public-api/aya.txt +++ b/xtask/public-api/aya.txt @@ -10750,7 +10750,7 @@ pub fn aya::EbpfLoader<'a>::map_max_entries(&mut self, name: &'a str, size: u32) pub fn aya::EbpfLoader<'a>::map_pin_path>>(&mut self, name: &'a str, path: P) -> &mut Self pub fn aya::EbpfLoader<'a>::new() -> Self pub fn aya::EbpfLoader<'a>::override_global>>(&mut self, name: &'a str, value: T, must_exist: bool) -> &mut Self -pub fn aya::EbpfLoader<'a>::set_global>>(&mut self, name: &'a str, value: T) -> &mut Self +pub fn aya::EbpfLoader<'a>::set_global>>(&mut self, name: &'a str, value: T, must_exist: bool) -> &mut Self pub fn aya::EbpfLoader<'a>::set_max_entries(&mut self, name: &'a str, size: u32) -> &mut Self pub fn aya::EbpfLoader<'a>::verifier_log_level(&mut self, level: aya::VerifierLogLevel) -> &mut Self impl core::default::Default for aya::EbpfLoader<'_> From 4dc4a6ce08582b8d23de2bd28d638a83d62e4103 Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Wed, 29 Oct 2025 08:30:59 -0400 Subject: [PATCH 02/46] .github: exercise targets for real --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ee1040f7..3b1d2c9a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -178,9 +178,8 @@ jobs: for target in bpfeb-unknown-none bpfel-unknown-none; do echo "::group::Build and test for $arch / $target" if ! ( - export CARGO_CFG_BPF_TARGET_ARCH="$arch" - cargo +nightly hack build \ + RUSTFLAGS="--cfg bpf_target_arch=\"$arch\"" cargo +nightly hack build \ --target "$target" \ -Z build-std=core \ --package aya-ebpf \ From e2c50ac221cf80f33c7e08c65692bb939c396a9e Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Wed, 29 Oct 2025 07:57:29 -0400 Subject: [PATCH 03/46] aya-build: use OsString::into_string --- aya-build/src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/aya-build/src/lib.rs b/aya-build/src/lib.rs index b2f7c679..4243f3a5 100644 --- a/aya-build/src/lib.rs +++ b/aya-build/src/lib.rs @@ -19,9 +19,9 @@ pub struct Package<'a> { fn target_arch() -> Cow<'static, str> { const TARGET_ARCH: &str = "CARGO_CFG_TARGET_ARCH"; let target_arch = env::var_os(TARGET_ARCH).unwrap_or_else(|| panic!("{TARGET_ARCH} not set")); - let target_arch = target_arch.into_encoded_bytes(); - let target_arch = String::from_utf8(target_arch) - .unwrap_or_else(|err| panic!("String::from_utf8({TARGET_ARCH}): {err:?}")); + let target_arch = target_arch + .into_string() + .unwrap_or_else(|err| panic!("OsString::into_string({TARGET_ARCH}): {err:?}")); if target_arch.starts_with("riscv64") { "riscv64".into() } else { From 0c7c8097b20b11a89238b2102af47efbf95f7a4d Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Wed, 29 Oct 2025 08:05:06 -0400 Subject: [PATCH 04/46] aya-build: clarify naming --- aya-build/src/lib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/aya-build/src/lib.rs b/aya-build/src/lib.rs index 4243f3a5..bc1a01e0 100644 --- a/aya-build/src/lib.rs +++ b/aya-build/src/lib.rs @@ -58,7 +58,7 @@ pub fn build_ebpf<'a>( return Err(anyhow!("unsupported endian={endian:?}")); }; - let arch = target_arch(); + let bpf_target_arch = target_arch(); let target = format!("{target}-unknown-none"); for Package { name, root_dir } in packages { @@ -92,7 +92,7 @@ pub fn build_ebpf<'a>( for s in [ "--cfg=bpf_target_arch=\"", - &arch, + &bpf_target_arch, "\"", SEPARATOR, "-Cdebuginfo=2", @@ -210,8 +210,8 @@ pub fn emit_bpf_target_arch_cfg() { .to_str() .unwrap_or_else(|| panic!("{RUSTFLAGS}={rustc_cfgs:?} not unicode")); if !rustc_cfgs.contains("bpf_target_arch") { - let arch = target_arch(); - println!("cargo:rustc-cfg=bpf_target_arch=\"{arch}\""); + let bpf_target_arch = target_arch(); + println!("cargo:rustc-cfg=bpf_target_arch=\"{bpf_target_arch}\""); } print!("cargo::rustc-check-cfg=cfg(bpf_target_arch, values("); From 4b0ddfc2b0f671d43fbcdeb78c9e46b099404f53 Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Wed, 29 Oct 2025 07:44:57 -0400 Subject: [PATCH 05/46] aya-build: simplify Cargo sets `CARGO_CFG_BPF_TARGET_ARCH` so we don't have to inspect `CARGO_ENCODED_RUSTFLAGS`. --- aya-build/src/lib.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/aya-build/src/lib.rs b/aya-build/src/lib.rs index bc1a01e0..0013d042 100644 --- a/aya-build/src/lib.rs +++ b/aya-build/src/lib.rs @@ -202,14 +202,13 @@ impl<'a> Toolchain<'a> { /// Emit cfg flags that describe the desired BPF target architecture. pub fn emit_bpf_target_arch_cfg() { - const RUSTFLAGS: &str = "CARGO_ENCODED_RUSTFLAGS"; - - println!("cargo:rerun-if-env-changed={RUSTFLAGS}"); - let rustc_cfgs = std::env::var_os(RUSTFLAGS).unwrap_or_else(|| panic!("{RUSTFLAGS} not set")); - let rustc_cfgs = rustc_cfgs - .to_str() - .unwrap_or_else(|| panic!("{RUSTFLAGS}={rustc_cfgs:?} not unicode")); - if !rustc_cfgs.contains("bpf_target_arch") { + // The presence of this environment variable indicates that `--cfg + // bpf_target_arch="..."` was passed to the compiler, so we don't need to + // emit it again. Note that we cannot *set* this environment variable - it + // is set by cargo. + const BPF_TARGET_ARCH: &str = "CARGO_CFG_BPF_TARGET_ARCH"; + println!("cargo:rerun-if-env-changed={BPF_TARGET_ARCH}"); + if std::env::var_os(BPF_TARGET_ARCH).is_none() { let bpf_target_arch = target_arch(); println!("cargo:rustc-cfg=bpf_target_arch=\"{bpf_target_arch}\""); } From fe3f5c4e7dfddd1d4e6496ceadb1752b8522495c Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Wed, 29 Oct 2025 07:48:11 -0400 Subject: [PATCH 06/46] aya-build: read AYA_BPF_TARGET_ARCH This allows users to set `bpf_target_arch` from the environment without touching RUSTFLAGS. --- aya-build/src/lib.rs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/aya-build/src/lib.rs b/aya-build/src/lib.rs index 0013d042..ae7b2555 100644 --- a/aya-build/src/lib.rs +++ b/aya-build/src/lib.rs @@ -208,8 +208,25 @@ pub fn emit_bpf_target_arch_cfg() { // is set by cargo. const BPF_TARGET_ARCH: &str = "CARGO_CFG_BPF_TARGET_ARCH"; println!("cargo:rerun-if-env-changed={BPF_TARGET_ARCH}"); + + // Users may directly set this environment variable in situations where + // using RUSTFLAGS to set `--cfg bpf_target_arch="..."` is not possible or + // not ergonomic. In contrast to RUSTFLAGS this mechanism reuses the target + // cache for all values, producing many more invalidations. + const AYA_BPF_TARGET_ARCH: &str = "AYA_BPF_TARGET_ARCH"; + println!("cargo:rerun-if-env-changed={AYA_BPF_TARGET_ARCH}"); + if std::env::var_os(BPF_TARGET_ARCH).is_none() { - let bpf_target_arch = target_arch(); + let bpf_target_arch = if let Some(bpf_target_arch) = std::env::var_os(AYA_BPF_TARGET_ARCH) { + bpf_target_arch + .into_string() + .unwrap_or_else(|err| { + panic!("OsString::into_string({AYA_BPF_TARGET_ARCH}): {err:?}") + }) + .into() + } else { + target_arch() + }; println!("cargo:rustc-cfg=bpf_target_arch=\"{bpf_target_arch}\""); } From 948b8553ee72ab72d91c9a16e7e937a75eb0e155 Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Wed, 29 Oct 2025 08:18:57 -0400 Subject: [PATCH 07/46] aya-build: guess `bpf_target_arch` from `HOST` Remove the use of `CARGO_CFG_TARGET_ARCH` in ebpf crate build scripts, moving it back only to `aya_build::build_ebpf` where it refers to the userspace crate's target. In the ebpf crates restore the use of `HOST` as the default compilation target when neither `--cfg bpf_target_arch` nor `AYA_BPF_TARGET_ARCH` are provided. --- aya-build/src/lib.rs | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/aya-build/src/lib.rs b/aya-build/src/lib.rs index ae7b2555..7820a781 100644 --- a/aya-build/src/lib.rs +++ b/aya-build/src/lib.rs @@ -16,16 +16,11 @@ pub struct Package<'a> { pub root_dir: &'a str, } -fn target_arch() -> Cow<'static, str> { - const TARGET_ARCH: &str = "CARGO_CFG_TARGET_ARCH"; - let target_arch = env::var_os(TARGET_ARCH).unwrap_or_else(|| panic!("{TARGET_ARCH} not set")); - let target_arch = target_arch - .into_string() - .unwrap_or_else(|err| panic!("OsString::into_string({TARGET_ARCH}): {err:?}")); +fn target_arch_fixup(target_arch: Cow<'_, str>) -> Cow<'_, str> { if target_arch.starts_with("riscv64") { "riscv64".into() } else { - target_arch.into() + target_arch } } @@ -58,7 +53,13 @@ pub fn build_ebpf<'a>( return Err(anyhow!("unsupported endian={endian:?}")); }; - let bpf_target_arch = target_arch(); + const TARGET_ARCH: &str = "CARGO_CFG_TARGET_ARCH"; + let bpf_target_arch = + env::var_os(TARGET_ARCH).unwrap_or_else(|| panic!("{TARGET_ARCH} not set")); + let bpf_target_arch = bpf_target_arch + .into_string() + .unwrap_or_else(|err| panic!("OsString::into_string({TARGET_ARCH}): {err:?}")); + let bpf_target_arch = target_arch_fixup(bpf_target_arch.into()); let target = format!("{target}-unknown-none"); for Package { name, root_dir } in packages { @@ -216,7 +217,16 @@ pub fn emit_bpf_target_arch_cfg() { const AYA_BPF_TARGET_ARCH: &str = "AYA_BPF_TARGET_ARCH"; println!("cargo:rerun-if-env-changed={AYA_BPF_TARGET_ARCH}"); + const HOST: &str = "HOST"; + println!("cargo:rerun-if-env-changed={HOST}"); + if std::env::var_os(BPF_TARGET_ARCH).is_none() { + let host = std::env::var_os(HOST).unwrap_or_else(|| panic!("{HOST} not set")); + let host = host + .into_string() + .unwrap_or_else(|err| panic!("OsString::into_string({HOST}): {err:?}")); + let host = host.as_str(); + let bpf_target_arch = if let Some(bpf_target_arch) = std::env::var_os(AYA_BPF_TARGET_ARCH) { bpf_target_arch .into_string() @@ -225,7 +235,11 @@ pub fn emit_bpf_target_arch_cfg() { }) .into() } else { - target_arch() + target_arch_fixup( + host.split_once('-') + .map_or(host, |(arch, _rest)| arch) + .into(), + ) }; println!("cargo:rustc-cfg=bpf_target_arch=\"{bpf_target_arch}\""); } From 17573e0e47fd53c24097a1f92b3e0ecf66a298d4 Mon Sep 17 00:00:00 2001 From: Tim W Date: Sun, 2 Nov 2025 20:49:17 +0100 Subject: [PATCH 08/46] aya-build: plumb features of ebpf crates This allows callers to select features of the ebpf crate. --- aya-build/src/lib.rs | 15 ++++++++++++++- test/integration-test/build.rs | 1 + xtask/public-api/aya-build.txt | 4 ++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/aya-build/src/lib.rs b/aya-build/src/lib.rs index 7820a781..4caf28a6 100644 --- a/aya-build/src/lib.rs +++ b/aya-build/src/lib.rs @@ -11,9 +11,12 @@ use std::{ use anyhow::{Context as _, Result, anyhow}; use cargo_metadata::{Artifact, CompilerMessage, Message, Target}; +#[derive(Default)] pub struct Package<'a> { pub name: &'a str, pub root_dir: &'a str, + pub no_default_features: bool, + pub features: &'a [&'a str], } fn target_arch_fixup(target_arch: Cow<'_, str>) -> Cow<'_, str> { @@ -62,7 +65,13 @@ pub fn build_ebpf<'a>( let bpf_target_arch = target_arch_fixup(bpf_target_arch.into()); let target = format!("{target}-unknown-none"); - for Package { name, root_dir } in packages { + for Package { + name, + root_dir, + no_default_features, + features, + } in packages + { // We have a build-dependency on `name`, so cargo will automatically rebuild us if `name`'s // *library* target or any of its dependencies change. Since we depend on `name`'s *binary* // targets, that only gets us half of the way. This stanza ensures cargo will rebuild us on @@ -85,6 +94,10 @@ pub fn build_ebpf<'a>( "--target", &target, ]); + if no_default_features { + cmd.arg("--no-default-features"); + } + cmd.args(["--features", &features.join(",")]); { const SEPARATOR: &str = "\x1f"; diff --git a/test/integration-test/build.rs b/test/integration-test/build.rs index 44a4783a..881cdd57 100644 --- a/test/integration-test/build.rs +++ b/test/integration-test/build.rs @@ -219,6 +219,7 @@ fn main() -> Result<()> { .parent() .ok_or_else(|| anyhow!("no parent for {manifest_path}"))? .as_str(), + ..Default::default() }; aya_build::build_ebpf([integration_ebpf_package], aya_build::Toolchain::default())?; } else { diff --git a/xtask/public-api/aya-build.txt b/xtask/public-api/aya-build.txt index a9fe663c..a5af3847 100644 --- a/xtask/public-api/aya-build.txt +++ b/xtask/public-api/aya-build.txt @@ -27,8 +27,12 @@ pub fn aya_build::Toolchain<'a>::borrow_mut(&mut self) -> &mut T impl core::convert::From for aya_build::Toolchain<'a> pub fn aya_build::Toolchain<'a>::from(t: T) -> T pub struct aya_build::Package<'a> +pub aya_build::Package::features: &'a [&'a str] pub aya_build::Package::name: &'a str +pub aya_build::Package::no_default_features: bool pub aya_build::Package::root_dir: &'a str +impl<'a> core::default::Default for aya_build::Package<'a> +pub fn aya_build::Package<'a>::default() -> aya_build::Package<'a> impl<'a> core::marker::Freeze for aya_build::Package<'a> impl<'a> core::marker::Send for aya_build::Package<'a> impl<'a> core::marker::Sync for aya_build::Package<'a> From 4fbce44b6a49dd189a7a3520c66db45baf3832ea Mon Sep 17 00:00:00 2001 From: swananan Date: Thu, 6 Nov 2025 08:44:59 +0800 Subject: [PATCH 09/46] aya: tolerate proc map trailing newline Proc maps terminate with a newline so split(b'\n') yields an empty slice at the end. Filter it out before parsing so the absolute-path fallback for pid-scoped attach doesn't get short-circuited by a ProcMap::ParseLine error. --- aya/src/programs/uprobe.rs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/aya/src/programs/uprobe.rs b/aya/src/programs/uprobe.rs index 69378b8c..d762f8a8 100644 --- a/aya/src/programs/uprobe.rs +++ b/aya/src/programs/uprobe.rs @@ -208,6 +208,19 @@ fn test_resolve_attach_path() { Some(libc_path) if libc_path.contains("libc"), "libc_path: {}", libc_path.display() ); + + // If we pass an absolute path that doesn't match anything in /proc//maps, we should fall + // back to the provided path instead of erroring out. Using a synthetic absolute path keeps the + // test hermetic. + let synthetic_absolute = Path::new("/tmp/.aya-test-resolve-attach-absolute"); + let absolute_path = + resolve_attach_path(synthetic_absolute, Some(&proc_map)).unwrap_or_else(|err| { + match err.source() { + Some(source) => panic!("{err}: {source}"), + None => panic!("{err}"), + } + }); + assert_eq!(absolute_path, synthetic_absolute); } define_link_wrapper!( @@ -425,6 +438,8 @@ impl> ProcMap { data.as_ref() .split(|&b| b == b'\n') + // /proc//maps ends with '\n', so split() yields a trailing empty slice. + .filter(|line| !line.is_empty()) .map(ProcMapEntry::parse) } @@ -1010,8 +1025,7 @@ mod tests { 7f372288f000-7f3722899000 r--p 00027000 00:24 18097875 /usr/lib64/ld-linux-x86-64.so.2 7f3722899000-7f372289b000 r--p 00030000 00:24 18097875 /usr/lib64/ld-linux-x86-64.so.2 7f372289b000-7f372289d000 rw-p 00032000 00:24 18097875 /usr/lib64/ld-linux-x86-64.so.2 -"# - .trim_ascii(), +"#, }; assert_matches!( From 468b9b73db3c9ea835635cb47dae38de271274fa Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Sun, 9 Nov 2025 07:40:34 -0500 Subject: [PATCH 10/46] xtask: use `-cpu host` on x86 We have started to see errors in CI: qemu-system-x86_64: warning: host doesn't support requested feature: CPUID[eax=80000001h].ECX.svm [bit 2] The internet says this is the remedy. --- xtask/src/run.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xtask/src/run.rs b/xtask/src/run.rs index efa79b54..190d0cab 100644 --- a/xtask/src/run.rs +++ b/xtask/src/run.rs @@ -442,7 +442,7 @@ pub(crate) fn run(opts: Options) -> Result<()> { let (guest_arch, machine, cpu, console) = match guest_arch { "ARM64" => ("aarch64", Some("virt"), Some("max"), "ttyAMA0"), - "x86" => ("x86_64", None, None, "ttyS0"), + "x86" => ("x86_64", None, Some("host"), "ttyS0"), guest_arch => (guest_arch, None, None, "ttyS0"), }; From 866cbe4837f2b3b3d9e9418c3de2a125781f5ab6 Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Sun, 9 Nov 2025 12:23:04 -0500 Subject: [PATCH 11/46] all: bump MSRV to 1.87.0 Use newly stabilized `is_multiple_of`. --- Cargo.toml | 2 +- aya-obj/src/obj.rs | 2 +- aya-obj/src/relocation.rs | 2 +- test/integration-ebpf/src/ring_buf.rs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 73f71433..e4d1111a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -57,7 +57,7 @@ edition = "2024" homepage = "https://aya-rs.dev" license = "MIT OR Apache-2.0" repository = "https://github.com/aya-rs/aya" -rust-version = "1.85.0" +rust-version = "1.87.0" # NOTE(vadorovsky): Neither cargo-udeps nor cargo-machete are able to detect # unused crates defined in this section. It would be nice to teach either of diff --git a/aya-obj/src/obj.rs b/aya-obj/src/obj.rs index b451595a..c3d0d107 100644 --- a/aya-obj/src/obj.rs +++ b/aya-obj/src/obj.rs @@ -1404,7 +1404,7 @@ pub fn parse_map_info(info: bpf_map_info, pinned: PinningType) -> Map { /// Copies a block of eBPF instructions pub fn copy_instructions(data: &[u8]) -> Result, ParseError> { - if data.len() % mem::size_of::() > 0 { + if !data.len().is_multiple_of(mem::size_of::()) { return Err(ParseError::InvalidProgramCode); } let instructions = data diff --git a/aya-obj/src/relocation.rs b/aya-obj/src/relocation.rs index 850eaaa3..d035339b 100644 --- a/aya-obj/src/relocation.rs +++ b/aya-obj/src/relocation.rs @@ -202,7 +202,7 @@ fn relocate_maps<'a, I: Iterator>( // make sure that the relocation offset is properly aligned let ins_offset = rel_offset - section_offset; - if ins_offset % INS_SIZE != 0 { + if !ins_offset.is_multiple_of(INS_SIZE) { return Err(RelocationError::InvalidRelocationOffset { offset: rel.offset, relocation_number: rel_n, diff --git a/test/integration-ebpf/src/ring_buf.rs b/test/integration-ebpf/src/ring_buf.rs index b6f12ac1..cac357f5 100644 --- a/test/integration-ebpf/src/ring_buf.rs +++ b/test/integration-ebpf/src/ring_buf.rs @@ -40,7 +40,7 @@ fn ring_buf_test(ctx: ProbeContext) { Some(arg) => arg, None => return, }; - if arg % 2 == 0 { + if arg.is_multiple_of(2) { entry.write(arg); entry.submit(0); } else { From 7e405c216e0d806f96c76f2554d069722f97bec3 Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Sat, 8 Nov 2025 07:21:00 -0500 Subject: [PATCH 12/46] perf_event: simplify PerfEventScope --- aya/src/programs/perf_event.rs | 31 +++++++++++-------------------- xtask/public-api/aya.txt | 26 ++++++++++---------------- 2 files changed, 21 insertions(+), 36 deletions(-) diff --git a/aya/src/programs/perf_event.rs b/aya/src/programs/perf_event.rs index 93d3dfe1..3ade1973 100644 --- a/aya/src/programs/perf_event.rs +++ b/aya/src/programs/perf_event.rs @@ -294,24 +294,17 @@ pub enum SamplePolicy { /// The scope of a PerfEvent #[derive(Debug, Clone)] pub enum PerfEventScope { - /// Calling process, any cpu - CallingProcessAnyCpu, - /// calling process, one cpu - CallingProcessOneCpu { - /// cpu id - cpu: u32, - }, - /// one process, any cpu - OneProcessAnyCpu { - /// process id - pid: u32, + /// calling process + CallingProcess { + /// cpu id or any cpu if None + cpu: Option, }, - /// one process, one cpu - OneProcessOneCpu { - /// cpu id - cpu: u32, + /// one process + OneProcess { /// process id - pid: u32, + pid: i32, + /// cpu id or any cpu if None + cpu: Option, }, /// all processes, one cpu AllProcessesOneCpu { @@ -427,10 +420,8 @@ impl PerfEvent { SamplePolicy::Frequency(frequency) => (0, Some(frequency)), }; let (pid, cpu) = match scope { - PerfEventScope::CallingProcessAnyCpu => (0, -1), - PerfEventScope::CallingProcessOneCpu { cpu } => (0, cpu as i32), - PerfEventScope::OneProcessAnyCpu { pid } => (pid as i32, -1), - PerfEventScope::OneProcessOneCpu { cpu, pid } => (pid as i32, cpu as i32), + PerfEventScope::CallingProcess { cpu } => (0, cpu.map_or(-1, |cpu| cpu as i32)), + PerfEventScope::OneProcess { pid, cpu } => (pid, cpu.map_or(-1, |cpu| cpu as i32)), PerfEventScope::AllProcessesOneCpu { cpu } => (-1, cpu as i32), }; let fd = perf_event_open( diff --git a/xtask/public-api/aya.txt b/xtask/public-api/aya.txt index bc861f4c..f398a0bc 100644 --- a/xtask/public-api/aya.txt +++ b/xtask/public-api/aya.txt @@ -5508,14 +5508,11 @@ pub fn aya::programs::perf_event::PerfEventConfig::from(t: T) -> T pub enum aya::programs::perf_event::PerfEventScope pub aya::programs::perf_event::PerfEventScope::AllProcessesOneCpu pub aya::programs::perf_event::PerfEventScope::AllProcessesOneCpu::cpu: u32 -pub aya::programs::perf_event::PerfEventScope::CallingProcessAnyCpu -pub aya::programs::perf_event::PerfEventScope::CallingProcessOneCpu -pub aya::programs::perf_event::PerfEventScope::CallingProcessOneCpu::cpu: u32 -pub aya::programs::perf_event::PerfEventScope::OneProcessAnyCpu -pub aya::programs::perf_event::PerfEventScope::OneProcessAnyCpu::pid: u32 -pub aya::programs::perf_event::PerfEventScope::OneProcessOneCpu -pub aya::programs::perf_event::PerfEventScope::OneProcessOneCpu::cpu: u32 -pub aya::programs::perf_event::PerfEventScope::OneProcessOneCpu::pid: u32 +pub aya::programs::perf_event::PerfEventScope::CallingProcess +pub aya::programs::perf_event::PerfEventScope::CallingProcess::cpu: core::option::Option +pub aya::programs::perf_event::PerfEventScope::OneProcess +pub aya::programs::perf_event::PerfEventScope::OneProcess::cpu: core::option::Option +pub aya::programs::perf_event::PerfEventScope::OneProcess::pid: i32 impl core::clone::Clone for aya::programs::perf_event::PerfEventScope pub fn aya::programs::perf_event::PerfEventScope::clone(&self) -> aya::programs::perf_event::PerfEventScope impl core::fmt::Debug for aya::programs::perf_event::PerfEventScope @@ -7946,14 +7943,11 @@ pub fn aya::programs::LsmAttachType::from(t: T) -> T pub enum aya::programs::PerfEventScope pub aya::programs::PerfEventScope::AllProcessesOneCpu pub aya::programs::PerfEventScope::AllProcessesOneCpu::cpu: u32 -pub aya::programs::PerfEventScope::CallingProcessAnyCpu -pub aya::programs::PerfEventScope::CallingProcessOneCpu -pub aya::programs::PerfEventScope::CallingProcessOneCpu::cpu: u32 -pub aya::programs::PerfEventScope::OneProcessAnyCpu -pub aya::programs::PerfEventScope::OneProcessAnyCpu::pid: u32 -pub aya::programs::PerfEventScope::OneProcessOneCpu -pub aya::programs::PerfEventScope::OneProcessOneCpu::cpu: u32 -pub aya::programs::PerfEventScope::OneProcessOneCpu::pid: u32 +pub aya::programs::PerfEventScope::CallingProcess +pub aya::programs::PerfEventScope::CallingProcess::cpu: core::option::Option +pub aya::programs::PerfEventScope::OneProcess +pub aya::programs::PerfEventScope::OneProcess::cpu: core::option::Option +pub aya::programs::PerfEventScope::OneProcess::pid: i32 impl core::clone::Clone for aya::programs::perf_event::PerfEventScope pub fn aya::programs::perf_event::PerfEventScope::clone(&self) -> aya::programs::perf_event::PerfEventScope impl core::fmt::Debug for aya::programs::perf_event::PerfEventScope From 18c7f7ccd6d462516d94b8720d18f8b7b5d98361 Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Fri, 7 Nov 2025 07:18:31 -0500 Subject: [PATCH 13/46] perf_event: push down type safety This makes it more difficult to mishandle callers of `perf_event_open`. Change `wakeup_events = 0` to 1; per `man 2 perf_event_open`: Prior to Linux 3.0, setting wakeup_events to 0 resulted in no overflow notifications; more recent kernels treat 0 the same as 1. --- aya/src/programs/mod.rs | 2 +- aya/src/programs/perf_event.rs | 82 +++++++++---------------------- aya/src/sys/perf_event.rs | 90 +++++++++++++++++++++++++--------- xtask/public-api/aya.txt | 81 ++---------------------------- 4 files changed, 96 insertions(+), 159 deletions(-) diff --git a/aya/src/programs/mod.rs b/aya/src/programs/mod.rs index 2a9c0fda..3255381f 100644 --- a/aya/src/programs/mod.rs +++ b/aya/src/programs/mod.rs @@ -111,7 +111,7 @@ pub use crate::programs::{ lirc_mode2::LircMode2, lsm::Lsm, lsm_cgroup::LsmCgroup, - perf_event::{PerfEvent, PerfEventScope, SamplePolicy}, + perf_event::PerfEvent, probe::ProbeKind, raw_trace_point::RawTracePoint, sk_lookup::SkLookup, diff --git a/aya/src/programs/perf_event.rs b/aya/src/programs/perf_event.rs index 3ade1973..0b52bd04 100644 --- a/aya/src/programs/perf_event.rs +++ b/aya/src/programs/perf_event.rs @@ -3,14 +3,8 @@ use std::os::fd::AsFd as _; use aya_obj::generated::{ - bpf_link_type, - bpf_prog_type::BPF_PROG_TYPE_PERF_EVENT, - perf_hw_cache_id, perf_hw_cache_op_id, perf_hw_cache_op_result_id, perf_hw_id, perf_sw_ids, - perf_type_id, - perf_type_id::{ - PERF_TYPE_BREAKPOINT, PERF_TYPE_HARDWARE, PERF_TYPE_HW_CACHE, PERF_TYPE_RAW, - PERF_TYPE_SOFTWARE, PERF_TYPE_TRACEPOINT, - }, + bpf_link_type, bpf_prog_type::BPF_PROG_TYPE_PERF_EVENT, perf_hw_cache_id, perf_hw_cache_op_id, + perf_hw_cache_op_result_id, perf_hw_id, perf_sw_ids, perf_type_id, }; use crate::{ @@ -84,7 +78,7 @@ pub enum PerfEventConfig { macro_rules! impl_to_u32 { ($($t:ty, $fn:ident),*) => { - $(const fn $fn(id: $t) -> u32 { + $(pub(crate) const fn $fn(id: $t) -> u32 { const _: [(); 4] = [(); std::mem::size_of::<$t>()]; id as u32 })* @@ -144,7 +138,7 @@ pub enum HardwareEvent { } impl HardwareEvent { - const fn into_primitive(self) -> u32 { + pub(crate) const fn into_primitive(self) -> u32 { const _: [(); 4] = [(); std::mem::size_of::()]; self as u32 } @@ -194,7 +188,7 @@ pub enum SoftwareEvent { } impl SoftwareEvent { - const fn into_primitive(self) -> u32 { + pub(crate) const fn into_primitive(self) -> u32 { const _: [(); 4] = [(); std::mem::size_of::()]; self as u32 } @@ -229,7 +223,7 @@ pub enum HwCacheEvent { } impl HwCacheEvent { - const fn into_primitive(self) -> u32 { + pub(crate) const fn into_primitive(self) -> u32 { const _: [(); 4] = [(); std::mem::size_of::()]; self as u32 } @@ -252,7 +246,7 @@ pub enum HwCacheOp { } impl HwCacheOp { - const fn into_primitive(self) -> u32 { + pub(crate) const fn into_primitive(self) -> u32 { const _: [(); 4] = [(); std::mem::size_of::()]; self as u32 } @@ -276,14 +270,14 @@ pub enum HwCacheResult { } impl HwCacheResult { - const fn into_primitive(self) -> u32 { + pub(crate) const fn into_primitive(self) -> u32 { const _: [(); 4] = [(); std::mem::size_of::()]; self as u32 } } /// Sample Policy -#[derive(Debug, Clone)] +#[derive(Debug, Clone, Copy)] pub enum SamplePolicy { /// Period Period(u64), @@ -291,8 +285,18 @@ pub enum SamplePolicy { Frequency(u64), } +/// Wakeup Policy +#[derive(Debug, Clone, Copy)] +pub(crate) enum WakeupPolicy { + /// Every N events + Events(u32), + /// Every N bytes + #[expect(dead_code)] + Watermark(u32), +} + /// The scope of a PerfEvent -#[derive(Debug, Clone)] +#[derive(Debug, Clone, Copy)] pub enum PerfEventScope { /// calling process CallingProcess { @@ -381,7 +385,7 @@ impl PerfEvent { /// The returned value can be used to detach, see [PerfEvent::detach]. pub fn attach( &mut self, - perf_type: PerfEventConfig, + config: PerfEventConfig, scope: PerfEventScope, sample_policy: SamplePolicy, inherit: bool, @@ -389,49 +393,11 @@ impl PerfEvent { let prog_fd = self.fd()?; let prog_fd = prog_fd.as_fd(); - let (perf_type, config) = match perf_type { - PerfEventConfig::Pmu { pmu_type, config } => (pmu_type, config), - PerfEventConfig::Hardware(hw_event) => ( - perf_type_id_to_u32(PERF_TYPE_HARDWARE), - u64::from(hw_event.into_primitive()), - ), - PerfEventConfig::Software(sw_event) => ( - perf_type_id_to_u32(PERF_TYPE_SOFTWARE), - u64::from(sw_event.into_primitive()), - ), - PerfEventConfig::TracePoint { event_id } => { - (perf_type_id_to_u32(PERF_TYPE_TRACEPOINT), event_id) - } - PerfEventConfig::HwCache { - event, - operation, - result, - } => ( - perf_type_id_to_u32(PERF_TYPE_HW_CACHE), - u64::from(event.into_primitive()) - | (u64::from(operation.into_primitive()) << 8) - | (u64::from(result.into_primitive()) << 16), - ), - PerfEventConfig::Raw { event_id } => (perf_type_id_to_u32(PERF_TYPE_RAW), event_id), - PerfEventConfig::Breakpoint => (perf_type_id_to_u32(PERF_TYPE_BREAKPOINT), 0), - }; - let (sample_period, sample_frequency) = match sample_policy { - SamplePolicy::Period(period) => (period, None), - SamplePolicy::Frequency(frequency) => (0, Some(frequency)), - }; - let (pid, cpu) = match scope { - PerfEventScope::CallingProcess { cpu } => (0, cpu.map_or(-1, |cpu| cpu as i32)), - PerfEventScope::OneProcess { pid, cpu } => (pid, cpu.map_or(-1, |cpu| cpu as i32)), - PerfEventScope::AllProcessesOneCpu { cpu } => (-1, cpu as i32), - }; let fd = perf_event_open( - perf_type, config, - pid, - cpu, - sample_period, - sample_frequency, - false, + scope, + sample_policy, + WakeupPolicy::Events(1), inherit, 0, ) diff --git a/aya/src/sys/perf_event.rs b/aya/src/sys/perf_event.rs index afedefa9..3514ef4e 100644 --- a/aya/src/sys/perf_event.rs +++ b/aya/src/sys/perf_event.rs @@ -7,53 +7,97 @@ use std::{ use aya_obj::generated::{ PERF_FLAG_FD_CLOEXEC, perf_event_attr, perf_event_sample_format::PERF_SAMPLE_RAW, - perf_sw_ids::PERF_COUNT_SW_BPF_OUTPUT, - perf_type_id::{PERF_TYPE_SOFTWARE, PERF_TYPE_TRACEPOINT}, + perf_type_id::{ + PERF_TYPE_BREAKPOINT, PERF_TYPE_HARDWARE, PERF_TYPE_HW_CACHE, PERF_TYPE_RAW, + PERF_TYPE_SOFTWARE, PERF_TYPE_TRACEPOINT, + }, }; use libc::pid_t; use super::{PerfEventIoctlRequest, Syscall, syscall}; +use crate::programs::perf_event::{ + PerfEventConfig, PerfEventScope, SamplePolicy, SoftwareEvent, WakeupPolicy, perf_type_id_to_u32, +}; -#[expect(clippy::too_many_arguments)] pub(crate) fn perf_event_open( - perf_type: u32, - config: u64, - pid: pid_t, - cpu: c_int, - sample_period: u64, - sample_frequency: Option, - wakeup: bool, + config: PerfEventConfig, + scope: PerfEventScope, + sample_policy: SamplePolicy, + wakeup_policy: WakeupPolicy, inherit: bool, flags: u32, ) -> io::Result { let mut attr = unsafe { mem::zeroed::() }; + let (perf_type, config) = match config { + PerfEventConfig::Pmu { pmu_type, config } => (pmu_type, config), + PerfEventConfig::Hardware(hw_event) => ( + perf_type_id_to_u32(PERF_TYPE_HARDWARE), + u64::from(hw_event.into_primitive()), + ), + PerfEventConfig::Software(sw_event) => ( + perf_type_id_to_u32(PERF_TYPE_SOFTWARE), + u64::from(sw_event.into_primitive()), + ), + PerfEventConfig::TracePoint { event_id } => { + (perf_type_id_to_u32(PERF_TYPE_TRACEPOINT), event_id) + } + PerfEventConfig::HwCache { + event, + operation, + result, + } => ( + perf_type_id_to_u32(PERF_TYPE_HW_CACHE), + u64::from(event.into_primitive()) + | (u64::from(operation.into_primitive()) << 8) + | (u64::from(result.into_primitive()) << 16), + ), + PerfEventConfig::Raw { event_id } => (perf_type_id_to_u32(PERF_TYPE_RAW), event_id), + PerfEventConfig::Breakpoint => (perf_type_id_to_u32(PERF_TYPE_BREAKPOINT), 0), + }; + attr.config = config; attr.size = mem::size_of::() as u32; attr.type_ = perf_type; attr.sample_type = PERF_SAMPLE_RAW as u64; attr.set_inherit(if inherit { 1 } else { 0 }); - attr.__bindgen_anon_2.wakeup_events = u32::from(wakeup); - if let Some(frequency) = sample_frequency { - attr.set_freq(1); - attr.__bindgen_anon_1.sample_freq = frequency; - } else { - attr.__bindgen_anon_1.sample_period = sample_period; + match sample_policy { + SamplePolicy::Period(period) => { + attr.__bindgen_anon_1.sample_period = period; + } + SamplePolicy::Frequency(frequency) => { + attr.set_freq(1); + attr.__bindgen_anon_1.sample_freq = frequency; + } } + match wakeup_policy { + WakeupPolicy::Events(events) => { + attr.__bindgen_anon_2.wakeup_events = events; + } + WakeupPolicy::Watermark(watermark) => { + attr.set_watermark(1); + attr.__bindgen_anon_2.wakeup_watermark = watermark; + } + } + + let (pid, cpu) = match scope { + PerfEventScope::CallingProcess { cpu } => (0, cpu.map_or(-1, |cpu| cpu as i32)), + PerfEventScope::OneProcess { pid, cpu } => (pid, cpu.map_or(-1, |cpu| cpu as i32)), + PerfEventScope::AllProcessesOneCpu { cpu } => (-1, cpu as i32), + }; + perf_event_sys(attr, pid, cpu, flags) } pub(crate) fn perf_event_open_bpf(cpu: c_int) -> io::Result { + let cpu = cpu as u32; perf_event_open( - PERF_TYPE_SOFTWARE as u32, - PERF_COUNT_SW_BPF_OUTPUT as u64, - -1, - cpu, - 1, - None, - true, + PerfEventConfig::Software(SoftwareEvent::BpfOutput), + PerfEventScope::AllProcessesOneCpu { cpu }, + SamplePolicy::Period(1), + WakeupPolicy::Events(1), false, PERF_FLAG_FD_CLOEXEC, ) diff --git a/xtask/public-api/aya.txt b/xtask/public-api/aya.txt index f398a0bc..0bd2328f 100644 --- a/xtask/public-api/aya.txt +++ b/xtask/public-api/aya.txt @@ -5517,6 +5517,7 @@ impl core::clone::Clone for aya::programs::perf_event::PerfEventScope pub fn aya::programs::perf_event::PerfEventScope::clone(&self) -> aya::programs::perf_event::PerfEventScope impl core::fmt::Debug for aya::programs::perf_event::PerfEventScope pub fn aya::programs::perf_event::PerfEventScope::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result +impl core::marker::Copy for aya::programs::perf_event::PerfEventScope impl core::marker::Freeze for aya::programs::perf_event::PerfEventScope impl core::marker::Send for aya::programs::perf_event::PerfEventScope impl core::marker::Sync for aya::programs::perf_event::PerfEventScope @@ -5552,6 +5553,7 @@ impl core::clone::Clone for aya::programs::perf_event::SamplePolicy pub fn aya::programs::perf_event::SamplePolicy::clone(&self) -> aya::programs::perf_event::SamplePolicy impl core::fmt::Debug for aya::programs::perf_event::SamplePolicy pub fn aya::programs::perf_event::SamplePolicy::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result +impl core::marker::Copy for aya::programs::perf_event::SamplePolicy impl core::marker::Freeze for aya::programs::perf_event::SamplePolicy impl core::marker::Send for aya::programs::perf_event::SamplePolicy impl core::marker::Sync for aya::programs::perf_event::SamplePolicy @@ -5629,7 +5631,7 @@ pub fn aya::programs::perf_event::SoftwareEvent::from(t: T) -> T pub struct aya::programs::perf_event::PerfEvent impl aya::programs::perf_event::PerfEvent pub const aya::programs::perf_event::PerfEvent::PROGRAM_TYPE: aya::programs::ProgramType -pub fn aya::programs::perf_event::PerfEvent::attach(&mut self, perf_type: aya::programs::perf_event::PerfEventConfig, scope: aya::programs::perf_event::PerfEventScope, sample_policy: aya::programs::perf_event::SamplePolicy, inherit: bool) -> core::result::Result +pub fn aya::programs::perf_event::PerfEvent::attach(&mut self, config: aya::programs::perf_event::PerfEventConfig, scope: aya::programs::perf_event::PerfEventScope, sample_policy: aya::programs::perf_event::SamplePolicy, inherit: bool) -> core::result::Result pub fn aya::programs::perf_event::PerfEvent::load(&mut self) -> core::result::Result<(), aya::programs::ProgramError> impl aya::programs::perf_event::PerfEvent pub fn aya::programs::perf_event::PerfEvent::detach(&mut self, link_id: aya::programs::perf_event::PerfEventLinkId) -> core::result::Result<(), aya::programs::ProgramError> @@ -7940,46 +7942,6 @@ impl core::clone::CloneToUninit for aya::programs::LsmAttachType where T: cor pub unsafe fn aya::programs::LsmAttachType::clone_to_uninit(&self, dest: *mut u8) impl core::convert::From for aya::programs::LsmAttachType pub fn aya::programs::LsmAttachType::from(t: T) -> T -pub enum aya::programs::PerfEventScope -pub aya::programs::PerfEventScope::AllProcessesOneCpu -pub aya::programs::PerfEventScope::AllProcessesOneCpu::cpu: u32 -pub aya::programs::PerfEventScope::CallingProcess -pub aya::programs::PerfEventScope::CallingProcess::cpu: core::option::Option -pub aya::programs::PerfEventScope::OneProcess -pub aya::programs::PerfEventScope::OneProcess::cpu: core::option::Option -pub aya::programs::PerfEventScope::OneProcess::pid: i32 -impl core::clone::Clone for aya::programs::perf_event::PerfEventScope -pub fn aya::programs::perf_event::PerfEventScope::clone(&self) -> aya::programs::perf_event::PerfEventScope -impl core::fmt::Debug for aya::programs::perf_event::PerfEventScope -pub fn aya::programs::perf_event::PerfEventScope::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result -impl core::marker::Freeze for aya::programs::perf_event::PerfEventScope -impl core::marker::Send for aya::programs::perf_event::PerfEventScope -impl core::marker::Sync for aya::programs::perf_event::PerfEventScope -impl core::marker::Unpin for aya::programs::perf_event::PerfEventScope -impl core::panic::unwind_safe::RefUnwindSafe for aya::programs::perf_event::PerfEventScope -impl core::panic::unwind_safe::UnwindSafe for aya::programs::perf_event::PerfEventScope -impl core::convert::Into for aya::programs::perf_event::PerfEventScope where U: core::convert::From -pub fn aya::programs::perf_event::PerfEventScope::into(self) -> U -impl core::convert::TryFrom for aya::programs::perf_event::PerfEventScope where U: core::convert::Into -pub type aya::programs::perf_event::PerfEventScope::Error = core::convert::Infallible -pub fn aya::programs::perf_event::PerfEventScope::try_from(value: U) -> core::result::Result>::Error> -impl core::convert::TryInto for aya::programs::perf_event::PerfEventScope where U: core::convert::TryFrom -pub type aya::programs::perf_event::PerfEventScope::Error = >::Error -pub fn aya::programs::perf_event::PerfEventScope::try_into(self) -> core::result::Result>::Error> -impl alloc::borrow::ToOwned for aya::programs::perf_event::PerfEventScope where T: core::clone::Clone -pub type aya::programs::perf_event::PerfEventScope::Owned = T -pub fn aya::programs::perf_event::PerfEventScope::clone_into(&self, target: &mut T) -pub fn aya::programs::perf_event::PerfEventScope::to_owned(&self) -> T -impl core::any::Any for aya::programs::perf_event::PerfEventScope where T: 'static + ?core::marker::Sized -pub fn aya::programs::perf_event::PerfEventScope::type_id(&self) -> core::any::TypeId -impl core::borrow::Borrow for aya::programs::perf_event::PerfEventScope where T: ?core::marker::Sized -pub fn aya::programs::perf_event::PerfEventScope::borrow(&self) -> &T -impl core::borrow::BorrowMut for aya::programs::perf_event::PerfEventScope where T: ?core::marker::Sized -pub fn aya::programs::perf_event::PerfEventScope::borrow_mut(&mut self) -> &mut T -impl core::clone::CloneToUninit for aya::programs::perf_event::PerfEventScope where T: core::clone::Clone -pub unsafe fn aya::programs::perf_event::PerfEventScope::clone_to_uninit(&self, dest: *mut u8) -impl core::convert::From for aya::programs::perf_event::PerfEventScope -pub fn aya::programs::perf_event::PerfEventScope::from(t: T) -> T pub enum aya::programs::ProbeKind pub aya::programs::ProbeKind::KProbe pub aya::programs::ProbeKind::KRetProbe @@ -8390,41 +8352,6 @@ impl core::clone::CloneToUninit for aya::programs::ProgramType where T: core: pub unsafe fn aya::programs::ProgramType::clone_to_uninit(&self, dest: *mut u8) impl core::convert::From for aya::programs::ProgramType pub fn aya::programs::ProgramType::from(t: T) -> T -pub enum aya::programs::SamplePolicy -pub aya::programs::SamplePolicy::Frequency(u64) -pub aya::programs::SamplePolicy::Period(u64) -impl core::clone::Clone for aya::programs::perf_event::SamplePolicy -pub fn aya::programs::perf_event::SamplePolicy::clone(&self) -> aya::programs::perf_event::SamplePolicy -impl core::fmt::Debug for aya::programs::perf_event::SamplePolicy -pub fn aya::programs::perf_event::SamplePolicy::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result -impl core::marker::Freeze for aya::programs::perf_event::SamplePolicy -impl core::marker::Send for aya::programs::perf_event::SamplePolicy -impl core::marker::Sync for aya::programs::perf_event::SamplePolicy -impl core::marker::Unpin for aya::programs::perf_event::SamplePolicy -impl core::panic::unwind_safe::RefUnwindSafe for aya::programs::perf_event::SamplePolicy -impl core::panic::unwind_safe::UnwindSafe for aya::programs::perf_event::SamplePolicy -impl core::convert::Into for aya::programs::perf_event::SamplePolicy where U: core::convert::From -pub fn aya::programs::perf_event::SamplePolicy::into(self) -> U -impl core::convert::TryFrom for aya::programs::perf_event::SamplePolicy where U: core::convert::Into -pub type aya::programs::perf_event::SamplePolicy::Error = core::convert::Infallible -pub fn aya::programs::perf_event::SamplePolicy::try_from(value: U) -> core::result::Result>::Error> -impl core::convert::TryInto for aya::programs::perf_event::SamplePolicy where U: core::convert::TryFrom -pub type aya::programs::perf_event::SamplePolicy::Error = >::Error -pub fn aya::programs::perf_event::SamplePolicy::try_into(self) -> core::result::Result>::Error> -impl alloc::borrow::ToOwned for aya::programs::perf_event::SamplePolicy where T: core::clone::Clone -pub type aya::programs::perf_event::SamplePolicy::Owned = T -pub fn aya::programs::perf_event::SamplePolicy::clone_into(&self, target: &mut T) -pub fn aya::programs::perf_event::SamplePolicy::to_owned(&self) -> T -impl core::any::Any for aya::programs::perf_event::SamplePolicy where T: 'static + ?core::marker::Sized -pub fn aya::programs::perf_event::SamplePolicy::type_id(&self) -> core::any::TypeId -impl core::borrow::Borrow for aya::programs::perf_event::SamplePolicy where T: ?core::marker::Sized -pub fn aya::programs::perf_event::SamplePolicy::borrow(&self) -> &T -impl core::borrow::BorrowMut for aya::programs::perf_event::SamplePolicy where T: ?core::marker::Sized -pub fn aya::programs::perf_event::SamplePolicy::borrow_mut(&mut self) -> &mut T -impl core::clone::CloneToUninit for aya::programs::perf_event::SamplePolicy where T: core::clone::Clone -pub unsafe fn aya::programs::perf_event::SamplePolicy::clone_to_uninit(&self, dest: *mut u8) -impl core::convert::From for aya::programs::perf_event::SamplePolicy -pub fn aya::programs::perf_event::SamplePolicy::from(t: T) -> T pub enum aya::programs::SkSkbKind pub aya::programs::SkSkbKind::StreamParser pub aya::programs::SkSkbKind::StreamVerdict @@ -9576,7 +9503,7 @@ pub fn aya::programs::lsm_cgroup::LsmCgroup::from(t: T) -> T pub struct aya::programs::PerfEvent impl aya::programs::perf_event::PerfEvent pub const aya::programs::perf_event::PerfEvent::PROGRAM_TYPE: aya::programs::ProgramType -pub fn aya::programs::perf_event::PerfEvent::attach(&mut self, perf_type: aya::programs::perf_event::PerfEventConfig, scope: aya::programs::perf_event::PerfEventScope, sample_policy: aya::programs::perf_event::SamplePolicy, inherit: bool) -> core::result::Result +pub fn aya::programs::perf_event::PerfEvent::attach(&mut self, config: aya::programs::perf_event::PerfEventConfig, scope: aya::programs::perf_event::PerfEventScope, sample_policy: aya::programs::perf_event::SamplePolicy, inherit: bool) -> core::result::Result pub fn aya::programs::perf_event::PerfEvent::load(&mut self) -> core::result::Result<(), aya::programs::ProgramError> impl aya::programs::perf_event::PerfEvent pub fn aya::programs::perf_event::PerfEvent::detach(&mut self, link_id: aya::programs::perf_event::PerfEventLinkId) -> core::result::Result<(), aya::programs::ProgramError> From 112ab47fcdf8ba4765e6f6416cbb7000c96292f8 Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Sun, 9 Nov 2025 10:43:56 -0500 Subject: [PATCH 14/46] Add clippy coverage for doctests --- .github/workflows/ci.yml | 42 ++++++++++++++----------- aya-ebpf-macros/src/lib.rs | 23 +++++++------- aya/src/maps/array/program_array.rs | 6 ++-- aya/src/programs/mod.rs | 5 ++- aya/src/util.rs | 2 ++ clippy.sh | 23 +++++++++++--- ebpf/aya-ebpf/src/helpers.rs | 21 ++++--------- ebpf/aya-ebpf/src/maps/program_array.rs | 5 ++- ebpf/aya-ebpf/src/programs/fentry.rs | 4 +-- ebpf/aya-ebpf/src/programs/fexit.rs | 4 +-- ebpf/aya-ebpf/src/programs/lsm.rs | 1 - ebpf/aya-ebpf/src/programs/probe.rs | 8 +++-- ebpf/aya-ebpf/src/programs/retprobe.rs | 1 - ebpf/aya-ebpf/src/programs/sk_buff.rs | 4 +-- ebpf/aya-ebpf/src/programs/tc.rs | 4 +-- ebpf/aya-ebpf/src/programs/tp_btf.rs | 1 - test/integration-ebpf/src/log.rs | 6 ++-- 17 files changed, 84 insertions(+), 76 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3b1d2c9a..e9b1add4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -119,29 +119,26 @@ jobs: RUST_BACKTRACE: full run: | set -euxo pipefail - cargo hack test --all-targets --feature-powerset \ + cargo hack test --all-targets \ --exclude aya-ebpf \ --exclude aya-ebpf-bindings \ --exclude aya-log-ebpf \ --exclude integration-ebpf \ --exclude integration-test \ - --exclude xtask \ - --workspace + --feature-powerset - name: Doctests env: RUST_BACKTRACE: full run: | set -euxo pipefail - cargo hack test --doc --feature-powerset \ + cargo hack test --doc \ --exclude aya-ebpf \ --exclude aya-ebpf-bindings \ --exclude aya-log-ebpf \ - --exclude init \ --exclude integration-ebpf \ --exclude integration-test \ - --exclude xtask \ - --workspace + --feature-powerset build-test-aya-ebpf: runs-on: ubuntu-latest @@ -175,28 +172,36 @@ jobs: # to the overhead of setting up the job - so this saves a bunch of # machine time. for arch in aarch64 arm loongarch64 mips powerpc64 riscv64 s390x x86_64; do + echo "::group::arch=$arch" + export RUSTFLAGS="--cfg bpf_target_arch=\"$arch\"" for target in bpfeb-unknown-none bpfel-unknown-none; do - echo "::group::Build and test for $arch / $target" + echo "::group::target=$target" if ! ( - - RUSTFLAGS="--cfg bpf_target_arch=\"$arch\"" cargo +nightly hack build \ + cargo +nightly hack build \ + --release \ --target "$target" \ -Z build-std=core \ --package aya-ebpf \ + --package aya-ebpf-bindings \ --package aya-log-ebpf \ - --feature-powerset - - cargo hack test \ - --doc \ - --package aya-ebpf \ - --package aya-log-ebpf \ + --package integration-ebpf \ --feature-powerset ); then - echo "FAILED: $arch / $target" - failures+=("$arch/$target") + failures+=("build: $arch/$target") fi echo "::endgroup::" done + if ! ( + RUSTDOCFLAGS=$RUSTFLAGS cargo +nightly hack test --doc \ + --package aya-ebpf \ + --package aya-ebpf-bindings \ + --package aya-log-ebpf \ + --package integration-ebpf \ + --feature-powerset + ); then + failures+=("doctests: $arch") + fi + echo "::endgroup::" done if ((${#failures[@]})); then @@ -204,6 +209,7 @@ jobs: printf ' %s\n' "${failures[@]}" exit 1 fi + run-integration-test: strategy: fail-fast: false diff --git a/aya-ebpf-macros/src/lib.rs b/aya-ebpf-macros/src/lib.rs index bbd4fdc3..5c9878b0 100644 --- a/aya-ebpf-macros/src/lib.rs +++ b/aya-ebpf-macros/src/lib.rs @@ -216,14 +216,11 @@ pub fn cgroup_skb(attrs: TokenStream, item: TokenStream) -> TokenStream { /// pub fn connect4(ctx: SockAddrContext) -> i32 { /// match try_connect4(ctx) { /// Ok(ret) => ret, -/// Err(ret) => match ret.try_into() { -/// Ok(rt) => rt, -/// Err(_) => 1, -/// }, +/// Err(ret) => ret, /// } /// } /// -/// fn try_connect4(ctx: SockAddrContext) -> Result { +/// fn try_connect4(ctx: SockAddrContext) -> Result { /// Ok(0) /// } /// ``` @@ -440,7 +437,7 @@ pub fn btf_tracepoint(attrs: TokenStream, item: TokenStream) -> TokenStream { /// ///#[stream_parser] ///fn stream_parser(ctx: SkBuffContext) -> u32 { -/// match { try_stream_parser(ctx) } { +/// match try_stream_parser(ctx) { /// Ok(ret) => ret, /// Err(ret) => ret, /// } @@ -470,7 +467,7 @@ pub fn stream_parser(attrs: TokenStream, item: TokenStream) -> TokenStream { /// ///#[stream_verdict] ///fn stream_verdict(ctx: SkBuffContext) -> u32 { -/// match { try_stream_verdict(ctx) } { +/// match try_stream_verdict(ctx) { /// Ok(ret) => ret, /// Err(ret) => ret, /// } @@ -507,7 +504,7 @@ fn sk_skb(kind: SkSkbKind, attrs: TokenStream, item: TokenStream) -> TokenStream /// /// #[socket_filter] /// pub fn accept_all(_ctx: SkBuffContext) -> i64 { -/// return 0 +/// 0 /// } /// ``` #[proc_macro_attribute] @@ -531,9 +528,10 @@ pub fn socket_filter(attrs: TokenStream, item: TokenStream) -> TokenStream { /// # Examples /// /// ```no_run -/// # #![expect(non_camel_case_types)] /// use aya_ebpf::{macros::fentry, programs::FEntryContext}; +/// # #[expect(non_camel_case_types)] /// # type filename = u32; +/// # #[expect(non_camel_case_types)] /// # type path = u32; /// /// #[fentry(function = "filename_lookup")] @@ -573,9 +571,10 @@ pub fn fentry(attrs: TokenStream, item: TokenStream) -> TokenStream { /// # Examples /// /// ```no_run -/// # #![expect(non_camel_case_types)] /// use aya_ebpf::{macros::fexit, programs::FExitContext}; +/// # #[expect(non_camel_case_types)] /// # type filename = u32; +/// # #[expect(non_camel_case_types)] /// # type path = u32; /// /// #[fexit(function = "filename_lookup")] @@ -658,7 +657,7 @@ pub fn flow_dissector(attrs: TokenStream, item: TokenStream) -> TokenStream { /// #[sk_lookup] /// pub fn accept_all(_ctx: SkLookupContext) -> u32 { /// // use sk_assign to redirect -/// return 0 +/// 0 /// } /// ``` #[proc_macro_attribute] @@ -688,7 +687,7 @@ pub fn sk_lookup(attrs: TokenStream, item: TokenStream) -> TokenStream { /// #[cgroup_device] /// pub fn cgroup_dev(ctx: DeviceContext) -> i32 { /// // Reject all device access -/// return 0; +/// 0 /// } /// ``` #[proc_macro_attribute] diff --git a/aya/src/maps/array/program_array.rs b/aya/src/maps/array/program_array.rs index 9f8f9340..3b88fe11 100644 --- a/aya/src/maps/array/program_array.rs +++ b/aya/src/maps/array/program_array.rs @@ -36,13 +36,13 @@ use crate::{ /// let flags = 0; /// /// // bpf_tail_call(ctx, JUMP_TABLE, 0) will jump to prog_0 -/// prog_array.set(0, &prog_0_fd, flags); +/// prog_array.set(0, prog_0_fd, flags); /// /// // bpf_tail_call(ctx, JUMP_TABLE, 1) will jump to prog_1 -/// prog_array.set(1, &prog_1_fd, flags); +/// prog_array.set(1, prog_1_fd, flags); /// /// // bpf_tail_call(ctx, JUMP_TABLE, 2) will jump to prog_2 -/// prog_array.set(2, &prog_2_fd, flags); +/// prog_array.set(2, prog_2_fd, flags); /// # Ok::<(), aya::EbpfError>(()) /// ``` #[doc(alias = "BPF_MAP_TYPE_PROG_ARRAY")] diff --git a/aya/src/programs/mod.rs b/aya/src/programs/mod.rs index 3255381f..9e151ad8 100644 --- a/aya/src/programs/mod.rs +++ b/aya/src/programs/mod.rs @@ -1229,9 +1229,8 @@ impl_info!( /// use aya::programs::loaded_links; /// /// for info in loaded_links() { -/// if let Ok(info) = info { -/// println!("loaded link: {}", info.id()); -/// } +/// let info = info.unwrap(); +/// println!("loaded link: {}", info.id()); /// } /// ``` pub fn loaded_links() -> impl Iterator> { diff --git a/aya/src/util.rs b/aya/src/util.rs index 3a04aa2a..200b80a1 100644 --- a/aya/src/util.rs +++ b/aya/src/util.rs @@ -323,7 +323,9 @@ fn parse_kernel_symbols(reader: impl BufRead) -> Result, i /// # Example /// /// ```no_run +/// # #[expect(deprecated)] /// use aya::util::syscall_prefix; +/// # #[expect(deprecated)] /// let prefix = syscall_prefix().unwrap(); /// let syscall_fname = format!("{prefix}exec"); /// ``` diff --git a/clippy.sh b/clippy.sh index ca314276..9641623b 100755 --- a/clippy.sh +++ b/clippy.sh @@ -4,12 +4,12 @@ set -eux # `-C panic=abort` because "unwinding panics are not supported without std"; integration-ebpf # contains `#[no_std]` binaries. -# +# # `-Zpanic_abort_tests` because "building tests with panic=abort is not supported without # `-Zpanic_abort_tests`"; Cargo does this automatically when panic=abort is set via profile but we # want to preserve unwinding at runtime - here we are just running clippy so we don't care about # unwinding behavior. -# +# # `+nightly` because "the option `Z` is only accepted on the nightly compiler". cargo +nightly hack clippy "$@" \ --all-targets \ @@ -18,17 +18,30 @@ cargo +nightly hack clippy "$@" \ -C panic=abort \ -Zpanic_abort_tests +export CLIPPY_ARGS='--deny=warnings' +export RUSTDOCFLAGS='--no-run -Z unstable-options --test-builder clippy-driver' + +cargo +nightly hack test --doc "$@" --feature-powerset for arch in aarch64 arm loongarch64 mips powerpc64 riscv64 s390x x86_64; do + export RUSTFLAGS="--cfg bpf_target_arch=\"$arch\"" + for target in bpfeb-unknown-none bpfel-unknown-none; do - RUSTFLAGS="--cfg bpf_target_arch=\"$arch\"" cargo +nightly hack clippy \ + cargo +nightly hack clippy \ --target "$target" \ -Zbuild-std=core \ - --package aya-ebpf-bindings \ --package aya-ebpf \ + --package aya-ebpf-bindings \ --package aya-log-ebpf \ --package integration-ebpf \ --feature-powerset \ -- --deny warnings - done + done + + RUSTDOCFLAGS="$RUSTDOCFLAGS $RUSTFLAGS" cargo +nightly hack test --doc "$@" \ + --package aya-ebpf \ + --package aya-ebpf-bindings \ + --package aya-log-ebpf \ + --package integration-ebpf \ + --feature-powerset done diff --git a/ebpf/aya-ebpf/src/helpers.rs b/ebpf/aya-ebpf/src/helpers.rs index 6e23f1d3..44b61342 100644 --- a/ebpf/aya-ebpf/src/helpers.rs +++ b/ebpf/aya-ebpf/src/helpers.rs @@ -35,7 +35,6 @@ use crate::{ /// # Examples /// /// ```no_run -/// # #![expect(dead_code)] /// # use aya_ebpf::{cty::{c_int, c_long}, helpers::bpf_probe_read}; /// # fn try_test() -> Result<(), c_long> { /// # let kernel_ptr: *const c_int = 0 as _; @@ -74,7 +73,6 @@ pub unsafe fn bpf_probe_read(src: *const T) -> Result { /// # Examples /// /// ```no_run -/// # #![expect(dead_code)] /// # use aya_ebpf::{cty::{c_int, c_long}, helpers::bpf_probe_read_buf}; /// # fn try_test() -> Result<(), c_long> { /// # let ptr: *const u8 = 0 as _; @@ -103,7 +101,6 @@ pub unsafe fn bpf_probe_read_buf(src: *const u8, dst: &mut [u8]) -> Result<(), c /// # Examples /// /// ```no_run -/// # #![expect(dead_code)] /// # use aya_ebpf::{cty::{c_int, c_long}, helpers::bpf_probe_read_user}; /// # fn try_test() -> Result<(), c_long> { /// # let user_ptr: *const c_int = 0 as _; @@ -140,7 +137,6 @@ pub unsafe fn bpf_probe_read_user(src: *const T) -> Result { /// # Examples /// /// ```no_run -/// # #![expect(dead_code)] /// # use aya_ebpf::{cty::{c_int, c_long}, helpers::bpf_probe_read_user_buf}; /// # fn try_test() -> Result<(), c_long> { /// # let user_ptr: *const u8 = 0 as _; @@ -170,7 +166,6 @@ pub unsafe fn bpf_probe_read_user_buf(src: *const u8, dst: &mut [u8]) -> Result< /// # Examples /// /// ```no_run -/// # #![expect(dead_code)] /// # use aya_ebpf::{cty::{c_int, c_long}, helpers::bpf_probe_read_kernel}; /// # fn try_test() -> Result<(), c_long> { /// # let kernel_ptr: *const c_int = 0 as _; @@ -207,7 +202,6 @@ pub unsafe fn bpf_probe_read_kernel(src: *const T) -> Result { /// # Examples /// /// ```no_run -/// # #![expect(dead_code)] /// # use aya_ebpf::{cty::{c_int, c_long}, helpers::bpf_probe_read_kernel_buf}; /// # fn try_test() -> Result<(), c_long> { /// # let kernel_ptr: *const u8 = 0 as _; @@ -240,11 +234,12 @@ pub unsafe fn bpf_probe_read_kernel_buf(src: *const u8, dst: &mut [u8]) -> Resul /// # Examples /// /// ```no_run -/// # #![expect(dead_code)] +/// # #[expect(deprecated)] /// # use aya_ebpf::{cty::c_long, helpers::bpf_probe_read_str}; /// # fn try_test() -> Result<(), c_long> { /// # let kernel_ptr: *const u8 = 0 as _; /// let mut my_str = [0u8; 16]; +/// # #[expect(deprecated)] /// let num_read = unsafe { bpf_probe_read_str(kernel_ptr, &mut my_str)? }; /// /// // Do something with num_read and my_str @@ -276,11 +271,12 @@ pub unsafe fn bpf_probe_read_str(src: *const u8, dest: &mut [u8]) -> Result Result<(), c_long> { /// # let user_ptr: *const u8 = 0 as _; /// let mut my_str = [0u8; 16]; +/// # #[expect(deprecated)] /// let num_read = unsafe { bpf_probe_read_user_str(user_ptr, &mut my_str)? }; /// /// // Do something with num_read and my_str @@ -315,7 +311,6 @@ pub unsafe fn bpf_probe_read_user_str(src: *const u8, dest: &mut [u8]) -> Result /// eBPF stack limit is 512 bytes): /// /// ```no_run -/// # #![expect(dead_code)] /// # use aya_ebpf::{cty::c_long, helpers::bpf_probe_read_user_str_bytes}; /// # fn try_test() -> Result<(), c_long> { /// # let user_ptr: *const u8 = 0 as _; @@ -421,11 +416,12 @@ fn read_str_bytes(len: i64, dest: &[u8]) -> Result<&[u8], c_long> { /// # Examples /// /// ```no_run -/// # #![expect(dead_code)] +/// # #[expect(deprecated)] /// # use aya_ebpf::{cty::c_long, helpers::bpf_probe_read_kernel_str}; /// # fn try_test() -> Result<(), c_long> { /// # let kernel_ptr: *const u8 = 0 as _; /// let mut my_str = [0u8; 16]; +/// # #[expect(deprecated)] /// let num_read = unsafe { bpf_probe_read_kernel_str(kernel_ptr, &mut my_str)? }; /// /// // Do something with num_read and my_str @@ -464,7 +460,6 @@ pub unsafe fn bpf_probe_read_kernel_str(src: *const u8, dest: &mut [u8]) -> Resu /// eBPF stack limit is 512 bytes): /// /// ```no_run -/// # #![expect(dead_code)] /// # use aya_ebpf::{cty::c_long, helpers::bpf_probe_read_kernel_str_bytes}; /// # fn try_test() -> Result<(), c_long> { /// # let kernel_ptr: *const u8 = 0 as _; @@ -554,7 +549,6 @@ pub unsafe fn bpf_probe_read_kernel_str_bytes( /// # Examples /// /// ```no_run -/// # #![expect(dead_code)] /// # use aya_ebpf::{ /// # cty::{c_int, c_long}, /// # helpers::bpf_probe_write_user, @@ -587,7 +581,6 @@ pub unsafe fn bpf_probe_write_user(dst: *mut T, src: *const T) -> Result<(), /// # Examples /// /// ```no_run -/// # #![expect(dead_code)] /// # use aya_ebpf::helpers::bpf_get_current_comm; /// let comm = bpf_get_current_comm(); /// @@ -622,7 +615,6 @@ pub fn bpf_get_current_comm() -> Result<[u8; 16], c_long> { /// # Examples /// /// ```no_run -/// # #![expect(dead_code)] /// # use aya_ebpf::helpers::bpf_get_current_pid_tgid; /// let tgid = (bpf_get_current_pid_tgid() >> 32) as u32; /// let pid = bpf_get_current_pid_tgid() as u32; @@ -645,7 +637,6 @@ pub fn bpf_get_current_pid_tgid() -> u64 { /// # Examples /// /// ```no_run -/// # #![expect(dead_code)] /// # use aya_ebpf::helpers::bpf_get_current_uid_gid; /// let gid = (bpf_get_current_uid_gid() >> 32) as u32; /// let uid = bpf_get_current_uid_gid() as u32; diff --git a/ebpf/aya-ebpf/src/maps/program_array.rs b/ebpf/aya-ebpf/src/maps/program_array.rs index d56f076a..8241eed2 100644 --- a/ebpf/aya-ebpf/src/maps/program_array.rs +++ b/ebpf/aya-ebpf/src/maps/program_array.rs @@ -14,7 +14,6 @@ use crate::{ /// # Examples /// /// ```no_run -/// # #![expect(dead_code)] /// use aya_ebpf::{macros::map, maps::ProgramArray, cty::c_long}; /// # use aya_ebpf::{programs::LsmContext}; /// @@ -24,8 +23,8 @@ use crate::{ /// # unsafe fn try_test(ctx: &LsmContext) -> Result<(), c_long> { /// let index: u32 = 13; /// -/// if let Err(e) = JUMP_TABLE.tail_call(ctx, index) { -/// return Err(e); +/// unsafe { +/// JUMP_TABLE.tail_call(ctx, index)?; /// } /// /// # Err(-1) diff --git a/ebpf/aya-ebpf/src/programs/fentry.rs b/ebpf/aya-ebpf/src/programs/fentry.rs index b67fb35c..0e61236d 100644 --- a/ebpf/aya-ebpf/src/programs/fentry.rs +++ b/ebpf/aya-ebpf/src/programs/fentry.rs @@ -16,10 +16,10 @@ impl FEntryContext { /// # Examples /// /// ```no_run - /// # #![expect(non_camel_case_types)] - /// # #![expect(dead_code)] /// # use aya_ebpf::{cty::c_int, programs::FEntryContext}; + /// # #[expect(non_camel_case_types)] /// # type pid_t = c_int; + /// # #[expect(non_camel_case_types)] /// # struct task_struct { /// # pid: pid_t, /// # } diff --git a/ebpf/aya-ebpf/src/programs/fexit.rs b/ebpf/aya-ebpf/src/programs/fexit.rs index 20a4c3b5..d936c310 100644 --- a/ebpf/aya-ebpf/src/programs/fexit.rs +++ b/ebpf/aya-ebpf/src/programs/fexit.rs @@ -16,10 +16,10 @@ impl FExitContext { /// # Examples /// /// ```no_run - /// # #![expect(non_camel_case_types)] - /// # #![expect(dead_code)] /// # use aya_ebpf::{cty::c_int, programs::FExitContext}; + /// # #[expect(non_camel_case_types)] /// # type pid_t = c_int; + /// # #[expect(non_camel_case_types)] /// # struct task_struct { /// # pid: pid_t, /// # } diff --git a/ebpf/aya-ebpf/src/programs/lsm.rs b/ebpf/aya-ebpf/src/programs/lsm.rs index 741aa1b6..4e0111d5 100644 --- a/ebpf/aya-ebpf/src/programs/lsm.rs +++ b/ebpf/aya-ebpf/src/programs/lsm.rs @@ -25,7 +25,6 @@ impl LsmContext { /// # Examples /// /// ```no_run - /// # #![expect(dead_code)] /// # use aya_ebpf::{programs::LsmContext, cty::{c_int, c_ulong}}; /// unsafe fn try_lsm_mmap_addr(ctx: LsmContext) -> Result { /// // In the kernel, this hook is defined as: diff --git a/ebpf/aya-ebpf/src/programs/probe.rs b/ebpf/aya-ebpf/src/programs/probe.rs index 6c7266c6..e2ee6e0e 100644 --- a/ebpf/aya-ebpf/src/programs/probe.rs +++ b/ebpf/aya-ebpf/src/programs/probe.rs @@ -16,16 +16,18 @@ impl ProbeContext { /// # Examples /// /// ```no_run - /// # #![expect(non_camel_case_types)] - /// # #![expect(dead_code)] /// # use aya_ebpf::{programs::ProbeContext, cty::c_int, helpers::bpf_probe_read}; + /// # #[expect(non_camel_case_types)] /// # type pid_t = c_int; + /// # #[expect(non_camel_case_types)] /// # struct task_struct { /// # pid: pid_t, /// # } /// unsafe fn try_kprobe_try_to_wake_up(ctx: ProbeContext) -> Result { /// let tp: *const task_struct = ctx.arg(0).ok_or(1u32)?; - /// let pid = bpf_probe_read(&(*tp).pid as *const pid_t).map_err(|_| 1u32)?; + /// let pid = unsafe { + /// bpf_probe_read(core::ptr::addr_of!((*tp).pid)) + /// }.map_err(|err| err as u32)?; /// /// // Do something with pid or something else with tp /// diff --git a/ebpf/aya-ebpf/src/programs/retprobe.rs b/ebpf/aya-ebpf/src/programs/retprobe.rs index c2aec986..c669f25e 100644 --- a/ebpf/aya-ebpf/src/programs/retprobe.rs +++ b/ebpf/aya-ebpf/src/programs/retprobe.rs @@ -16,7 +16,6 @@ impl RetProbeContext { /// # Examples /// /// ```no_run - /// # #![expect(dead_code)] /// # use aya_ebpf::{programs::RetProbeContext, cty::c_int}; /// unsafe fn try_kretprobe_try_to_wake_up(ctx: RetProbeContext) -> Result { /// let retval: c_int = ctx.ret(); diff --git a/ebpf/aya-ebpf/src/programs/sk_buff.rs b/ebpf/aya-ebpf/src/programs/sk_buff.rs index 93b5f5e0..deb9654b 100644 --- a/ebpf/aya-ebpf/src/programs/sk_buff.rs +++ b/ebpf/aya-ebpf/src/programs/sk_buff.rs @@ -384,8 +384,8 @@ impl SkBuffContext { /// fn try_cgroup_skb(ctx: SkBuffContext) -> Result { /// let len = ETH_HLEN + IP_HLEN + UDP_HLEN; /// match ctx.pull_data(len as u32) { - /// Ok(()) => return Ok(0), - /// Err(ret) => return Err(ret as i32), + /// Ok(()) => Ok(0), + /// Err(ret) => Err(ret as i32), /// } /// } /// ``` diff --git a/ebpf/aya-ebpf/src/programs/tc.rs b/ebpf/aya-ebpf/src/programs/tc.rs index e9281d83..8304d58c 100644 --- a/ebpf/aya-ebpf/src/programs/tc.rs +++ b/ebpf/aya-ebpf/src/programs/tc.rs @@ -176,8 +176,8 @@ impl TcContext { /// fn try_classifier(ctx: TcContext) -> Result { /// let len = ETH_HLEN + IP_HLEN + UDP_HLEN; /// match ctx.pull_data(len as u32) { - /// Ok(()) => return Ok(0), - /// Err(ret) => return Err(ret as i32), + /// Ok(()) => Ok(0), + /// Err(ret) => Err(ret as i32), /// } /// } /// ``` diff --git a/ebpf/aya-ebpf/src/programs/tp_btf.rs b/ebpf/aya-ebpf/src/programs/tp_btf.rs index 9e39f2f0..c5daf637 100644 --- a/ebpf/aya-ebpf/src/programs/tp_btf.rs +++ b/ebpf/aya-ebpf/src/programs/tp_btf.rs @@ -19,7 +19,6 @@ impl BtfTracePointContext { /// # Examples /// /// ```no_run - /// # #![expect(dead_code)] /// # use aya_ebpf::{programs::BtfTracePointContext, cty::{c_int, c_ulong, c_char}}; /// unsafe fn try_tp_btf_sched_process_fork(ctx: BtfTracePointContext) -> Result { /// // Grab arguments diff --git a/test/integration-ebpf/src/log.rs b/test/integration-ebpf/src/log.rs index 3e7bf5b8..b55b7276 100644 --- a/test/integration-ebpf/src/log.rs +++ b/test/integration-ebpf/src/log.rs @@ -115,10 +115,10 @@ fn test_log(ctx: ProbeContext) { let buf = &buf[..core::cmp::min(len, buf.len())]; info!(&ctx, "variable length buffer: {:x}", buf); - info!(&ctx, "2KiB array: {:x}", &TWO_KB_ARRAY); - info!(&ctx, "4KiB array: {:x}", &FOUR_KB_ARRAY); + info!(&ctx, "2KiB array: {:x}", TWO_KB_ARRAY.as_slice()); + info!(&ctx, "4KiB array: {:x}", FOUR_KB_ARRAY.as_slice()); // This one is too big and should be dropped. - info!(&ctx, "8KiB array: {:x}", &EIGHT_KB_ARRAY); + info!(&ctx, "8KiB array: {:x}", EIGHT_KB_ARRAY.as_slice()); } #[uprobe] From 2b8cd557aaf931845c9931420b062c799701bdaf Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Sat, 8 Nov 2025 15:31:53 -0500 Subject: [PATCH 15/46] xtask: drop build script logging prefix This code doesn't run under cargo. --- xtask/src/run.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xtask/src/run.rs b/xtask/src/run.rs index 190d0cab..8cb06142 100644 --- a/xtask/src/run.rs +++ b/xtask/src/run.rs @@ -87,8 +87,8 @@ where } } Message::CompilerMessage(CompilerMessage { message, .. }) => { - for line in message.rendered.unwrap_or_default().split('\n') { - println!("cargo:warning={line}"); + if let Some(rendered) = message.rendered { + print!("{rendered}"); } } Message::TextLine(line) => { @@ -210,7 +210,7 @@ pub(crate) fn run(opts: Options) -> Result<()> { })?; if dest_path_exists != etag_path_exists { println!( - "cargo:warning=({}).exists()={} != ({})={} (mismatch)", + "({}).exists()={} != ({})={} (mismatch)", dest_path.display(), dest_path_exists, etag_path.display(), @@ -239,7 +239,7 @@ pub(crate) fn run(opts: Options) -> Result<()> { if status.code() != Some(0) { if dest_path_exists { println!( - "cargo:warning={curl:?} failed ({status:?}); using cached {}", + "{curl:?} failed ({status:?}); using cached {}", dest_path.display() ); } else { From 989a465f0c54de460835fe682da48325e883ae26 Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Sat, 8 Nov 2025 13:21:34 -0500 Subject: [PATCH 16/46] xtask: avoid extracting complete archives Now that we're no longer shelling out to do this, we can avoid most of the work. Operate directly on the archive, unpacking only what we need. --- xtask/src/run.rs | 223 +++++++++++++++++++++++++++-------------------- 1 file changed, 129 insertions(+), 94 deletions(-) diff --git a/xtask/src/run.rs b/xtask/src/run.rs index 8cb06142..a5da361f 100644 --- a/xtask/src/run.rs +++ b/xtask/src/run.rs @@ -1,5 +1,5 @@ use std::{ - ffi::{OsStr, OsString}, + ffi::OsString, fmt::Write as _, fs::{self, File, OpenOptions}, io::{BufRead as _, BufReader, Write as _}, @@ -107,6 +107,86 @@ where Ok(executables) } +enum Disposition { + Skip, + Unpack(T), +} + +fn with_deb(archive: &Path, dest: &Path, mut state: S, mut select: F) -> Result +where + F: for<'state> FnMut( + &'state mut S, + &Path, + tar::EntryType, + ) -> Disposition>>, +{ + fs::create_dir_all(dest).with_context(|| format!("failed to create {}", dest.display()))?; + + let archive_reader = File::open(archive) + .with_context(|| format!("failed to open the deb package {}", archive.display()))?; + let mut archive_reader = ar::Archive::new(archive_reader); + // `ar` entries are borrowed from the reader, so the reader + // cannot implement `Iterator` (because `Iterator::Item` is not + // a GAT). + // + // https://github.com/mdsteele/rust-ar/issues/15 + let mut data_tar_xz_entries = 0; + let start = std::time::Instant::now(); + while let Some(entry) = archive_reader.next_entry() { + let entry = entry.with_context(|| format!("({}).next_entry()", archive.display()))?; + const DATA_TAR_XZ: &str = "data.tar.xz"; + if entry.header().identifier() != DATA_TAR_XZ.as_bytes() { + continue; + } + data_tar_xz_entries += 1; + let entry_reader = xz2::read::XzDecoder::new(entry); + let mut entry_reader = tar::Archive::new(entry_reader); + let entries = entry_reader + .entries() + .with_context(|| format!("({}/{DATA_TAR_XZ}).entries()", archive.display()))?; + for (i, entry) in entries.enumerate() { + let mut entry = entry + .with_context(|| format!("({}/{DATA_TAR_XZ}).entries()[{i}]", archive.display()))?; + let path = entry.path().with_context(|| { + format!( + "({}/{DATA_TAR_XZ}).entries()[{i}].path()", + archive.display() + ) + })?; + let entry_type = entry.header().entry_type(); + let selected = match select(&mut state, path.as_ref(), entry_type) { + Disposition::Skip => continue, + Disposition::Unpack(selected) => selected, + }; + if let Some(selected) = selected { + println!( + "{}[{}] in {:?}", + archive.display(), + path.display(), + start.elapsed() + ); + selected.push(dest.join(path)); + } + let unpacked = entry.unpack_in(dest).with_context(|| { + format!( + "({}/{DATA_TAR_XZ})[{i}].unpack_in({})", + archive.display(), + dest.display(), + ) + })?; + assert!( + unpacked, + "({}/{DATA_TAR_XZ})[{i}].unpack_in({})", + archive.display(), + dest.display(), + ); + } + } + println!("{} in {:?}", archive.display(), start.elapsed()); + assert_eq!(data_tar_xz_entries, 1); + Ok(state) +} + /// Build and run the project. pub(crate) fn run(opts: Options) -> Result<()> { let Options { @@ -294,82 +374,55 @@ pub(crate) fn run(opts: Options) -> Result<()> { let extraction_root = tempfile::tempdir().context("tempdir failed")?; let mut errors = Vec::new(); for (index, archive) in kernel_archives.iter().enumerate() { - let archive_dir = extraction_root - .path() - .join(format!("kernel-archive-{index}")); - fs::create_dir_all(&archive_dir) - .with_context(|| format!("failed to create {}", archive_dir.display()))?; - - let archive_reader = File::open(archive).with_context(|| { - format!("failed to open the deb package {}", archive.display()) - })?; - let mut archive_reader = ar::Archive::new(archive_reader); - // `ar` entries are borrowed from the reader, so the reader - // cannot implement `Iterator` (because `Iterator::Item` is not - // a GAT). - // - // https://github.com/mdsteele/rust-ar/issues/15 - let mut entries = 0; - while let Some(entry) = archive_reader.next_entry() { - let entry = entry.with_context(|| { - format!( - "failed to read an entry of the deb package {}", - archive.display() - ) - })?; - if entry.header().identifier() == b"data.tar.xz" { - let entry_reader = xz2::read::XzDecoder::new(entry); - let mut entry_reader = tar::Archive::new(entry_reader); - entry_reader.unpack(&archive_dir).with_context(|| { - format!( - "failed to unpack archive {} to {}", - archive.display(), - archive_dir.display() - ) - })?; - entries += 1; - } - } - assert_eq!(entries, 1); - - let mut kernel_images = Vec::new(); - let mut configs = Vec::new(); - for entry in WalkDir::new(&archive_dir) { - let entry = entry.with_context(|| { - format!("failed to read entry in {}", archive_dir.display()) - })?; - if !entry.file_type().is_file() { - continue; - } - let path = entry.into_path(); - if let Some(file_name) = path.file_name() { - match file_name.as_encoded_bytes() { - // "vmlinuz-" - [ - b'v', - b'm', - b'l', - b'i', - b'n', - b'u', - b'z', - b'-', - kernel_version @ .., - ] => { - let kernel_version = - unsafe { OsStr::from_encoded_bytes_unchecked(kernel_version) } - .to_os_string(); - kernel_images.push((path, kernel_version)) - } - // "config-" - [b'c', b'o', b'n', b'f', b'i', b'g', b'-', ..] => { - configs.push(path); + let (kernel_images, configs, modules_dirs) = with_deb( + archive, + &extraction_root + .path() + .join(format!("kernel-archive-{index}")), + (Vec::new(), Vec::new(), Vec::new()), + |(kernel_images, configs, modules_dirs), path, entry_type| { + if let Some(path) = ["./lib/modules/", "./usr/lib/modules/"] + .into_iter() + .find_map(|modules_dir| { + // TODO(https://github.com/rust-lang/rust-clippy/issues/14112): Remove this + // allowance when the lint behaves more sensibly. + #[expect(clippy::manual_ok_err)] + match path.strip_prefix(modules_dir) { + Ok(path) => Some(path), + Err(path::StripPrefixError { .. }) => None, + } + }) + { + return Disposition::Unpack( + (path.iter().count() == 1).then_some(modules_dirs), + ); + } + if !entry_type.is_file() { + return Disposition::Skip; + } + let name = match path.strip_prefix("./boot/") { + Ok(path) => { + if let Some(path::Component::Normal(name)) = + path.components().next() + { + name + } else { + return Disposition::Skip; + } } - _ => {} + Err(path::StripPrefixError { .. }) => return Disposition::Skip, + }; + let name = name.as_encoded_bytes(); + if name.starts_with(b"vmlinuz-") { + Disposition::Unpack(Some(kernel_images)) + } else if name.starts_with(b"config-") { + Disposition::Unpack(Some(configs)) + } else { + Disposition::Skip } - } - } - let (kernel_image, kernel_version) = match kernel_images.as_slice() { + }, + )?; + let kernel_image = match kernel_images.as_slice() { [kernel_image] => kernel_image, [] => bail!("no kernel images in {}", archive.display()), kernel_images => bail!( @@ -380,27 +433,9 @@ pub(crate) fn run(opts: Options) -> Result<()> { }; let config = match configs.as_slice() { [config] => config, + [] => bail!("no configs in {}", archive.display()), configs => bail!("multiple configs in {}: {:?}", archive.display(), configs), }; - - let mut modules_dirs = Vec::new(); - for entry in WalkDir::new(&archive_dir) { - let entry = entry.with_context(|| { - format!("failed to read entry in {}", archive_dir.display()) - })?; - if !entry.file_type().is_dir() { - continue; - } - let path = entry.into_path(); - let mut components = path.components().rev(); - if components.next() != Some(path::Component::Normal(kernel_version)) { - continue; - } - if components.next() != Some(path::Component::Normal(OsStr::new("modules"))) { - continue; - } - modules_dirs.push(path); - } let modules_dir = match modules_dirs.as_slice() { [modules_dir] => modules_dir, [] => bail!("no modules directories in {}", archive.display()), From 65865e8dfc8db2879cdc11d4117acd5615d0b9ab Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Mon, 10 Nov 2025 09:13:27 -0500 Subject: [PATCH 17/46] .github: disable macos-15-intel These builds are timing out, see https://github.com/actions/runner-images/issues/13277. --- .github/workflows/ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e9b1add4..72937e20 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -215,14 +215,16 @@ jobs: fail-fast: false matrix: include: - - target: x86_64-apple-darwin + # TODO(https://github.com/actions/runner-images/issues/13277): Reenable when fixed. + # - target: x86_64-apple-darwin # macos-15 is arm64[0] which doesn't support nested # virtualization[1]. # # [0] https://github.com/actions/runner-images#available-images # # [1] https://docs.github.com/en/actions/reference/runners/github-hosted-runners#limitations-for-arm64-macos-runners - os: macos-15-intel + # + # os: macos-15-intel # We don't use ubuntu-latest because we care about the apt packages available. - target: x86_64-unknown-linux-gnu From d8f5497884a23bd63f9264dbe3f80081b76f360d Mon Sep 17 00:00:00 2001 From: JPaja <44926986+JPaja@users.noreply.github.com> Date: Mon, 10 Nov 2025 20:12:04 +0100 Subject: [PATCH 18/46] feat: add `Ebpf::maps_disjoint_mut` Implemented using `HashMap::get_disjoint_mut` introduced in Rust 1.86.0. --- aya/src/bpf.rs | 29 ++++++++++++ test/integration-ebpf/src/map_test.rs | 21 ++++++++- test/integration-test/src/tests.rs | 1 + .../src/tests/maps_disjoint.rs | 44 +++++++++++++++++++ xtask/public-api/aya.txt | 1 + 5 files changed, 94 insertions(+), 2 deletions(-) create mode 100644 test/integration-test/src/tests/maps_disjoint.rs diff --git a/aya/src/bpf.rs b/aya/src/bpf.rs index 609ae553..90ad428a 100644 --- a/aya/src/bpf.rs +++ b/aya/src/bpf.rs @@ -1055,6 +1055,35 @@ impl Ebpf { self.maps.iter_mut().map(|(name, map)| (name.as_str(), map)) } + /// Attempts to get mutable references to `N` maps at once. + /// + /// Returns an array of length `N` with the results of each query, in the same order + /// as the requested map names. For soundness, at most one mutable reference will be + /// returned to any map. `None` will be used if a map with the given name is missing. + /// + /// This method performs a check to ensure that there are no duplicate map names, + /// which currently has a time-complexity of *O(n²)*. Be careful when passing a large + /// number of names. + /// + /// # Panics + /// + /// Panics if any names are duplicated. + /// + /// # Examples + /// ```no_run + /// # let mut bpf = aya::Ebpf::load(&[])?; + /// match bpf.maps_disjoint_mut(["MAP1", "MAP2"]) { + /// [Some(m1), Some(m2)] => println!("Got MAP1 and MAP2"), + /// [Some(m1), None] => println!("Got only MAP1"), + /// [None, Some(m2)] => println!("Got only MAP2"), + /// [None, None] => println!("No maps"), + /// } + /// # Ok::<(), aya::EbpfError>(()) + /// ``` + pub fn maps_disjoint_mut(&mut self, names: [&str; N]) -> [Option<&mut Map>; N] { + self.maps.get_disjoint_mut(names) + } + /// Returns a reference to the program with the given name. /// /// You can use this to inspect a program and its properties. To load and attach a program, use diff --git a/test/integration-ebpf/src/map_test.rs b/test/integration-ebpf/src/map_test.rs index eac1823d..0135487a 100644 --- a/test/integration-ebpf/src/map_test.rs +++ b/test/integration-ebpf/src/map_test.rs @@ -3,9 +3,9 @@ #![expect(unused_crate_dependencies, reason = "used in other bins")] use aya_ebpf::{ - macros::{map, socket_filter}, + macros::{map, socket_filter, uprobe}, maps::{Array, HashMap}, - programs::SkBuffContext, + programs::{ProbeContext, SkBuffContext}, }; #[cfg(not(test))] extern crate ebpf_panic; @@ -35,3 +35,20 @@ fn simple_prog(_ctx: SkBuffContext) -> i64 { 0 } + +#[uprobe] +fn simple_prog_mut(_ctx: ProbeContext) -> i64 { + if let Some(array_value) = FOO.get_ptr_mut(0) { + unsafe { + *array_value += 1; + } + } + + if let Some(map_value) = BAZ.get_ptr_mut(0) { + unsafe { + *map_value += 1; + } + } + + 0 +} diff --git a/test/integration-test/src/tests.rs b/test/integration-test/src/tests.rs index b7d4d492..8c605313 100644 --- a/test/integration-test/src/tests.rs +++ b/test/integration-test/src/tests.rs @@ -10,6 +10,7 @@ mod load; mod log; mod lsm; mod map_pin; +mod maps_disjoint; mod raw_tracepoint; mod rbpf; mod relocations; diff --git a/test/integration-test/src/tests/maps_disjoint.rs b/test/integration-test/src/tests/maps_disjoint.rs new file mode 100644 index 00000000..79f6fe23 --- /dev/null +++ b/test/integration-test/src/tests/maps_disjoint.rs @@ -0,0 +1,44 @@ +use aya::{ + Ebpf, + maps::{Array, HashMap}, + programs::UProbe, +}; + +#[unsafe(no_mangle)] +#[inline(never)] +extern "C" fn trigger_ebpf_program_maps_disjoint() { + core::hint::black_box(trigger_ebpf_program_maps_disjoint); +} + +#[test_log::test] +fn test_maps_disjoint() { + let mut bpf: Ebpf = Ebpf::load(crate::MAP_TEST).unwrap(); + let prog: &mut UProbe = bpf + .program_mut("simple_prog_mut") + .unwrap() + .try_into() + .unwrap(); + + prog.load().unwrap(); + prog.attach( + "trigger_ebpf_program_maps_disjoint", + "/proc/self/exe", + None, + None, + ) + .unwrap(); + + let [foo, bar, baz] = bpf.maps_disjoint_mut(["FOO", "BAR", "BAZ"]); + + let mut foo: Array<_, u32> = Array::try_from(foo.unwrap()).unwrap(); + let mut bar: HashMap<_, u32, u8> = HashMap::try_from(bar.unwrap()).unwrap(); + assert!(baz.is_none()); + + foo.set(0, 5, 0).unwrap(); + bar.insert(0, 10, 0).unwrap(); + + trigger_ebpf_program_maps_disjoint(); + + assert_eq!(foo.get(&0, 0).unwrap(), 6); + assert_eq!(bar.get(&0, 0).unwrap(), 11); +} diff --git a/xtask/public-api/aya.txt b/xtask/public-api/aya.txt index 0bd2328f..27a51ec5 100644 --- a/xtask/public-api/aya.txt +++ b/xtask/public-api/aya.txt @@ -10629,6 +10629,7 @@ pub fn aya::Ebpf::load_file>(path: P) - pub fn aya::Ebpf::map(&self, name: &str) -> core::option::Option<&aya::maps::Map> pub fn aya::Ebpf::map_mut(&mut self, name: &str) -> core::option::Option<&mut aya::maps::Map> pub fn aya::Ebpf::maps(&self) -> impl core::iter::traits::iterator::Iterator +pub fn aya::Ebpf::maps_disjoint_mut(&mut self, names: [&str; N]) -> [core::option::Option<&mut aya::maps::Map>; N] pub fn aya::Ebpf::maps_mut(&mut self) -> impl core::iter::traits::iterator::Iterator pub fn aya::Ebpf::program(&self, name: &str) -> core::option::Option<&aya::programs::Program> pub fn aya::Ebpf::program_mut(&mut self, name: &str) -> core::option::Option<&mut aya::programs::Program> From 7288a2b8daf4b184553d59a13c7938be262a350e Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Mon, 10 Nov 2025 15:33:59 -0500 Subject: [PATCH 19/46] .github: remove stale comment GNU tar is not needed since 5f046899b58e98d29a1dd3e1f55bb43c66c9ef4c. --- .github/workflows/ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 72937e20..a73bdeef 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -254,8 +254,6 @@ jobs: # https://github.com/curl/curl/commit/85efbb92b8e6679705e122cee45ce76c56414a3e which is # needed for proper handling of `--etag-{compare,save}`. # - # The tar shipped on macOS doesn't support --wildcards, so we need GNU tar. - # # The clang shipped on macOS doesn't support BPF, so we need LLVM from brew. # # We need a musl C toolchain to compile our `test-distro` since some of From e2f09ac62f733678a1ba6c97c1752df0f17a1612 Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Mon, 10 Nov 2025 15:46:21 -0500 Subject: [PATCH 20/46] .github: move comments to Brewfile This is where the dependencies are. --- .github/workflows/ci.yml | 9 --------- Brewfile | 8 ++++++++ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a73bdeef..a47e8d8a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -250,15 +250,6 @@ jobs: - name: Install prerequisites if: runner.os == 'macOS' - # The curl shipped on macOS doesn't contain - # https://github.com/curl/curl/commit/85efbb92b8e6679705e122cee45ce76c56414a3e which is - # needed for proper handling of `--etag-{compare,save}`. - # - # The clang shipped on macOS doesn't support BPF, so we need LLVM from brew. - # - # We need a musl C toolchain to compile our `test-distro` since some of - # our dependencies have build scripts that compile C code (i.e xz2). - # This is provided by `brew install filosottile/musl-cross/musl-cross`. run: | set -euxo pipefail # Dependencies are tracked in `Brewfile`. diff --git a/Brewfile b/Brewfile index 356453a7..285773b9 100644 --- a/Brewfile +++ b/Brewfile @@ -1,10 +1,18 @@ # Keep this congruent with `.github/workflows/ci.yml`. +# The curl shipped on macOS doesn't contain +# https://github.com/curl/curl/commit/85efbb92b8e6679705e122cee45ce76c56414a3e +# which is needed for proper handling of `--etag-{compare,save}`. brew "curl" + +# The clang shipped on macOS doesn't support BPF, so we need LLVM from brew. brew "llvm" + brew "lynx" brew "pkg-config" brew "qemu" +# We need a musl C toolchain to compile our `test-distro` since some of our +# dependencies have build scripts that compile C code (i.e xz2). tap "filosottile/musl-cross" brew "filosottile/musl-cross/musl-cross" From fd18c3f4ab9b2dde280fb7074fd6c2abca744f2d Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Mon, 10 Nov 2025 13:29:02 -0500 Subject: [PATCH 21/46] .github: shard arm64 virtualized integration Github arm64 runners don't support nested virtualization and they broke nested virtualization on macos-15-intel so we must go nuclear. --- .github/workflows/ci.yml | 113 ++++++++++++++++++++++++--------------- 1 file changed, 71 insertions(+), 42 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a47e8d8a..0a3ca4c9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -214,23 +214,42 @@ jobs: strategy: fail-fast: false matrix: + # We don't have a fast solution for running virtualized integration + # tests on arm64 because: + # - Github broke nested virtualization on macos-15-intel (see below). + # - Github arm64 runners don't support nested virtualization (see + # https://github.com/orgs/community/discussions/148648#discussioncomment-11863547). + # - Unlike HVF, KVM doesn't emulate CPUs. + # + # So we spin a runner for every arm64 kernel to avoid waiting 20 minutes + # for CI. We use arm64 runners to avoid cross-compilation. + os: + - ubuntu-24.04-arm + download-kernel-images: + - arm64 5.10 + - arm64 6.1 + - arm64 6.12 + skip-local: + - true include: # TODO(https://github.com/actions/runner-images/issues/13277): Reenable when fixed. - # - target: x86_64-apple-darwin - # macos-15 is arm64[0] which doesn't support nested - # virtualization[1]. - # - # [0] https://github.com/actions/runner-images#available-images - # - # [1] https://docs.github.com/en/actions/reference/runners/github-hosted-runners#limitations-for-arm64-macos-runners - # - # os: macos-15-intel + # macos-15 is arm64[0] which doesn't support nested + # virtualization[1]. + # + # [0] https://github.com/actions/runner-images#available-images + # + # [1] https://docs.github.com/en/actions/reference/runners/github-hosted-runners#limitations-for-arm64-macos-runners + # + # - os: macos-15-intel # We don't use ubuntu-latest because we care about the apt packages available. - - target: x86_64-unknown-linux-gnu - os: ubuntu-24.04 - - target: aarch64-unknown-linux-gnu - os: ubuntu-24.04-arm + - os: ubuntu-24.04 + download-kernel-images: amd64 5.10 6.1 6.12 + - os: ubuntu-24.04-arm + # Native arm runner for local tests only; arm runners don't support + # nested virtualization so running them here would be slow. + download-kernel-images: local + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v5 @@ -241,6 +260,12 @@ jobs: if: runner.os == 'Linux' run: | set -euxo pipefail + + # https://github.blog/changelog/2023-02-23-hardware-accelerated-android-virtualization-on-actions-windows-and-linux-larger-hosted-runners/ + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules + sudo udevadm control --reload-rules + sudo udevadm trigger --name-match=kvm || true # kvm is not available on arm64. + sudo apt update sudo apt -y install \ liblzma-dev \ @@ -287,7 +312,31 @@ jobs: --header 'content-type: application/json' \ | jq -r '.sha') mkdir -p /tmp/rustc-llvm - curl -sfSL https://ci-artifacts.rust-lang.org/rustc-builds/$rustc_sha/rust-dev-nightly-${{ matrix.target }}.tar.xz | \ + case "${{ runner.arch }}" in + ARM64) + arch=aarch64 + ;; + X64) + arch=x86_64 + ;; + *) + echo "::error::Unsupported runner architecture: ${{ runner.arch }}" + exit 1 + ;; + esac + case "${{ runner.os }}" in + Linux) + target=${arch}-unknown-linux-gnu + ;; + macOS) + target=${arch}-apple-darwin + ;; + *) + echo "::error::Unsupported runner OS: ${{ runner.os }}" + exit 1 + ;; + esac + curl -sfSL https://ci-artifacts.rust-lang.org/rustc-builds/$rustc_sha/rust-dev-nightly-${target}.tar.xz | \ tar -xJ --strip-components 2 -C /tmp/rustc-llvm echo /tmp/rustc-llvm/bin >> $GITHUB_PATH @@ -300,44 +349,24 @@ jobs: - uses: actions/cache@v4 with: path: test/.tmp - key: ${{ runner.arch }}-${{ runner.os }}-test-cache + key: ${{ runner.arch }}-${{ runner.os }}-test-cache-${{ matrix.download-kernel-images }} - name: Download debian kernels - if: runner.arch == 'ARM64' - run: .github/scripts/download_kernel_images.sh test/.tmp/debian-kernels/arm64 arm64 5.10 6.1 6.12 + if: matrix.download-kernel-images != 'local' + run: | + set -euxo pipefail - - name: Download debian kernels - if: runner.arch == 'X64' - run: .github/scripts/download_kernel_images.sh test/.tmp/debian-kernels/amd64 amd64 5.10 6.1 6.12 + .github/scripts/download_kernel_images.sh test/.tmp/debian-kernels ${{ matrix.download-kernel-images }} - name: Cleanup stale kernels and modules - run: | - set -euxo pipefail - rm -rf test/.tmp/boot test/.tmp/lib + run: rm -rf test/.tmp/boot test/.tmp/lib - name: Run local integration tests - if: runner.os == 'Linux' + if: runner.os == 'Linux' && matrix.skip-local != true run: cargo xtask integration-test local - name: Run virtualized integration tests - if: runner.os == 'Linux' - run: | - set -euxo pipefail - - # https://github.blog/changelog/2023-02-23-hardware-accelerated-android-virtualization-on-actions-windows-and-linux-larger-hosted-runners/ - echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules - sudo udevadm control --reload-rules - sudo udevadm trigger --name-match=kvm || true # kvm is not available on arm64. - - find test/.tmp -name '*.deb' -print0 | sort -Vz | xargs -t -0 \ - cargo xtask integration-test vm --cache-dir test/.tmp \ - --github-api-token ${{ secrets.GITHUB_TOKEN }} - - - name: Run virtualized integration tests - if: runner.os == 'macOS' - env: - # This sets the linker to the one installed by FiloSottile/musl-cross. - CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER: x86_64-linux-musl-gcc + if: matrix.download-kernel-images != 'local' run: | set -euxo pipefail find test/.tmp -name '*.deb' -print0 | sort -Vz | xargs -t -0 \ From 0484ab5c575de615458d9177b195f0e5a7cd6554 Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Mon, 10 Nov 2025 11:58:45 -0500 Subject: [PATCH 22/46] xtask: use `-cpu host` iff host == guest --- xtask/src/run.rs | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/xtask/src/run.rs b/xtask/src/run.rs index a5da361f..2580f26d 100644 --- a/xtask/src/run.rs +++ b/xtask/src/run.rs @@ -476,8 +476,33 @@ pub(crate) fn run(opts: Options) -> Result<()> { let guest_arch = guest_arch.trim(); let (guest_arch, machine, cpu, console) = match guest_arch { - "ARM64" => ("aarch64", Some("virt"), Some("max"), "ttyAMA0"), - "x86" => ("x86_64", None, Some("host"), "ttyS0"), + "ARM64" => ( + "aarch64", + Some("virt"), + // NB: we'd prefer to write: + // + // ``` + // Some(if cfg!(target_arch = "aarch64") { + // "host" + // } else { + // "max" + // })) + // ``` + // + // but that only works in the presence of KVM or HVF and + // Github arm64 runners do not support nested + // virtualization. Since we aren't doing our own KVM/HVF + // detection (we let QEMU pick the best accelerator), we + // use "max" instead. + Some("max"), + "ttyAMA0", + ), + "x86" => ( + "x86_64", + None, + cfg!(target_arch = "x86_64").then_some("host"), + "ttyS0", + ), guest_arch => (guest_arch, None, None, "ttyS0"), }; From d1f2e99e6a74737448b0183ac96db819241a0392 Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Fri, 7 Nov 2025 05:59:33 -0500 Subject: [PATCH 23/46] xtask: release mode Since a7cfc694bd086d13f608f534774e921d9d501246 we are unpacking dpkg archives in native Rust and since ... we are downloading and unpacking debug archives which are around 10x larger than kernel archives for the same version. Thus build with optimizations so we spend less time in archive extraction. --- .cargo/config.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index 0584e1b4..1ffba3d6 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,5 +1,5 @@ [alias] -xtask = "run --package xtask --" +xtask = "run --release --package xtask --" [target.armv7-unknown-linux-gnueabi] linker = "arm-linux-gnueabi-gcc" From ab38afe95d16226f5a703bbb37c7842ee441c364 Mon Sep 17 00:00:00 2001 From: Friday Ortiz Date: Fri, 10 Oct 2025 18:03:00 +0000 Subject: [PATCH 24/46] perf_event: support hardware breakpoints Implement `PerfEventConfig::Breakpoint`, allowing users to attach hardware breakpoints. Generate `HW_BREAKPOINT_*` and `struct bpf_perf_event_data` in support of this feature and update the type of `PerfEventContext` accordingly. Add a test exercising R, W, RW, and X breakpoints. Note that R breakpoints are unsupported on x86, and this is asserted in the test. Extend the VM integration test harness and supporting infrastructure (e.g. `download_kernel_images.sh`) to download kernel debug packages and mount `System.map` in initramfs. This is needed (at least) on the aarch 6.1 Debian kernel which was not compiled with `CONFIG_KALLSYMS_ALL=y` for some reason, and the locations of globals are not available in kallsyms. To attach breakpoints to these symbols in the test pipeline, we need to read them from System.map and apply the KASLR offset to get their real address. The `System.map` file is not provided in the kernel package by default, so we need to extract it from the corresponding debug package. The KASLR offset is computed using `gunzip` which appears in kallsyms on all Debian kernels tested. Co-authored-by: Tamir Duberstein --- .github/scripts/download_kernel_images.sh | 25 ++ aya-ebpf-macros/src/perf_event.rs | 4 +- aya-obj/include/linux_wrapper.h | 1 + .../src/generated/linux_bindings_aarch64.rs | 124 ++++--- aya-obj/src/generated/linux_bindings_armv7.rs | 124 ++++--- .../generated/linux_bindings_loongarch64.rs | 124 ++++--- aya-obj/src/generated/linux_bindings_mips.rs | 124 ++++--- .../src/generated/linux_bindings_powerpc64.rs | 124 ++++--- .../src/generated/linux_bindings_riscv64.rs | 124 ++++--- aya-obj/src/generated/linux_bindings_s390x.rs | 124 ++++--- .../src/generated/linux_bindings_x86_64.rs | 124 ++++--- aya/src/programs/perf_event.rs | 93 ++++- aya/src/sys/perf_event.rs | 47 ++- ebpf/aya-ebpf-bindings/include/bindings.h | 1 + .../aya-ebpf-bindings/src/aarch64/bindings.rs | 13 +- ebpf/aya-ebpf-bindings/src/armv7/bindings.rs | 13 +- .../src/loongarch64/bindings.rs | 13 +- ebpf/aya-ebpf-bindings/src/mips/bindings.rs | 13 +- .../src/powerpc64/bindings.rs | 13 +- .../aya-ebpf-bindings/src/riscv64/bindings.rs | 13 +- ebpf/aya-ebpf-bindings/src/s390x/bindings.rs | 13 +- ebpf/aya-ebpf-bindings/src/x86_64/bindings.rs | 13 +- ebpf/aya-ebpf/src/programs/perf_event.rs | 8 +- test/integration-ebpf/Cargo.toml | 4 + test/integration-ebpf/src/perf_event_bp.rs | 24 ++ test/integration-test/src/lib.rs | 1 + test/integration-test/src/tests.rs | 1 + .../src/tests/perf_event_bp.rs | 320 ++++++++++++++++++ xtask/public-api/aya-ebpf-bindings.txt | 4 + xtask/public-api/aya-ebpf.txt | 6 +- xtask/public-api/aya-obj.txt | 124 ++++--- xtask/public-api/aya.txt | 119 ++++++- xtask/src/codegen/aya.rs | 3 + xtask/src/run.rs | 166 +++++++-- 34 files changed, 1457 insertions(+), 590 deletions(-) create mode 100644 test/integration-ebpf/src/perf_event_bp.rs create mode 100644 test/integration-test/src/tests/perf_event_bp.rs diff --git a/.github/scripts/download_kernel_images.sh b/.github/scripts/download_kernel_images.sh index da827460..7868953f 100755 --- a/.github/scripts/download_kernel_images.sh +++ b/.github/scripts/download_kernel_images.sh @@ -8,6 +8,12 @@ if [ "$#" -lt 3 ]; then exit 1 fi +escape_regex() { + # Escape characters that have special meaning in extended regular expressions so that + # we can safely interpolate package names into grep patterns. + printf '%s\n' "$1" | sed 's/[][(){}.^$*+?|\\-]/\\&/g' +} + OUTPUT_DIR=$1 ARCHITECTURE=$2 shift 2 @@ -25,6 +31,25 @@ for VERSION in "${VERSIONS[@]}"; do exit 1 } FILES+=("$match") + + # The debug package contains the actual System.map. Debian has transitioned + # between -dbg and -dbgsym suffixes, so match either for the specific kernel + # we just selected. + kernel_basename=$(basename "$match") + kernel_prefix=${kernel_basename%%_*} + kernel_suffix=${kernel_basename#${kernel_prefix}_} + base_prefix=${kernel_prefix%-unsigned} + + base_prefix_regex=$(escape_regex "$base_prefix") + kernel_suffix_regex=$(escape_regex "$kernel_suffix") + + DEBUG_REGEX="${base_prefix_regex}-dbg(sym)?_${kernel_suffix_regex}" + debug_match=$(printf '%s\n' "$URLS" | grep -E "$DEBUG_REGEX" | sort -V | tail -n1) || { + printf 'Failed to locate debug package matching %s\n%s\nVERSION=%s\nREGEX=%s\n' \ + "$kernel_basename" "$URLS" "$VERSION" "$DEBUG_REGEX" >&2 + exit 1 + } + FILES+=("$debug_match") done # Note: `--etag-{compare,save}` are not idempotent until curl 8.9.0 which included diff --git a/aya-ebpf-macros/src/perf_event.rs b/aya-ebpf-macros/src/perf_event.rs index 6b693f5a..1575495a 100644 --- a/aya-ebpf-macros/src/perf_event.rs +++ b/aya-ebpf-macros/src/perf_event.rs @@ -29,7 +29,7 @@ impl PerfEvent { #[unsafe(no_mangle)] #[unsafe(link_section = "perf_event")] #vis fn #fn_name(ctx: *mut ::core::ffi::c_void) -> u32 { - let _ = #fn_name(::aya_ebpf::programs::PerfEventContext::new(ctx)); + let _ = #fn_name(::aya_ebpf::programs::PerfEventContext::new(ctx.cast())); return 0; #item @@ -60,7 +60,7 @@ mod tests { #[unsafe(no_mangle)] #[unsafe(link_section = "perf_event")] fn foo(ctx: *mut ::core::ffi::c_void) -> u32 { - let _ = foo(::aya_ebpf::programs::PerfEventContext::new(ctx)); + let _ = foo(::aya_ebpf::programs::PerfEventContext::new(ctx.cast())); return 0; fn foo(ctx: PerfEventContext) -> i32 { diff --git a/aya-obj/include/linux_wrapper.h b/aya-obj/include/linux_wrapper.h index fe9498f8..9123cf02 100644 --- a/aya-obj/include/linux_wrapper.h +++ b/aya-obj/include/linux_wrapper.h @@ -1,5 +1,6 @@ #include #include +#include #include #include #include diff --git a/aya-obj/src/generated/linux_bindings_aarch64.rs b/aya-obj/src/generated/linux_bindings_aarch64.rs index b76ed850..aff50e13 100644 --- a/aya-obj/src/generated/linux_bindings_aarch64.rs +++ b/aya-obj/src/generated/linux_bindings_aarch64.rs @@ -2105,6 +2105,22 @@ pub struct btf_var_secinfo { pub struct btf_decl_tag { pub component_idx: __s32, } +pub const HW_BREAKPOINT_LEN_1: _bindgen_ty_44 = 1; +pub const HW_BREAKPOINT_LEN_2: _bindgen_ty_44 = 2; +pub const HW_BREAKPOINT_LEN_3: _bindgen_ty_44 = 3; +pub const HW_BREAKPOINT_LEN_4: _bindgen_ty_44 = 4; +pub const HW_BREAKPOINT_LEN_5: _bindgen_ty_44 = 5; +pub const HW_BREAKPOINT_LEN_6: _bindgen_ty_44 = 6; +pub const HW_BREAKPOINT_LEN_7: _bindgen_ty_44 = 7; +pub const HW_BREAKPOINT_LEN_8: _bindgen_ty_44 = 8; +pub type _bindgen_ty_44 = ::core::ffi::c_uint; +pub const HW_BREAKPOINT_EMPTY: _bindgen_ty_45 = 0; +pub const HW_BREAKPOINT_R: _bindgen_ty_45 = 1; +pub const HW_BREAKPOINT_W: _bindgen_ty_45 = 2; +pub const HW_BREAKPOINT_RW: _bindgen_ty_45 = 3; +pub const HW_BREAKPOINT_X: _bindgen_ty_45 = 4; +pub const HW_BREAKPOINT_INVALID: _bindgen_ty_45 = 7; +pub type _bindgen_ty_45 = ::core::ffi::c_uint; impl nlmsgerr_attrs { pub const NLMSGERR_ATTR_MAX: nlmsgerr_attrs = nlmsgerr_attrs::NLMSGERR_ATTR_COOKIE; } @@ -2117,17 +2133,17 @@ pub enum nlmsgerr_attrs { NLMSGERR_ATTR_COOKIE = 3, __NLMSGERR_ATTR_MAX = 4, } -pub const IFLA_XDP_UNSPEC: _bindgen_ty_92 = 0; -pub const IFLA_XDP_FD: _bindgen_ty_92 = 1; -pub const IFLA_XDP_ATTACHED: _bindgen_ty_92 = 2; -pub const IFLA_XDP_FLAGS: _bindgen_ty_92 = 3; -pub const IFLA_XDP_PROG_ID: _bindgen_ty_92 = 4; -pub const IFLA_XDP_DRV_PROG_ID: _bindgen_ty_92 = 5; -pub const IFLA_XDP_SKB_PROG_ID: _bindgen_ty_92 = 6; -pub const IFLA_XDP_HW_PROG_ID: _bindgen_ty_92 = 7; -pub const IFLA_XDP_EXPECTED_FD: _bindgen_ty_92 = 8; -pub const __IFLA_XDP_MAX: _bindgen_ty_92 = 9; -pub type _bindgen_ty_92 = ::core::ffi::c_uint; +pub const IFLA_XDP_UNSPEC: _bindgen_ty_94 = 0; +pub const IFLA_XDP_FD: _bindgen_ty_94 = 1; +pub const IFLA_XDP_ATTACHED: _bindgen_ty_94 = 2; +pub const IFLA_XDP_FLAGS: _bindgen_ty_94 = 3; +pub const IFLA_XDP_PROG_ID: _bindgen_ty_94 = 4; +pub const IFLA_XDP_DRV_PROG_ID: _bindgen_ty_94 = 5; +pub const IFLA_XDP_SKB_PROG_ID: _bindgen_ty_94 = 6; +pub const IFLA_XDP_HW_PROG_ID: _bindgen_ty_94 = 7; +pub const IFLA_XDP_EXPECTED_FD: _bindgen_ty_94 = 8; +pub const __IFLA_XDP_MAX: _bindgen_ty_94 = 9; +pub type _bindgen_ty_94 = ::core::ffi::c_uint; impl nf_inet_hooks { pub const NF_INET_INGRESS: nf_inet_hooks = nf_inet_hooks::NF_INET_NUMHOOKS; } @@ -2141,16 +2157,16 @@ pub enum nf_inet_hooks { NF_INET_POST_ROUTING = 4, NF_INET_NUMHOOKS = 5, } -pub const NFPROTO_UNSPEC: _bindgen_ty_99 = 0; -pub const NFPROTO_INET: _bindgen_ty_99 = 1; -pub const NFPROTO_IPV4: _bindgen_ty_99 = 2; -pub const NFPROTO_ARP: _bindgen_ty_99 = 3; -pub const NFPROTO_NETDEV: _bindgen_ty_99 = 5; -pub const NFPROTO_BRIDGE: _bindgen_ty_99 = 7; -pub const NFPROTO_IPV6: _bindgen_ty_99 = 10; -pub const NFPROTO_DECNET: _bindgen_ty_99 = 12; -pub const NFPROTO_NUMPROTO: _bindgen_ty_99 = 13; -pub type _bindgen_ty_99 = ::core::ffi::c_uint; +pub const NFPROTO_UNSPEC: _bindgen_ty_101 = 0; +pub const NFPROTO_INET: _bindgen_ty_101 = 1; +pub const NFPROTO_IPV4: _bindgen_ty_101 = 2; +pub const NFPROTO_ARP: _bindgen_ty_101 = 3; +pub const NFPROTO_NETDEV: _bindgen_ty_101 = 5; +pub const NFPROTO_BRIDGE: _bindgen_ty_101 = 7; +pub const NFPROTO_IPV6: _bindgen_ty_101 = 10; +pub const NFPROTO_DECNET: _bindgen_ty_101 = 12; +pub const NFPROTO_NUMPROTO: _bindgen_ty_101 = 13; +pub type _bindgen_ty_101 = ::core::ffi::c_uint; #[repr(u32)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub enum perf_type_id { @@ -4111,20 +4127,20 @@ pub enum perf_event_type { PERF_RECORD_AUX_OUTPUT_HW_ID = 21, PERF_RECORD_MAX = 22, } -pub const TCA_BPF_UNSPEC: _bindgen_ty_154 = 0; -pub const TCA_BPF_ACT: _bindgen_ty_154 = 1; -pub const TCA_BPF_POLICE: _bindgen_ty_154 = 2; -pub const TCA_BPF_CLASSID: _bindgen_ty_154 = 3; -pub const TCA_BPF_OPS_LEN: _bindgen_ty_154 = 4; -pub const TCA_BPF_OPS: _bindgen_ty_154 = 5; -pub const TCA_BPF_FD: _bindgen_ty_154 = 6; -pub const TCA_BPF_NAME: _bindgen_ty_154 = 7; -pub const TCA_BPF_FLAGS: _bindgen_ty_154 = 8; -pub const TCA_BPF_FLAGS_GEN: _bindgen_ty_154 = 9; -pub const TCA_BPF_TAG: _bindgen_ty_154 = 10; -pub const TCA_BPF_ID: _bindgen_ty_154 = 11; -pub const __TCA_BPF_MAX: _bindgen_ty_154 = 12; -pub type _bindgen_ty_154 = ::core::ffi::c_uint; +pub const TCA_BPF_UNSPEC: _bindgen_ty_156 = 0; +pub const TCA_BPF_ACT: _bindgen_ty_156 = 1; +pub const TCA_BPF_POLICE: _bindgen_ty_156 = 2; +pub const TCA_BPF_CLASSID: _bindgen_ty_156 = 3; +pub const TCA_BPF_OPS_LEN: _bindgen_ty_156 = 4; +pub const TCA_BPF_OPS: _bindgen_ty_156 = 5; +pub const TCA_BPF_FD: _bindgen_ty_156 = 6; +pub const TCA_BPF_NAME: _bindgen_ty_156 = 7; +pub const TCA_BPF_FLAGS: _bindgen_ty_156 = 8; +pub const TCA_BPF_FLAGS_GEN: _bindgen_ty_156 = 9; +pub const TCA_BPF_TAG: _bindgen_ty_156 = 10; +pub const TCA_BPF_ID: _bindgen_ty_156 = 11; +pub const __TCA_BPF_MAX: _bindgen_ty_156 = 12; +pub type _bindgen_ty_156 = ::core::ffi::c_uint; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct ifinfomsg { @@ -4146,22 +4162,22 @@ pub struct tcmsg { pub tcm_parent: __u32, pub tcm_info: __u32, } -pub const TCA_UNSPEC: _bindgen_ty_174 = 0; -pub const TCA_KIND: _bindgen_ty_174 = 1; -pub const TCA_OPTIONS: _bindgen_ty_174 = 2; -pub const TCA_STATS: _bindgen_ty_174 = 3; -pub const TCA_XSTATS: _bindgen_ty_174 = 4; -pub const TCA_RATE: _bindgen_ty_174 = 5; -pub const TCA_FCNT: _bindgen_ty_174 = 6; -pub const TCA_STATS2: _bindgen_ty_174 = 7; -pub const TCA_STAB: _bindgen_ty_174 = 8; -pub const TCA_PAD: _bindgen_ty_174 = 9; -pub const TCA_DUMP_INVISIBLE: _bindgen_ty_174 = 10; -pub const TCA_CHAIN: _bindgen_ty_174 = 11; -pub const TCA_HW_OFFLOAD: _bindgen_ty_174 = 12; -pub const TCA_INGRESS_BLOCK: _bindgen_ty_174 = 13; -pub const TCA_EGRESS_BLOCK: _bindgen_ty_174 = 14; -pub const TCA_DUMP_FLAGS: _bindgen_ty_174 = 15; -pub const TCA_EXT_WARN_MSG: _bindgen_ty_174 = 16; -pub const __TCA_MAX: _bindgen_ty_174 = 17; -pub type _bindgen_ty_174 = ::core::ffi::c_uint; +pub const TCA_UNSPEC: _bindgen_ty_176 = 0; +pub const TCA_KIND: _bindgen_ty_176 = 1; +pub const TCA_OPTIONS: _bindgen_ty_176 = 2; +pub const TCA_STATS: _bindgen_ty_176 = 3; +pub const TCA_XSTATS: _bindgen_ty_176 = 4; +pub const TCA_RATE: _bindgen_ty_176 = 5; +pub const TCA_FCNT: _bindgen_ty_176 = 6; +pub const TCA_STATS2: _bindgen_ty_176 = 7; +pub const TCA_STAB: _bindgen_ty_176 = 8; +pub const TCA_PAD: _bindgen_ty_176 = 9; +pub const TCA_DUMP_INVISIBLE: _bindgen_ty_176 = 10; +pub const TCA_CHAIN: _bindgen_ty_176 = 11; +pub const TCA_HW_OFFLOAD: _bindgen_ty_176 = 12; +pub const TCA_INGRESS_BLOCK: _bindgen_ty_176 = 13; +pub const TCA_EGRESS_BLOCK: _bindgen_ty_176 = 14; +pub const TCA_DUMP_FLAGS: _bindgen_ty_176 = 15; +pub const TCA_EXT_WARN_MSG: _bindgen_ty_176 = 16; +pub const __TCA_MAX: _bindgen_ty_176 = 17; +pub type _bindgen_ty_176 = ::core::ffi::c_uint; diff --git a/aya-obj/src/generated/linux_bindings_armv7.rs b/aya-obj/src/generated/linux_bindings_armv7.rs index 08b3a162..ae0a1da4 100644 --- a/aya-obj/src/generated/linux_bindings_armv7.rs +++ b/aya-obj/src/generated/linux_bindings_armv7.rs @@ -2105,6 +2105,22 @@ pub struct btf_var_secinfo { pub struct btf_decl_tag { pub component_idx: __s32, } +pub const HW_BREAKPOINT_LEN_1: _bindgen_ty_44 = 1; +pub const HW_BREAKPOINT_LEN_2: _bindgen_ty_44 = 2; +pub const HW_BREAKPOINT_LEN_3: _bindgen_ty_44 = 3; +pub const HW_BREAKPOINT_LEN_4: _bindgen_ty_44 = 4; +pub const HW_BREAKPOINT_LEN_5: _bindgen_ty_44 = 5; +pub const HW_BREAKPOINT_LEN_6: _bindgen_ty_44 = 6; +pub const HW_BREAKPOINT_LEN_7: _bindgen_ty_44 = 7; +pub const HW_BREAKPOINT_LEN_8: _bindgen_ty_44 = 8; +pub type _bindgen_ty_44 = ::core::ffi::c_uint; +pub const HW_BREAKPOINT_EMPTY: _bindgen_ty_45 = 0; +pub const HW_BREAKPOINT_R: _bindgen_ty_45 = 1; +pub const HW_BREAKPOINT_W: _bindgen_ty_45 = 2; +pub const HW_BREAKPOINT_RW: _bindgen_ty_45 = 3; +pub const HW_BREAKPOINT_X: _bindgen_ty_45 = 4; +pub const HW_BREAKPOINT_INVALID: _bindgen_ty_45 = 7; +pub type _bindgen_ty_45 = ::core::ffi::c_uint; impl nlmsgerr_attrs { pub const NLMSGERR_ATTR_MAX: nlmsgerr_attrs = nlmsgerr_attrs::NLMSGERR_ATTR_COOKIE; } @@ -2117,17 +2133,17 @@ pub enum nlmsgerr_attrs { NLMSGERR_ATTR_COOKIE = 3, __NLMSGERR_ATTR_MAX = 4, } -pub const IFLA_XDP_UNSPEC: _bindgen_ty_92 = 0; -pub const IFLA_XDP_FD: _bindgen_ty_92 = 1; -pub const IFLA_XDP_ATTACHED: _bindgen_ty_92 = 2; -pub const IFLA_XDP_FLAGS: _bindgen_ty_92 = 3; -pub const IFLA_XDP_PROG_ID: _bindgen_ty_92 = 4; -pub const IFLA_XDP_DRV_PROG_ID: _bindgen_ty_92 = 5; -pub const IFLA_XDP_SKB_PROG_ID: _bindgen_ty_92 = 6; -pub const IFLA_XDP_HW_PROG_ID: _bindgen_ty_92 = 7; -pub const IFLA_XDP_EXPECTED_FD: _bindgen_ty_92 = 8; -pub const __IFLA_XDP_MAX: _bindgen_ty_92 = 9; -pub type _bindgen_ty_92 = ::core::ffi::c_uint; +pub const IFLA_XDP_UNSPEC: _bindgen_ty_94 = 0; +pub const IFLA_XDP_FD: _bindgen_ty_94 = 1; +pub const IFLA_XDP_ATTACHED: _bindgen_ty_94 = 2; +pub const IFLA_XDP_FLAGS: _bindgen_ty_94 = 3; +pub const IFLA_XDP_PROG_ID: _bindgen_ty_94 = 4; +pub const IFLA_XDP_DRV_PROG_ID: _bindgen_ty_94 = 5; +pub const IFLA_XDP_SKB_PROG_ID: _bindgen_ty_94 = 6; +pub const IFLA_XDP_HW_PROG_ID: _bindgen_ty_94 = 7; +pub const IFLA_XDP_EXPECTED_FD: _bindgen_ty_94 = 8; +pub const __IFLA_XDP_MAX: _bindgen_ty_94 = 9; +pub type _bindgen_ty_94 = ::core::ffi::c_uint; impl nf_inet_hooks { pub const NF_INET_INGRESS: nf_inet_hooks = nf_inet_hooks::NF_INET_NUMHOOKS; } @@ -2141,16 +2157,16 @@ pub enum nf_inet_hooks { NF_INET_POST_ROUTING = 4, NF_INET_NUMHOOKS = 5, } -pub const NFPROTO_UNSPEC: _bindgen_ty_99 = 0; -pub const NFPROTO_INET: _bindgen_ty_99 = 1; -pub const NFPROTO_IPV4: _bindgen_ty_99 = 2; -pub const NFPROTO_ARP: _bindgen_ty_99 = 3; -pub const NFPROTO_NETDEV: _bindgen_ty_99 = 5; -pub const NFPROTO_BRIDGE: _bindgen_ty_99 = 7; -pub const NFPROTO_IPV6: _bindgen_ty_99 = 10; -pub const NFPROTO_DECNET: _bindgen_ty_99 = 12; -pub const NFPROTO_NUMPROTO: _bindgen_ty_99 = 13; -pub type _bindgen_ty_99 = ::core::ffi::c_uint; +pub const NFPROTO_UNSPEC: _bindgen_ty_101 = 0; +pub const NFPROTO_INET: _bindgen_ty_101 = 1; +pub const NFPROTO_IPV4: _bindgen_ty_101 = 2; +pub const NFPROTO_ARP: _bindgen_ty_101 = 3; +pub const NFPROTO_NETDEV: _bindgen_ty_101 = 5; +pub const NFPROTO_BRIDGE: _bindgen_ty_101 = 7; +pub const NFPROTO_IPV6: _bindgen_ty_101 = 10; +pub const NFPROTO_DECNET: _bindgen_ty_101 = 12; +pub const NFPROTO_NUMPROTO: _bindgen_ty_101 = 13; +pub type _bindgen_ty_101 = ::core::ffi::c_uint; #[repr(u32)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub enum perf_type_id { @@ -4111,20 +4127,20 @@ pub enum perf_event_type { PERF_RECORD_AUX_OUTPUT_HW_ID = 21, PERF_RECORD_MAX = 22, } -pub const TCA_BPF_UNSPEC: _bindgen_ty_154 = 0; -pub const TCA_BPF_ACT: _bindgen_ty_154 = 1; -pub const TCA_BPF_POLICE: _bindgen_ty_154 = 2; -pub const TCA_BPF_CLASSID: _bindgen_ty_154 = 3; -pub const TCA_BPF_OPS_LEN: _bindgen_ty_154 = 4; -pub const TCA_BPF_OPS: _bindgen_ty_154 = 5; -pub const TCA_BPF_FD: _bindgen_ty_154 = 6; -pub const TCA_BPF_NAME: _bindgen_ty_154 = 7; -pub const TCA_BPF_FLAGS: _bindgen_ty_154 = 8; -pub const TCA_BPF_FLAGS_GEN: _bindgen_ty_154 = 9; -pub const TCA_BPF_TAG: _bindgen_ty_154 = 10; -pub const TCA_BPF_ID: _bindgen_ty_154 = 11; -pub const __TCA_BPF_MAX: _bindgen_ty_154 = 12; -pub type _bindgen_ty_154 = ::core::ffi::c_uint; +pub const TCA_BPF_UNSPEC: _bindgen_ty_156 = 0; +pub const TCA_BPF_ACT: _bindgen_ty_156 = 1; +pub const TCA_BPF_POLICE: _bindgen_ty_156 = 2; +pub const TCA_BPF_CLASSID: _bindgen_ty_156 = 3; +pub const TCA_BPF_OPS_LEN: _bindgen_ty_156 = 4; +pub const TCA_BPF_OPS: _bindgen_ty_156 = 5; +pub const TCA_BPF_FD: _bindgen_ty_156 = 6; +pub const TCA_BPF_NAME: _bindgen_ty_156 = 7; +pub const TCA_BPF_FLAGS: _bindgen_ty_156 = 8; +pub const TCA_BPF_FLAGS_GEN: _bindgen_ty_156 = 9; +pub const TCA_BPF_TAG: _bindgen_ty_156 = 10; +pub const TCA_BPF_ID: _bindgen_ty_156 = 11; +pub const __TCA_BPF_MAX: _bindgen_ty_156 = 12; +pub type _bindgen_ty_156 = ::core::ffi::c_uint; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct ifinfomsg { @@ -4146,22 +4162,22 @@ pub struct tcmsg { pub tcm_parent: __u32, pub tcm_info: __u32, } -pub const TCA_UNSPEC: _bindgen_ty_174 = 0; -pub const TCA_KIND: _bindgen_ty_174 = 1; -pub const TCA_OPTIONS: _bindgen_ty_174 = 2; -pub const TCA_STATS: _bindgen_ty_174 = 3; -pub const TCA_XSTATS: _bindgen_ty_174 = 4; -pub const TCA_RATE: _bindgen_ty_174 = 5; -pub const TCA_FCNT: _bindgen_ty_174 = 6; -pub const TCA_STATS2: _bindgen_ty_174 = 7; -pub const TCA_STAB: _bindgen_ty_174 = 8; -pub const TCA_PAD: _bindgen_ty_174 = 9; -pub const TCA_DUMP_INVISIBLE: _bindgen_ty_174 = 10; -pub const TCA_CHAIN: _bindgen_ty_174 = 11; -pub const TCA_HW_OFFLOAD: _bindgen_ty_174 = 12; -pub const TCA_INGRESS_BLOCK: _bindgen_ty_174 = 13; -pub const TCA_EGRESS_BLOCK: _bindgen_ty_174 = 14; -pub const TCA_DUMP_FLAGS: _bindgen_ty_174 = 15; -pub const TCA_EXT_WARN_MSG: _bindgen_ty_174 = 16; -pub const __TCA_MAX: _bindgen_ty_174 = 17; -pub type _bindgen_ty_174 = ::core::ffi::c_uint; +pub const TCA_UNSPEC: _bindgen_ty_176 = 0; +pub const TCA_KIND: _bindgen_ty_176 = 1; +pub const TCA_OPTIONS: _bindgen_ty_176 = 2; +pub const TCA_STATS: _bindgen_ty_176 = 3; +pub const TCA_XSTATS: _bindgen_ty_176 = 4; +pub const TCA_RATE: _bindgen_ty_176 = 5; +pub const TCA_FCNT: _bindgen_ty_176 = 6; +pub const TCA_STATS2: _bindgen_ty_176 = 7; +pub const TCA_STAB: _bindgen_ty_176 = 8; +pub const TCA_PAD: _bindgen_ty_176 = 9; +pub const TCA_DUMP_INVISIBLE: _bindgen_ty_176 = 10; +pub const TCA_CHAIN: _bindgen_ty_176 = 11; +pub const TCA_HW_OFFLOAD: _bindgen_ty_176 = 12; +pub const TCA_INGRESS_BLOCK: _bindgen_ty_176 = 13; +pub const TCA_EGRESS_BLOCK: _bindgen_ty_176 = 14; +pub const TCA_DUMP_FLAGS: _bindgen_ty_176 = 15; +pub const TCA_EXT_WARN_MSG: _bindgen_ty_176 = 16; +pub const __TCA_MAX: _bindgen_ty_176 = 17; +pub type _bindgen_ty_176 = ::core::ffi::c_uint; diff --git a/aya-obj/src/generated/linux_bindings_loongarch64.rs b/aya-obj/src/generated/linux_bindings_loongarch64.rs index b76ed850..aff50e13 100644 --- a/aya-obj/src/generated/linux_bindings_loongarch64.rs +++ b/aya-obj/src/generated/linux_bindings_loongarch64.rs @@ -2105,6 +2105,22 @@ pub struct btf_var_secinfo { pub struct btf_decl_tag { pub component_idx: __s32, } +pub const HW_BREAKPOINT_LEN_1: _bindgen_ty_44 = 1; +pub const HW_BREAKPOINT_LEN_2: _bindgen_ty_44 = 2; +pub const HW_BREAKPOINT_LEN_3: _bindgen_ty_44 = 3; +pub const HW_BREAKPOINT_LEN_4: _bindgen_ty_44 = 4; +pub const HW_BREAKPOINT_LEN_5: _bindgen_ty_44 = 5; +pub const HW_BREAKPOINT_LEN_6: _bindgen_ty_44 = 6; +pub const HW_BREAKPOINT_LEN_7: _bindgen_ty_44 = 7; +pub const HW_BREAKPOINT_LEN_8: _bindgen_ty_44 = 8; +pub type _bindgen_ty_44 = ::core::ffi::c_uint; +pub const HW_BREAKPOINT_EMPTY: _bindgen_ty_45 = 0; +pub const HW_BREAKPOINT_R: _bindgen_ty_45 = 1; +pub const HW_BREAKPOINT_W: _bindgen_ty_45 = 2; +pub const HW_BREAKPOINT_RW: _bindgen_ty_45 = 3; +pub const HW_BREAKPOINT_X: _bindgen_ty_45 = 4; +pub const HW_BREAKPOINT_INVALID: _bindgen_ty_45 = 7; +pub type _bindgen_ty_45 = ::core::ffi::c_uint; impl nlmsgerr_attrs { pub const NLMSGERR_ATTR_MAX: nlmsgerr_attrs = nlmsgerr_attrs::NLMSGERR_ATTR_COOKIE; } @@ -2117,17 +2133,17 @@ pub enum nlmsgerr_attrs { NLMSGERR_ATTR_COOKIE = 3, __NLMSGERR_ATTR_MAX = 4, } -pub const IFLA_XDP_UNSPEC: _bindgen_ty_92 = 0; -pub const IFLA_XDP_FD: _bindgen_ty_92 = 1; -pub const IFLA_XDP_ATTACHED: _bindgen_ty_92 = 2; -pub const IFLA_XDP_FLAGS: _bindgen_ty_92 = 3; -pub const IFLA_XDP_PROG_ID: _bindgen_ty_92 = 4; -pub const IFLA_XDP_DRV_PROG_ID: _bindgen_ty_92 = 5; -pub const IFLA_XDP_SKB_PROG_ID: _bindgen_ty_92 = 6; -pub const IFLA_XDP_HW_PROG_ID: _bindgen_ty_92 = 7; -pub const IFLA_XDP_EXPECTED_FD: _bindgen_ty_92 = 8; -pub const __IFLA_XDP_MAX: _bindgen_ty_92 = 9; -pub type _bindgen_ty_92 = ::core::ffi::c_uint; +pub const IFLA_XDP_UNSPEC: _bindgen_ty_94 = 0; +pub const IFLA_XDP_FD: _bindgen_ty_94 = 1; +pub const IFLA_XDP_ATTACHED: _bindgen_ty_94 = 2; +pub const IFLA_XDP_FLAGS: _bindgen_ty_94 = 3; +pub const IFLA_XDP_PROG_ID: _bindgen_ty_94 = 4; +pub const IFLA_XDP_DRV_PROG_ID: _bindgen_ty_94 = 5; +pub const IFLA_XDP_SKB_PROG_ID: _bindgen_ty_94 = 6; +pub const IFLA_XDP_HW_PROG_ID: _bindgen_ty_94 = 7; +pub const IFLA_XDP_EXPECTED_FD: _bindgen_ty_94 = 8; +pub const __IFLA_XDP_MAX: _bindgen_ty_94 = 9; +pub type _bindgen_ty_94 = ::core::ffi::c_uint; impl nf_inet_hooks { pub const NF_INET_INGRESS: nf_inet_hooks = nf_inet_hooks::NF_INET_NUMHOOKS; } @@ -2141,16 +2157,16 @@ pub enum nf_inet_hooks { NF_INET_POST_ROUTING = 4, NF_INET_NUMHOOKS = 5, } -pub const NFPROTO_UNSPEC: _bindgen_ty_99 = 0; -pub const NFPROTO_INET: _bindgen_ty_99 = 1; -pub const NFPROTO_IPV4: _bindgen_ty_99 = 2; -pub const NFPROTO_ARP: _bindgen_ty_99 = 3; -pub const NFPROTO_NETDEV: _bindgen_ty_99 = 5; -pub const NFPROTO_BRIDGE: _bindgen_ty_99 = 7; -pub const NFPROTO_IPV6: _bindgen_ty_99 = 10; -pub const NFPROTO_DECNET: _bindgen_ty_99 = 12; -pub const NFPROTO_NUMPROTO: _bindgen_ty_99 = 13; -pub type _bindgen_ty_99 = ::core::ffi::c_uint; +pub const NFPROTO_UNSPEC: _bindgen_ty_101 = 0; +pub const NFPROTO_INET: _bindgen_ty_101 = 1; +pub const NFPROTO_IPV4: _bindgen_ty_101 = 2; +pub const NFPROTO_ARP: _bindgen_ty_101 = 3; +pub const NFPROTO_NETDEV: _bindgen_ty_101 = 5; +pub const NFPROTO_BRIDGE: _bindgen_ty_101 = 7; +pub const NFPROTO_IPV6: _bindgen_ty_101 = 10; +pub const NFPROTO_DECNET: _bindgen_ty_101 = 12; +pub const NFPROTO_NUMPROTO: _bindgen_ty_101 = 13; +pub type _bindgen_ty_101 = ::core::ffi::c_uint; #[repr(u32)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub enum perf_type_id { @@ -4111,20 +4127,20 @@ pub enum perf_event_type { PERF_RECORD_AUX_OUTPUT_HW_ID = 21, PERF_RECORD_MAX = 22, } -pub const TCA_BPF_UNSPEC: _bindgen_ty_154 = 0; -pub const TCA_BPF_ACT: _bindgen_ty_154 = 1; -pub const TCA_BPF_POLICE: _bindgen_ty_154 = 2; -pub const TCA_BPF_CLASSID: _bindgen_ty_154 = 3; -pub const TCA_BPF_OPS_LEN: _bindgen_ty_154 = 4; -pub const TCA_BPF_OPS: _bindgen_ty_154 = 5; -pub const TCA_BPF_FD: _bindgen_ty_154 = 6; -pub const TCA_BPF_NAME: _bindgen_ty_154 = 7; -pub const TCA_BPF_FLAGS: _bindgen_ty_154 = 8; -pub const TCA_BPF_FLAGS_GEN: _bindgen_ty_154 = 9; -pub const TCA_BPF_TAG: _bindgen_ty_154 = 10; -pub const TCA_BPF_ID: _bindgen_ty_154 = 11; -pub const __TCA_BPF_MAX: _bindgen_ty_154 = 12; -pub type _bindgen_ty_154 = ::core::ffi::c_uint; +pub const TCA_BPF_UNSPEC: _bindgen_ty_156 = 0; +pub const TCA_BPF_ACT: _bindgen_ty_156 = 1; +pub const TCA_BPF_POLICE: _bindgen_ty_156 = 2; +pub const TCA_BPF_CLASSID: _bindgen_ty_156 = 3; +pub const TCA_BPF_OPS_LEN: _bindgen_ty_156 = 4; +pub const TCA_BPF_OPS: _bindgen_ty_156 = 5; +pub const TCA_BPF_FD: _bindgen_ty_156 = 6; +pub const TCA_BPF_NAME: _bindgen_ty_156 = 7; +pub const TCA_BPF_FLAGS: _bindgen_ty_156 = 8; +pub const TCA_BPF_FLAGS_GEN: _bindgen_ty_156 = 9; +pub const TCA_BPF_TAG: _bindgen_ty_156 = 10; +pub const TCA_BPF_ID: _bindgen_ty_156 = 11; +pub const __TCA_BPF_MAX: _bindgen_ty_156 = 12; +pub type _bindgen_ty_156 = ::core::ffi::c_uint; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct ifinfomsg { @@ -4146,22 +4162,22 @@ pub struct tcmsg { pub tcm_parent: __u32, pub tcm_info: __u32, } -pub const TCA_UNSPEC: _bindgen_ty_174 = 0; -pub const TCA_KIND: _bindgen_ty_174 = 1; -pub const TCA_OPTIONS: _bindgen_ty_174 = 2; -pub const TCA_STATS: _bindgen_ty_174 = 3; -pub const TCA_XSTATS: _bindgen_ty_174 = 4; -pub const TCA_RATE: _bindgen_ty_174 = 5; -pub const TCA_FCNT: _bindgen_ty_174 = 6; -pub const TCA_STATS2: _bindgen_ty_174 = 7; -pub const TCA_STAB: _bindgen_ty_174 = 8; -pub const TCA_PAD: _bindgen_ty_174 = 9; -pub const TCA_DUMP_INVISIBLE: _bindgen_ty_174 = 10; -pub const TCA_CHAIN: _bindgen_ty_174 = 11; -pub const TCA_HW_OFFLOAD: _bindgen_ty_174 = 12; -pub const TCA_INGRESS_BLOCK: _bindgen_ty_174 = 13; -pub const TCA_EGRESS_BLOCK: _bindgen_ty_174 = 14; -pub const TCA_DUMP_FLAGS: _bindgen_ty_174 = 15; -pub const TCA_EXT_WARN_MSG: _bindgen_ty_174 = 16; -pub const __TCA_MAX: _bindgen_ty_174 = 17; -pub type _bindgen_ty_174 = ::core::ffi::c_uint; +pub const TCA_UNSPEC: _bindgen_ty_176 = 0; +pub const TCA_KIND: _bindgen_ty_176 = 1; +pub const TCA_OPTIONS: _bindgen_ty_176 = 2; +pub const TCA_STATS: _bindgen_ty_176 = 3; +pub const TCA_XSTATS: _bindgen_ty_176 = 4; +pub const TCA_RATE: _bindgen_ty_176 = 5; +pub const TCA_FCNT: _bindgen_ty_176 = 6; +pub const TCA_STATS2: _bindgen_ty_176 = 7; +pub const TCA_STAB: _bindgen_ty_176 = 8; +pub const TCA_PAD: _bindgen_ty_176 = 9; +pub const TCA_DUMP_INVISIBLE: _bindgen_ty_176 = 10; +pub const TCA_CHAIN: _bindgen_ty_176 = 11; +pub const TCA_HW_OFFLOAD: _bindgen_ty_176 = 12; +pub const TCA_INGRESS_BLOCK: _bindgen_ty_176 = 13; +pub const TCA_EGRESS_BLOCK: _bindgen_ty_176 = 14; +pub const TCA_DUMP_FLAGS: _bindgen_ty_176 = 15; +pub const TCA_EXT_WARN_MSG: _bindgen_ty_176 = 16; +pub const __TCA_MAX: _bindgen_ty_176 = 17; +pub type _bindgen_ty_176 = ::core::ffi::c_uint; diff --git a/aya-obj/src/generated/linux_bindings_mips.rs b/aya-obj/src/generated/linux_bindings_mips.rs index 349653d7..f3ae9b95 100644 --- a/aya-obj/src/generated/linux_bindings_mips.rs +++ b/aya-obj/src/generated/linux_bindings_mips.rs @@ -2105,6 +2105,22 @@ pub struct btf_var_secinfo { pub struct btf_decl_tag { pub component_idx: __s32, } +pub const HW_BREAKPOINT_LEN_1: _bindgen_ty_44 = 1; +pub const HW_BREAKPOINT_LEN_2: _bindgen_ty_44 = 2; +pub const HW_BREAKPOINT_LEN_3: _bindgen_ty_44 = 3; +pub const HW_BREAKPOINT_LEN_4: _bindgen_ty_44 = 4; +pub const HW_BREAKPOINT_LEN_5: _bindgen_ty_44 = 5; +pub const HW_BREAKPOINT_LEN_6: _bindgen_ty_44 = 6; +pub const HW_BREAKPOINT_LEN_7: _bindgen_ty_44 = 7; +pub const HW_BREAKPOINT_LEN_8: _bindgen_ty_44 = 8; +pub type _bindgen_ty_44 = ::core::ffi::c_uint; +pub const HW_BREAKPOINT_EMPTY: _bindgen_ty_45 = 0; +pub const HW_BREAKPOINT_R: _bindgen_ty_45 = 1; +pub const HW_BREAKPOINT_W: _bindgen_ty_45 = 2; +pub const HW_BREAKPOINT_RW: _bindgen_ty_45 = 3; +pub const HW_BREAKPOINT_X: _bindgen_ty_45 = 4; +pub const HW_BREAKPOINT_INVALID: _bindgen_ty_45 = 7; +pub type _bindgen_ty_45 = ::core::ffi::c_uint; impl nlmsgerr_attrs { pub const NLMSGERR_ATTR_MAX: nlmsgerr_attrs = nlmsgerr_attrs::NLMSGERR_ATTR_COOKIE; } @@ -2117,17 +2133,17 @@ pub enum nlmsgerr_attrs { NLMSGERR_ATTR_COOKIE = 3, __NLMSGERR_ATTR_MAX = 4, } -pub const IFLA_XDP_UNSPEC: _bindgen_ty_92 = 0; -pub const IFLA_XDP_FD: _bindgen_ty_92 = 1; -pub const IFLA_XDP_ATTACHED: _bindgen_ty_92 = 2; -pub const IFLA_XDP_FLAGS: _bindgen_ty_92 = 3; -pub const IFLA_XDP_PROG_ID: _bindgen_ty_92 = 4; -pub const IFLA_XDP_DRV_PROG_ID: _bindgen_ty_92 = 5; -pub const IFLA_XDP_SKB_PROG_ID: _bindgen_ty_92 = 6; -pub const IFLA_XDP_HW_PROG_ID: _bindgen_ty_92 = 7; -pub const IFLA_XDP_EXPECTED_FD: _bindgen_ty_92 = 8; -pub const __IFLA_XDP_MAX: _bindgen_ty_92 = 9; -pub type _bindgen_ty_92 = ::core::ffi::c_uint; +pub const IFLA_XDP_UNSPEC: _bindgen_ty_94 = 0; +pub const IFLA_XDP_FD: _bindgen_ty_94 = 1; +pub const IFLA_XDP_ATTACHED: _bindgen_ty_94 = 2; +pub const IFLA_XDP_FLAGS: _bindgen_ty_94 = 3; +pub const IFLA_XDP_PROG_ID: _bindgen_ty_94 = 4; +pub const IFLA_XDP_DRV_PROG_ID: _bindgen_ty_94 = 5; +pub const IFLA_XDP_SKB_PROG_ID: _bindgen_ty_94 = 6; +pub const IFLA_XDP_HW_PROG_ID: _bindgen_ty_94 = 7; +pub const IFLA_XDP_EXPECTED_FD: _bindgen_ty_94 = 8; +pub const __IFLA_XDP_MAX: _bindgen_ty_94 = 9; +pub type _bindgen_ty_94 = ::core::ffi::c_uint; impl nf_inet_hooks { pub const NF_INET_INGRESS: nf_inet_hooks = nf_inet_hooks::NF_INET_NUMHOOKS; } @@ -2141,16 +2157,16 @@ pub enum nf_inet_hooks { NF_INET_POST_ROUTING = 4, NF_INET_NUMHOOKS = 5, } -pub const NFPROTO_UNSPEC: _bindgen_ty_99 = 0; -pub const NFPROTO_INET: _bindgen_ty_99 = 1; -pub const NFPROTO_IPV4: _bindgen_ty_99 = 2; -pub const NFPROTO_ARP: _bindgen_ty_99 = 3; -pub const NFPROTO_NETDEV: _bindgen_ty_99 = 5; -pub const NFPROTO_BRIDGE: _bindgen_ty_99 = 7; -pub const NFPROTO_IPV6: _bindgen_ty_99 = 10; -pub const NFPROTO_DECNET: _bindgen_ty_99 = 12; -pub const NFPROTO_NUMPROTO: _bindgen_ty_99 = 13; -pub type _bindgen_ty_99 = ::core::ffi::c_uint; +pub const NFPROTO_UNSPEC: _bindgen_ty_101 = 0; +pub const NFPROTO_INET: _bindgen_ty_101 = 1; +pub const NFPROTO_IPV4: _bindgen_ty_101 = 2; +pub const NFPROTO_ARP: _bindgen_ty_101 = 3; +pub const NFPROTO_NETDEV: _bindgen_ty_101 = 5; +pub const NFPROTO_BRIDGE: _bindgen_ty_101 = 7; +pub const NFPROTO_IPV6: _bindgen_ty_101 = 10; +pub const NFPROTO_DECNET: _bindgen_ty_101 = 12; +pub const NFPROTO_NUMPROTO: _bindgen_ty_101 = 13; +pub type _bindgen_ty_101 = ::core::ffi::c_uint; #[repr(u32)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub enum perf_type_id { @@ -4111,20 +4127,20 @@ pub enum perf_event_type { PERF_RECORD_AUX_OUTPUT_HW_ID = 21, PERF_RECORD_MAX = 22, } -pub const TCA_BPF_UNSPEC: _bindgen_ty_154 = 0; -pub const TCA_BPF_ACT: _bindgen_ty_154 = 1; -pub const TCA_BPF_POLICE: _bindgen_ty_154 = 2; -pub const TCA_BPF_CLASSID: _bindgen_ty_154 = 3; -pub const TCA_BPF_OPS_LEN: _bindgen_ty_154 = 4; -pub const TCA_BPF_OPS: _bindgen_ty_154 = 5; -pub const TCA_BPF_FD: _bindgen_ty_154 = 6; -pub const TCA_BPF_NAME: _bindgen_ty_154 = 7; -pub const TCA_BPF_FLAGS: _bindgen_ty_154 = 8; -pub const TCA_BPF_FLAGS_GEN: _bindgen_ty_154 = 9; -pub const TCA_BPF_TAG: _bindgen_ty_154 = 10; -pub const TCA_BPF_ID: _bindgen_ty_154 = 11; -pub const __TCA_BPF_MAX: _bindgen_ty_154 = 12; -pub type _bindgen_ty_154 = ::core::ffi::c_uint; +pub const TCA_BPF_UNSPEC: _bindgen_ty_156 = 0; +pub const TCA_BPF_ACT: _bindgen_ty_156 = 1; +pub const TCA_BPF_POLICE: _bindgen_ty_156 = 2; +pub const TCA_BPF_CLASSID: _bindgen_ty_156 = 3; +pub const TCA_BPF_OPS_LEN: _bindgen_ty_156 = 4; +pub const TCA_BPF_OPS: _bindgen_ty_156 = 5; +pub const TCA_BPF_FD: _bindgen_ty_156 = 6; +pub const TCA_BPF_NAME: _bindgen_ty_156 = 7; +pub const TCA_BPF_FLAGS: _bindgen_ty_156 = 8; +pub const TCA_BPF_FLAGS_GEN: _bindgen_ty_156 = 9; +pub const TCA_BPF_TAG: _bindgen_ty_156 = 10; +pub const TCA_BPF_ID: _bindgen_ty_156 = 11; +pub const __TCA_BPF_MAX: _bindgen_ty_156 = 12; +pub type _bindgen_ty_156 = ::core::ffi::c_uint; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct ifinfomsg { @@ -4146,22 +4162,22 @@ pub struct tcmsg { pub tcm_parent: __u32, pub tcm_info: __u32, } -pub const TCA_UNSPEC: _bindgen_ty_174 = 0; -pub const TCA_KIND: _bindgen_ty_174 = 1; -pub const TCA_OPTIONS: _bindgen_ty_174 = 2; -pub const TCA_STATS: _bindgen_ty_174 = 3; -pub const TCA_XSTATS: _bindgen_ty_174 = 4; -pub const TCA_RATE: _bindgen_ty_174 = 5; -pub const TCA_FCNT: _bindgen_ty_174 = 6; -pub const TCA_STATS2: _bindgen_ty_174 = 7; -pub const TCA_STAB: _bindgen_ty_174 = 8; -pub const TCA_PAD: _bindgen_ty_174 = 9; -pub const TCA_DUMP_INVISIBLE: _bindgen_ty_174 = 10; -pub const TCA_CHAIN: _bindgen_ty_174 = 11; -pub const TCA_HW_OFFLOAD: _bindgen_ty_174 = 12; -pub const TCA_INGRESS_BLOCK: _bindgen_ty_174 = 13; -pub const TCA_EGRESS_BLOCK: _bindgen_ty_174 = 14; -pub const TCA_DUMP_FLAGS: _bindgen_ty_174 = 15; -pub const TCA_EXT_WARN_MSG: _bindgen_ty_174 = 16; -pub const __TCA_MAX: _bindgen_ty_174 = 17; -pub type _bindgen_ty_174 = ::core::ffi::c_uint; +pub const TCA_UNSPEC: _bindgen_ty_176 = 0; +pub const TCA_KIND: _bindgen_ty_176 = 1; +pub const TCA_OPTIONS: _bindgen_ty_176 = 2; +pub const TCA_STATS: _bindgen_ty_176 = 3; +pub const TCA_XSTATS: _bindgen_ty_176 = 4; +pub const TCA_RATE: _bindgen_ty_176 = 5; +pub const TCA_FCNT: _bindgen_ty_176 = 6; +pub const TCA_STATS2: _bindgen_ty_176 = 7; +pub const TCA_STAB: _bindgen_ty_176 = 8; +pub const TCA_PAD: _bindgen_ty_176 = 9; +pub const TCA_DUMP_INVISIBLE: _bindgen_ty_176 = 10; +pub const TCA_CHAIN: _bindgen_ty_176 = 11; +pub const TCA_HW_OFFLOAD: _bindgen_ty_176 = 12; +pub const TCA_INGRESS_BLOCK: _bindgen_ty_176 = 13; +pub const TCA_EGRESS_BLOCK: _bindgen_ty_176 = 14; +pub const TCA_DUMP_FLAGS: _bindgen_ty_176 = 15; +pub const TCA_EXT_WARN_MSG: _bindgen_ty_176 = 16; +pub const __TCA_MAX: _bindgen_ty_176 = 17; +pub type _bindgen_ty_176 = ::core::ffi::c_uint; diff --git a/aya-obj/src/generated/linux_bindings_powerpc64.rs b/aya-obj/src/generated/linux_bindings_powerpc64.rs index 50d01b86..7d8294f7 100644 --- a/aya-obj/src/generated/linux_bindings_powerpc64.rs +++ b/aya-obj/src/generated/linux_bindings_powerpc64.rs @@ -2105,6 +2105,22 @@ pub struct btf_var_secinfo { pub struct btf_decl_tag { pub component_idx: __s32, } +pub const HW_BREAKPOINT_LEN_1: _bindgen_ty_44 = 1; +pub const HW_BREAKPOINT_LEN_2: _bindgen_ty_44 = 2; +pub const HW_BREAKPOINT_LEN_3: _bindgen_ty_44 = 3; +pub const HW_BREAKPOINT_LEN_4: _bindgen_ty_44 = 4; +pub const HW_BREAKPOINT_LEN_5: _bindgen_ty_44 = 5; +pub const HW_BREAKPOINT_LEN_6: _bindgen_ty_44 = 6; +pub const HW_BREAKPOINT_LEN_7: _bindgen_ty_44 = 7; +pub const HW_BREAKPOINT_LEN_8: _bindgen_ty_44 = 8; +pub type _bindgen_ty_44 = ::core::ffi::c_uint; +pub const HW_BREAKPOINT_EMPTY: _bindgen_ty_45 = 0; +pub const HW_BREAKPOINT_R: _bindgen_ty_45 = 1; +pub const HW_BREAKPOINT_W: _bindgen_ty_45 = 2; +pub const HW_BREAKPOINT_RW: _bindgen_ty_45 = 3; +pub const HW_BREAKPOINT_X: _bindgen_ty_45 = 4; +pub const HW_BREAKPOINT_INVALID: _bindgen_ty_45 = 7; +pub type _bindgen_ty_45 = ::core::ffi::c_uint; impl nlmsgerr_attrs { pub const NLMSGERR_ATTR_MAX: nlmsgerr_attrs = nlmsgerr_attrs::NLMSGERR_ATTR_COOKIE; } @@ -2117,17 +2133,17 @@ pub enum nlmsgerr_attrs { NLMSGERR_ATTR_COOKIE = 3, __NLMSGERR_ATTR_MAX = 4, } -pub const IFLA_XDP_UNSPEC: _bindgen_ty_92 = 0; -pub const IFLA_XDP_FD: _bindgen_ty_92 = 1; -pub const IFLA_XDP_ATTACHED: _bindgen_ty_92 = 2; -pub const IFLA_XDP_FLAGS: _bindgen_ty_92 = 3; -pub const IFLA_XDP_PROG_ID: _bindgen_ty_92 = 4; -pub const IFLA_XDP_DRV_PROG_ID: _bindgen_ty_92 = 5; -pub const IFLA_XDP_SKB_PROG_ID: _bindgen_ty_92 = 6; -pub const IFLA_XDP_HW_PROG_ID: _bindgen_ty_92 = 7; -pub const IFLA_XDP_EXPECTED_FD: _bindgen_ty_92 = 8; -pub const __IFLA_XDP_MAX: _bindgen_ty_92 = 9; -pub type _bindgen_ty_92 = ::core::ffi::c_uint; +pub const IFLA_XDP_UNSPEC: _bindgen_ty_94 = 0; +pub const IFLA_XDP_FD: _bindgen_ty_94 = 1; +pub const IFLA_XDP_ATTACHED: _bindgen_ty_94 = 2; +pub const IFLA_XDP_FLAGS: _bindgen_ty_94 = 3; +pub const IFLA_XDP_PROG_ID: _bindgen_ty_94 = 4; +pub const IFLA_XDP_DRV_PROG_ID: _bindgen_ty_94 = 5; +pub const IFLA_XDP_SKB_PROG_ID: _bindgen_ty_94 = 6; +pub const IFLA_XDP_HW_PROG_ID: _bindgen_ty_94 = 7; +pub const IFLA_XDP_EXPECTED_FD: _bindgen_ty_94 = 8; +pub const __IFLA_XDP_MAX: _bindgen_ty_94 = 9; +pub type _bindgen_ty_94 = ::core::ffi::c_uint; impl nf_inet_hooks { pub const NF_INET_INGRESS: nf_inet_hooks = nf_inet_hooks::NF_INET_NUMHOOKS; } @@ -2141,16 +2157,16 @@ pub enum nf_inet_hooks { NF_INET_POST_ROUTING = 4, NF_INET_NUMHOOKS = 5, } -pub const NFPROTO_UNSPEC: _bindgen_ty_99 = 0; -pub const NFPROTO_INET: _bindgen_ty_99 = 1; -pub const NFPROTO_IPV4: _bindgen_ty_99 = 2; -pub const NFPROTO_ARP: _bindgen_ty_99 = 3; -pub const NFPROTO_NETDEV: _bindgen_ty_99 = 5; -pub const NFPROTO_BRIDGE: _bindgen_ty_99 = 7; -pub const NFPROTO_IPV6: _bindgen_ty_99 = 10; -pub const NFPROTO_DECNET: _bindgen_ty_99 = 12; -pub const NFPROTO_NUMPROTO: _bindgen_ty_99 = 13; -pub type _bindgen_ty_99 = ::core::ffi::c_uint; +pub const NFPROTO_UNSPEC: _bindgen_ty_101 = 0; +pub const NFPROTO_INET: _bindgen_ty_101 = 1; +pub const NFPROTO_IPV4: _bindgen_ty_101 = 2; +pub const NFPROTO_ARP: _bindgen_ty_101 = 3; +pub const NFPROTO_NETDEV: _bindgen_ty_101 = 5; +pub const NFPROTO_BRIDGE: _bindgen_ty_101 = 7; +pub const NFPROTO_IPV6: _bindgen_ty_101 = 10; +pub const NFPROTO_DECNET: _bindgen_ty_101 = 12; +pub const NFPROTO_NUMPROTO: _bindgen_ty_101 = 13; +pub type _bindgen_ty_101 = ::core::ffi::c_uint; #[repr(u32)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub enum perf_type_id { @@ -4111,20 +4127,20 @@ pub enum perf_event_type { PERF_RECORD_AUX_OUTPUT_HW_ID = 21, PERF_RECORD_MAX = 22, } -pub const TCA_BPF_UNSPEC: _bindgen_ty_154 = 0; -pub const TCA_BPF_ACT: _bindgen_ty_154 = 1; -pub const TCA_BPF_POLICE: _bindgen_ty_154 = 2; -pub const TCA_BPF_CLASSID: _bindgen_ty_154 = 3; -pub const TCA_BPF_OPS_LEN: _bindgen_ty_154 = 4; -pub const TCA_BPF_OPS: _bindgen_ty_154 = 5; -pub const TCA_BPF_FD: _bindgen_ty_154 = 6; -pub const TCA_BPF_NAME: _bindgen_ty_154 = 7; -pub const TCA_BPF_FLAGS: _bindgen_ty_154 = 8; -pub const TCA_BPF_FLAGS_GEN: _bindgen_ty_154 = 9; -pub const TCA_BPF_TAG: _bindgen_ty_154 = 10; -pub const TCA_BPF_ID: _bindgen_ty_154 = 11; -pub const __TCA_BPF_MAX: _bindgen_ty_154 = 12; -pub type _bindgen_ty_154 = ::core::ffi::c_uint; +pub const TCA_BPF_UNSPEC: _bindgen_ty_156 = 0; +pub const TCA_BPF_ACT: _bindgen_ty_156 = 1; +pub const TCA_BPF_POLICE: _bindgen_ty_156 = 2; +pub const TCA_BPF_CLASSID: _bindgen_ty_156 = 3; +pub const TCA_BPF_OPS_LEN: _bindgen_ty_156 = 4; +pub const TCA_BPF_OPS: _bindgen_ty_156 = 5; +pub const TCA_BPF_FD: _bindgen_ty_156 = 6; +pub const TCA_BPF_NAME: _bindgen_ty_156 = 7; +pub const TCA_BPF_FLAGS: _bindgen_ty_156 = 8; +pub const TCA_BPF_FLAGS_GEN: _bindgen_ty_156 = 9; +pub const TCA_BPF_TAG: _bindgen_ty_156 = 10; +pub const TCA_BPF_ID: _bindgen_ty_156 = 11; +pub const __TCA_BPF_MAX: _bindgen_ty_156 = 12; +pub type _bindgen_ty_156 = ::core::ffi::c_uint; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct ifinfomsg { @@ -4146,22 +4162,22 @@ pub struct tcmsg { pub tcm_parent: __u32, pub tcm_info: __u32, } -pub const TCA_UNSPEC: _bindgen_ty_174 = 0; -pub const TCA_KIND: _bindgen_ty_174 = 1; -pub const TCA_OPTIONS: _bindgen_ty_174 = 2; -pub const TCA_STATS: _bindgen_ty_174 = 3; -pub const TCA_XSTATS: _bindgen_ty_174 = 4; -pub const TCA_RATE: _bindgen_ty_174 = 5; -pub const TCA_FCNT: _bindgen_ty_174 = 6; -pub const TCA_STATS2: _bindgen_ty_174 = 7; -pub const TCA_STAB: _bindgen_ty_174 = 8; -pub const TCA_PAD: _bindgen_ty_174 = 9; -pub const TCA_DUMP_INVISIBLE: _bindgen_ty_174 = 10; -pub const TCA_CHAIN: _bindgen_ty_174 = 11; -pub const TCA_HW_OFFLOAD: _bindgen_ty_174 = 12; -pub const TCA_INGRESS_BLOCK: _bindgen_ty_174 = 13; -pub const TCA_EGRESS_BLOCK: _bindgen_ty_174 = 14; -pub const TCA_DUMP_FLAGS: _bindgen_ty_174 = 15; -pub const TCA_EXT_WARN_MSG: _bindgen_ty_174 = 16; -pub const __TCA_MAX: _bindgen_ty_174 = 17; -pub type _bindgen_ty_174 = ::core::ffi::c_uint; +pub const TCA_UNSPEC: _bindgen_ty_176 = 0; +pub const TCA_KIND: _bindgen_ty_176 = 1; +pub const TCA_OPTIONS: _bindgen_ty_176 = 2; +pub const TCA_STATS: _bindgen_ty_176 = 3; +pub const TCA_XSTATS: _bindgen_ty_176 = 4; +pub const TCA_RATE: _bindgen_ty_176 = 5; +pub const TCA_FCNT: _bindgen_ty_176 = 6; +pub const TCA_STATS2: _bindgen_ty_176 = 7; +pub const TCA_STAB: _bindgen_ty_176 = 8; +pub const TCA_PAD: _bindgen_ty_176 = 9; +pub const TCA_DUMP_INVISIBLE: _bindgen_ty_176 = 10; +pub const TCA_CHAIN: _bindgen_ty_176 = 11; +pub const TCA_HW_OFFLOAD: _bindgen_ty_176 = 12; +pub const TCA_INGRESS_BLOCK: _bindgen_ty_176 = 13; +pub const TCA_EGRESS_BLOCK: _bindgen_ty_176 = 14; +pub const TCA_DUMP_FLAGS: _bindgen_ty_176 = 15; +pub const TCA_EXT_WARN_MSG: _bindgen_ty_176 = 16; +pub const __TCA_MAX: _bindgen_ty_176 = 17; +pub type _bindgen_ty_176 = ::core::ffi::c_uint; diff --git a/aya-obj/src/generated/linux_bindings_riscv64.rs b/aya-obj/src/generated/linux_bindings_riscv64.rs index b76ed850..aff50e13 100644 --- a/aya-obj/src/generated/linux_bindings_riscv64.rs +++ b/aya-obj/src/generated/linux_bindings_riscv64.rs @@ -2105,6 +2105,22 @@ pub struct btf_var_secinfo { pub struct btf_decl_tag { pub component_idx: __s32, } +pub const HW_BREAKPOINT_LEN_1: _bindgen_ty_44 = 1; +pub const HW_BREAKPOINT_LEN_2: _bindgen_ty_44 = 2; +pub const HW_BREAKPOINT_LEN_3: _bindgen_ty_44 = 3; +pub const HW_BREAKPOINT_LEN_4: _bindgen_ty_44 = 4; +pub const HW_BREAKPOINT_LEN_5: _bindgen_ty_44 = 5; +pub const HW_BREAKPOINT_LEN_6: _bindgen_ty_44 = 6; +pub const HW_BREAKPOINT_LEN_7: _bindgen_ty_44 = 7; +pub const HW_BREAKPOINT_LEN_8: _bindgen_ty_44 = 8; +pub type _bindgen_ty_44 = ::core::ffi::c_uint; +pub const HW_BREAKPOINT_EMPTY: _bindgen_ty_45 = 0; +pub const HW_BREAKPOINT_R: _bindgen_ty_45 = 1; +pub const HW_BREAKPOINT_W: _bindgen_ty_45 = 2; +pub const HW_BREAKPOINT_RW: _bindgen_ty_45 = 3; +pub const HW_BREAKPOINT_X: _bindgen_ty_45 = 4; +pub const HW_BREAKPOINT_INVALID: _bindgen_ty_45 = 7; +pub type _bindgen_ty_45 = ::core::ffi::c_uint; impl nlmsgerr_attrs { pub const NLMSGERR_ATTR_MAX: nlmsgerr_attrs = nlmsgerr_attrs::NLMSGERR_ATTR_COOKIE; } @@ -2117,17 +2133,17 @@ pub enum nlmsgerr_attrs { NLMSGERR_ATTR_COOKIE = 3, __NLMSGERR_ATTR_MAX = 4, } -pub const IFLA_XDP_UNSPEC: _bindgen_ty_92 = 0; -pub const IFLA_XDP_FD: _bindgen_ty_92 = 1; -pub const IFLA_XDP_ATTACHED: _bindgen_ty_92 = 2; -pub const IFLA_XDP_FLAGS: _bindgen_ty_92 = 3; -pub const IFLA_XDP_PROG_ID: _bindgen_ty_92 = 4; -pub const IFLA_XDP_DRV_PROG_ID: _bindgen_ty_92 = 5; -pub const IFLA_XDP_SKB_PROG_ID: _bindgen_ty_92 = 6; -pub const IFLA_XDP_HW_PROG_ID: _bindgen_ty_92 = 7; -pub const IFLA_XDP_EXPECTED_FD: _bindgen_ty_92 = 8; -pub const __IFLA_XDP_MAX: _bindgen_ty_92 = 9; -pub type _bindgen_ty_92 = ::core::ffi::c_uint; +pub const IFLA_XDP_UNSPEC: _bindgen_ty_94 = 0; +pub const IFLA_XDP_FD: _bindgen_ty_94 = 1; +pub const IFLA_XDP_ATTACHED: _bindgen_ty_94 = 2; +pub const IFLA_XDP_FLAGS: _bindgen_ty_94 = 3; +pub const IFLA_XDP_PROG_ID: _bindgen_ty_94 = 4; +pub const IFLA_XDP_DRV_PROG_ID: _bindgen_ty_94 = 5; +pub const IFLA_XDP_SKB_PROG_ID: _bindgen_ty_94 = 6; +pub const IFLA_XDP_HW_PROG_ID: _bindgen_ty_94 = 7; +pub const IFLA_XDP_EXPECTED_FD: _bindgen_ty_94 = 8; +pub const __IFLA_XDP_MAX: _bindgen_ty_94 = 9; +pub type _bindgen_ty_94 = ::core::ffi::c_uint; impl nf_inet_hooks { pub const NF_INET_INGRESS: nf_inet_hooks = nf_inet_hooks::NF_INET_NUMHOOKS; } @@ -2141,16 +2157,16 @@ pub enum nf_inet_hooks { NF_INET_POST_ROUTING = 4, NF_INET_NUMHOOKS = 5, } -pub const NFPROTO_UNSPEC: _bindgen_ty_99 = 0; -pub const NFPROTO_INET: _bindgen_ty_99 = 1; -pub const NFPROTO_IPV4: _bindgen_ty_99 = 2; -pub const NFPROTO_ARP: _bindgen_ty_99 = 3; -pub const NFPROTO_NETDEV: _bindgen_ty_99 = 5; -pub const NFPROTO_BRIDGE: _bindgen_ty_99 = 7; -pub const NFPROTO_IPV6: _bindgen_ty_99 = 10; -pub const NFPROTO_DECNET: _bindgen_ty_99 = 12; -pub const NFPROTO_NUMPROTO: _bindgen_ty_99 = 13; -pub type _bindgen_ty_99 = ::core::ffi::c_uint; +pub const NFPROTO_UNSPEC: _bindgen_ty_101 = 0; +pub const NFPROTO_INET: _bindgen_ty_101 = 1; +pub const NFPROTO_IPV4: _bindgen_ty_101 = 2; +pub const NFPROTO_ARP: _bindgen_ty_101 = 3; +pub const NFPROTO_NETDEV: _bindgen_ty_101 = 5; +pub const NFPROTO_BRIDGE: _bindgen_ty_101 = 7; +pub const NFPROTO_IPV6: _bindgen_ty_101 = 10; +pub const NFPROTO_DECNET: _bindgen_ty_101 = 12; +pub const NFPROTO_NUMPROTO: _bindgen_ty_101 = 13; +pub type _bindgen_ty_101 = ::core::ffi::c_uint; #[repr(u32)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub enum perf_type_id { @@ -4111,20 +4127,20 @@ pub enum perf_event_type { PERF_RECORD_AUX_OUTPUT_HW_ID = 21, PERF_RECORD_MAX = 22, } -pub const TCA_BPF_UNSPEC: _bindgen_ty_154 = 0; -pub const TCA_BPF_ACT: _bindgen_ty_154 = 1; -pub const TCA_BPF_POLICE: _bindgen_ty_154 = 2; -pub const TCA_BPF_CLASSID: _bindgen_ty_154 = 3; -pub const TCA_BPF_OPS_LEN: _bindgen_ty_154 = 4; -pub const TCA_BPF_OPS: _bindgen_ty_154 = 5; -pub const TCA_BPF_FD: _bindgen_ty_154 = 6; -pub const TCA_BPF_NAME: _bindgen_ty_154 = 7; -pub const TCA_BPF_FLAGS: _bindgen_ty_154 = 8; -pub const TCA_BPF_FLAGS_GEN: _bindgen_ty_154 = 9; -pub const TCA_BPF_TAG: _bindgen_ty_154 = 10; -pub const TCA_BPF_ID: _bindgen_ty_154 = 11; -pub const __TCA_BPF_MAX: _bindgen_ty_154 = 12; -pub type _bindgen_ty_154 = ::core::ffi::c_uint; +pub const TCA_BPF_UNSPEC: _bindgen_ty_156 = 0; +pub const TCA_BPF_ACT: _bindgen_ty_156 = 1; +pub const TCA_BPF_POLICE: _bindgen_ty_156 = 2; +pub const TCA_BPF_CLASSID: _bindgen_ty_156 = 3; +pub const TCA_BPF_OPS_LEN: _bindgen_ty_156 = 4; +pub const TCA_BPF_OPS: _bindgen_ty_156 = 5; +pub const TCA_BPF_FD: _bindgen_ty_156 = 6; +pub const TCA_BPF_NAME: _bindgen_ty_156 = 7; +pub const TCA_BPF_FLAGS: _bindgen_ty_156 = 8; +pub const TCA_BPF_FLAGS_GEN: _bindgen_ty_156 = 9; +pub const TCA_BPF_TAG: _bindgen_ty_156 = 10; +pub const TCA_BPF_ID: _bindgen_ty_156 = 11; +pub const __TCA_BPF_MAX: _bindgen_ty_156 = 12; +pub type _bindgen_ty_156 = ::core::ffi::c_uint; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct ifinfomsg { @@ -4146,22 +4162,22 @@ pub struct tcmsg { pub tcm_parent: __u32, pub tcm_info: __u32, } -pub const TCA_UNSPEC: _bindgen_ty_174 = 0; -pub const TCA_KIND: _bindgen_ty_174 = 1; -pub const TCA_OPTIONS: _bindgen_ty_174 = 2; -pub const TCA_STATS: _bindgen_ty_174 = 3; -pub const TCA_XSTATS: _bindgen_ty_174 = 4; -pub const TCA_RATE: _bindgen_ty_174 = 5; -pub const TCA_FCNT: _bindgen_ty_174 = 6; -pub const TCA_STATS2: _bindgen_ty_174 = 7; -pub const TCA_STAB: _bindgen_ty_174 = 8; -pub const TCA_PAD: _bindgen_ty_174 = 9; -pub const TCA_DUMP_INVISIBLE: _bindgen_ty_174 = 10; -pub const TCA_CHAIN: _bindgen_ty_174 = 11; -pub const TCA_HW_OFFLOAD: _bindgen_ty_174 = 12; -pub const TCA_INGRESS_BLOCK: _bindgen_ty_174 = 13; -pub const TCA_EGRESS_BLOCK: _bindgen_ty_174 = 14; -pub const TCA_DUMP_FLAGS: _bindgen_ty_174 = 15; -pub const TCA_EXT_WARN_MSG: _bindgen_ty_174 = 16; -pub const __TCA_MAX: _bindgen_ty_174 = 17; -pub type _bindgen_ty_174 = ::core::ffi::c_uint; +pub const TCA_UNSPEC: _bindgen_ty_176 = 0; +pub const TCA_KIND: _bindgen_ty_176 = 1; +pub const TCA_OPTIONS: _bindgen_ty_176 = 2; +pub const TCA_STATS: _bindgen_ty_176 = 3; +pub const TCA_XSTATS: _bindgen_ty_176 = 4; +pub const TCA_RATE: _bindgen_ty_176 = 5; +pub const TCA_FCNT: _bindgen_ty_176 = 6; +pub const TCA_STATS2: _bindgen_ty_176 = 7; +pub const TCA_STAB: _bindgen_ty_176 = 8; +pub const TCA_PAD: _bindgen_ty_176 = 9; +pub const TCA_DUMP_INVISIBLE: _bindgen_ty_176 = 10; +pub const TCA_CHAIN: _bindgen_ty_176 = 11; +pub const TCA_HW_OFFLOAD: _bindgen_ty_176 = 12; +pub const TCA_INGRESS_BLOCK: _bindgen_ty_176 = 13; +pub const TCA_EGRESS_BLOCK: _bindgen_ty_176 = 14; +pub const TCA_DUMP_FLAGS: _bindgen_ty_176 = 15; +pub const TCA_EXT_WARN_MSG: _bindgen_ty_176 = 16; +pub const __TCA_MAX: _bindgen_ty_176 = 17; +pub type _bindgen_ty_176 = ::core::ffi::c_uint; diff --git a/aya-obj/src/generated/linux_bindings_s390x.rs b/aya-obj/src/generated/linux_bindings_s390x.rs index b76ed850..aff50e13 100644 --- a/aya-obj/src/generated/linux_bindings_s390x.rs +++ b/aya-obj/src/generated/linux_bindings_s390x.rs @@ -2105,6 +2105,22 @@ pub struct btf_var_secinfo { pub struct btf_decl_tag { pub component_idx: __s32, } +pub const HW_BREAKPOINT_LEN_1: _bindgen_ty_44 = 1; +pub const HW_BREAKPOINT_LEN_2: _bindgen_ty_44 = 2; +pub const HW_BREAKPOINT_LEN_3: _bindgen_ty_44 = 3; +pub const HW_BREAKPOINT_LEN_4: _bindgen_ty_44 = 4; +pub const HW_BREAKPOINT_LEN_5: _bindgen_ty_44 = 5; +pub const HW_BREAKPOINT_LEN_6: _bindgen_ty_44 = 6; +pub const HW_BREAKPOINT_LEN_7: _bindgen_ty_44 = 7; +pub const HW_BREAKPOINT_LEN_8: _bindgen_ty_44 = 8; +pub type _bindgen_ty_44 = ::core::ffi::c_uint; +pub const HW_BREAKPOINT_EMPTY: _bindgen_ty_45 = 0; +pub const HW_BREAKPOINT_R: _bindgen_ty_45 = 1; +pub const HW_BREAKPOINT_W: _bindgen_ty_45 = 2; +pub const HW_BREAKPOINT_RW: _bindgen_ty_45 = 3; +pub const HW_BREAKPOINT_X: _bindgen_ty_45 = 4; +pub const HW_BREAKPOINT_INVALID: _bindgen_ty_45 = 7; +pub type _bindgen_ty_45 = ::core::ffi::c_uint; impl nlmsgerr_attrs { pub const NLMSGERR_ATTR_MAX: nlmsgerr_attrs = nlmsgerr_attrs::NLMSGERR_ATTR_COOKIE; } @@ -2117,17 +2133,17 @@ pub enum nlmsgerr_attrs { NLMSGERR_ATTR_COOKIE = 3, __NLMSGERR_ATTR_MAX = 4, } -pub const IFLA_XDP_UNSPEC: _bindgen_ty_92 = 0; -pub const IFLA_XDP_FD: _bindgen_ty_92 = 1; -pub const IFLA_XDP_ATTACHED: _bindgen_ty_92 = 2; -pub const IFLA_XDP_FLAGS: _bindgen_ty_92 = 3; -pub const IFLA_XDP_PROG_ID: _bindgen_ty_92 = 4; -pub const IFLA_XDP_DRV_PROG_ID: _bindgen_ty_92 = 5; -pub const IFLA_XDP_SKB_PROG_ID: _bindgen_ty_92 = 6; -pub const IFLA_XDP_HW_PROG_ID: _bindgen_ty_92 = 7; -pub const IFLA_XDP_EXPECTED_FD: _bindgen_ty_92 = 8; -pub const __IFLA_XDP_MAX: _bindgen_ty_92 = 9; -pub type _bindgen_ty_92 = ::core::ffi::c_uint; +pub const IFLA_XDP_UNSPEC: _bindgen_ty_94 = 0; +pub const IFLA_XDP_FD: _bindgen_ty_94 = 1; +pub const IFLA_XDP_ATTACHED: _bindgen_ty_94 = 2; +pub const IFLA_XDP_FLAGS: _bindgen_ty_94 = 3; +pub const IFLA_XDP_PROG_ID: _bindgen_ty_94 = 4; +pub const IFLA_XDP_DRV_PROG_ID: _bindgen_ty_94 = 5; +pub const IFLA_XDP_SKB_PROG_ID: _bindgen_ty_94 = 6; +pub const IFLA_XDP_HW_PROG_ID: _bindgen_ty_94 = 7; +pub const IFLA_XDP_EXPECTED_FD: _bindgen_ty_94 = 8; +pub const __IFLA_XDP_MAX: _bindgen_ty_94 = 9; +pub type _bindgen_ty_94 = ::core::ffi::c_uint; impl nf_inet_hooks { pub const NF_INET_INGRESS: nf_inet_hooks = nf_inet_hooks::NF_INET_NUMHOOKS; } @@ -2141,16 +2157,16 @@ pub enum nf_inet_hooks { NF_INET_POST_ROUTING = 4, NF_INET_NUMHOOKS = 5, } -pub const NFPROTO_UNSPEC: _bindgen_ty_99 = 0; -pub const NFPROTO_INET: _bindgen_ty_99 = 1; -pub const NFPROTO_IPV4: _bindgen_ty_99 = 2; -pub const NFPROTO_ARP: _bindgen_ty_99 = 3; -pub const NFPROTO_NETDEV: _bindgen_ty_99 = 5; -pub const NFPROTO_BRIDGE: _bindgen_ty_99 = 7; -pub const NFPROTO_IPV6: _bindgen_ty_99 = 10; -pub const NFPROTO_DECNET: _bindgen_ty_99 = 12; -pub const NFPROTO_NUMPROTO: _bindgen_ty_99 = 13; -pub type _bindgen_ty_99 = ::core::ffi::c_uint; +pub const NFPROTO_UNSPEC: _bindgen_ty_101 = 0; +pub const NFPROTO_INET: _bindgen_ty_101 = 1; +pub const NFPROTO_IPV4: _bindgen_ty_101 = 2; +pub const NFPROTO_ARP: _bindgen_ty_101 = 3; +pub const NFPROTO_NETDEV: _bindgen_ty_101 = 5; +pub const NFPROTO_BRIDGE: _bindgen_ty_101 = 7; +pub const NFPROTO_IPV6: _bindgen_ty_101 = 10; +pub const NFPROTO_DECNET: _bindgen_ty_101 = 12; +pub const NFPROTO_NUMPROTO: _bindgen_ty_101 = 13; +pub type _bindgen_ty_101 = ::core::ffi::c_uint; #[repr(u32)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub enum perf_type_id { @@ -4111,20 +4127,20 @@ pub enum perf_event_type { PERF_RECORD_AUX_OUTPUT_HW_ID = 21, PERF_RECORD_MAX = 22, } -pub const TCA_BPF_UNSPEC: _bindgen_ty_154 = 0; -pub const TCA_BPF_ACT: _bindgen_ty_154 = 1; -pub const TCA_BPF_POLICE: _bindgen_ty_154 = 2; -pub const TCA_BPF_CLASSID: _bindgen_ty_154 = 3; -pub const TCA_BPF_OPS_LEN: _bindgen_ty_154 = 4; -pub const TCA_BPF_OPS: _bindgen_ty_154 = 5; -pub const TCA_BPF_FD: _bindgen_ty_154 = 6; -pub const TCA_BPF_NAME: _bindgen_ty_154 = 7; -pub const TCA_BPF_FLAGS: _bindgen_ty_154 = 8; -pub const TCA_BPF_FLAGS_GEN: _bindgen_ty_154 = 9; -pub const TCA_BPF_TAG: _bindgen_ty_154 = 10; -pub const TCA_BPF_ID: _bindgen_ty_154 = 11; -pub const __TCA_BPF_MAX: _bindgen_ty_154 = 12; -pub type _bindgen_ty_154 = ::core::ffi::c_uint; +pub const TCA_BPF_UNSPEC: _bindgen_ty_156 = 0; +pub const TCA_BPF_ACT: _bindgen_ty_156 = 1; +pub const TCA_BPF_POLICE: _bindgen_ty_156 = 2; +pub const TCA_BPF_CLASSID: _bindgen_ty_156 = 3; +pub const TCA_BPF_OPS_LEN: _bindgen_ty_156 = 4; +pub const TCA_BPF_OPS: _bindgen_ty_156 = 5; +pub const TCA_BPF_FD: _bindgen_ty_156 = 6; +pub const TCA_BPF_NAME: _bindgen_ty_156 = 7; +pub const TCA_BPF_FLAGS: _bindgen_ty_156 = 8; +pub const TCA_BPF_FLAGS_GEN: _bindgen_ty_156 = 9; +pub const TCA_BPF_TAG: _bindgen_ty_156 = 10; +pub const TCA_BPF_ID: _bindgen_ty_156 = 11; +pub const __TCA_BPF_MAX: _bindgen_ty_156 = 12; +pub type _bindgen_ty_156 = ::core::ffi::c_uint; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct ifinfomsg { @@ -4146,22 +4162,22 @@ pub struct tcmsg { pub tcm_parent: __u32, pub tcm_info: __u32, } -pub const TCA_UNSPEC: _bindgen_ty_174 = 0; -pub const TCA_KIND: _bindgen_ty_174 = 1; -pub const TCA_OPTIONS: _bindgen_ty_174 = 2; -pub const TCA_STATS: _bindgen_ty_174 = 3; -pub const TCA_XSTATS: _bindgen_ty_174 = 4; -pub const TCA_RATE: _bindgen_ty_174 = 5; -pub const TCA_FCNT: _bindgen_ty_174 = 6; -pub const TCA_STATS2: _bindgen_ty_174 = 7; -pub const TCA_STAB: _bindgen_ty_174 = 8; -pub const TCA_PAD: _bindgen_ty_174 = 9; -pub const TCA_DUMP_INVISIBLE: _bindgen_ty_174 = 10; -pub const TCA_CHAIN: _bindgen_ty_174 = 11; -pub const TCA_HW_OFFLOAD: _bindgen_ty_174 = 12; -pub const TCA_INGRESS_BLOCK: _bindgen_ty_174 = 13; -pub const TCA_EGRESS_BLOCK: _bindgen_ty_174 = 14; -pub const TCA_DUMP_FLAGS: _bindgen_ty_174 = 15; -pub const TCA_EXT_WARN_MSG: _bindgen_ty_174 = 16; -pub const __TCA_MAX: _bindgen_ty_174 = 17; -pub type _bindgen_ty_174 = ::core::ffi::c_uint; +pub const TCA_UNSPEC: _bindgen_ty_176 = 0; +pub const TCA_KIND: _bindgen_ty_176 = 1; +pub const TCA_OPTIONS: _bindgen_ty_176 = 2; +pub const TCA_STATS: _bindgen_ty_176 = 3; +pub const TCA_XSTATS: _bindgen_ty_176 = 4; +pub const TCA_RATE: _bindgen_ty_176 = 5; +pub const TCA_FCNT: _bindgen_ty_176 = 6; +pub const TCA_STATS2: _bindgen_ty_176 = 7; +pub const TCA_STAB: _bindgen_ty_176 = 8; +pub const TCA_PAD: _bindgen_ty_176 = 9; +pub const TCA_DUMP_INVISIBLE: _bindgen_ty_176 = 10; +pub const TCA_CHAIN: _bindgen_ty_176 = 11; +pub const TCA_HW_OFFLOAD: _bindgen_ty_176 = 12; +pub const TCA_INGRESS_BLOCK: _bindgen_ty_176 = 13; +pub const TCA_EGRESS_BLOCK: _bindgen_ty_176 = 14; +pub const TCA_DUMP_FLAGS: _bindgen_ty_176 = 15; +pub const TCA_EXT_WARN_MSG: _bindgen_ty_176 = 16; +pub const __TCA_MAX: _bindgen_ty_176 = 17; +pub type _bindgen_ty_176 = ::core::ffi::c_uint; diff --git a/aya-obj/src/generated/linux_bindings_x86_64.rs b/aya-obj/src/generated/linux_bindings_x86_64.rs index b76ed850..aff50e13 100644 --- a/aya-obj/src/generated/linux_bindings_x86_64.rs +++ b/aya-obj/src/generated/linux_bindings_x86_64.rs @@ -2105,6 +2105,22 @@ pub struct btf_var_secinfo { pub struct btf_decl_tag { pub component_idx: __s32, } +pub const HW_BREAKPOINT_LEN_1: _bindgen_ty_44 = 1; +pub const HW_BREAKPOINT_LEN_2: _bindgen_ty_44 = 2; +pub const HW_BREAKPOINT_LEN_3: _bindgen_ty_44 = 3; +pub const HW_BREAKPOINT_LEN_4: _bindgen_ty_44 = 4; +pub const HW_BREAKPOINT_LEN_5: _bindgen_ty_44 = 5; +pub const HW_BREAKPOINT_LEN_6: _bindgen_ty_44 = 6; +pub const HW_BREAKPOINT_LEN_7: _bindgen_ty_44 = 7; +pub const HW_BREAKPOINT_LEN_8: _bindgen_ty_44 = 8; +pub type _bindgen_ty_44 = ::core::ffi::c_uint; +pub const HW_BREAKPOINT_EMPTY: _bindgen_ty_45 = 0; +pub const HW_BREAKPOINT_R: _bindgen_ty_45 = 1; +pub const HW_BREAKPOINT_W: _bindgen_ty_45 = 2; +pub const HW_BREAKPOINT_RW: _bindgen_ty_45 = 3; +pub const HW_BREAKPOINT_X: _bindgen_ty_45 = 4; +pub const HW_BREAKPOINT_INVALID: _bindgen_ty_45 = 7; +pub type _bindgen_ty_45 = ::core::ffi::c_uint; impl nlmsgerr_attrs { pub const NLMSGERR_ATTR_MAX: nlmsgerr_attrs = nlmsgerr_attrs::NLMSGERR_ATTR_COOKIE; } @@ -2117,17 +2133,17 @@ pub enum nlmsgerr_attrs { NLMSGERR_ATTR_COOKIE = 3, __NLMSGERR_ATTR_MAX = 4, } -pub const IFLA_XDP_UNSPEC: _bindgen_ty_92 = 0; -pub const IFLA_XDP_FD: _bindgen_ty_92 = 1; -pub const IFLA_XDP_ATTACHED: _bindgen_ty_92 = 2; -pub const IFLA_XDP_FLAGS: _bindgen_ty_92 = 3; -pub const IFLA_XDP_PROG_ID: _bindgen_ty_92 = 4; -pub const IFLA_XDP_DRV_PROG_ID: _bindgen_ty_92 = 5; -pub const IFLA_XDP_SKB_PROG_ID: _bindgen_ty_92 = 6; -pub const IFLA_XDP_HW_PROG_ID: _bindgen_ty_92 = 7; -pub const IFLA_XDP_EXPECTED_FD: _bindgen_ty_92 = 8; -pub const __IFLA_XDP_MAX: _bindgen_ty_92 = 9; -pub type _bindgen_ty_92 = ::core::ffi::c_uint; +pub const IFLA_XDP_UNSPEC: _bindgen_ty_94 = 0; +pub const IFLA_XDP_FD: _bindgen_ty_94 = 1; +pub const IFLA_XDP_ATTACHED: _bindgen_ty_94 = 2; +pub const IFLA_XDP_FLAGS: _bindgen_ty_94 = 3; +pub const IFLA_XDP_PROG_ID: _bindgen_ty_94 = 4; +pub const IFLA_XDP_DRV_PROG_ID: _bindgen_ty_94 = 5; +pub const IFLA_XDP_SKB_PROG_ID: _bindgen_ty_94 = 6; +pub const IFLA_XDP_HW_PROG_ID: _bindgen_ty_94 = 7; +pub const IFLA_XDP_EXPECTED_FD: _bindgen_ty_94 = 8; +pub const __IFLA_XDP_MAX: _bindgen_ty_94 = 9; +pub type _bindgen_ty_94 = ::core::ffi::c_uint; impl nf_inet_hooks { pub const NF_INET_INGRESS: nf_inet_hooks = nf_inet_hooks::NF_INET_NUMHOOKS; } @@ -2141,16 +2157,16 @@ pub enum nf_inet_hooks { NF_INET_POST_ROUTING = 4, NF_INET_NUMHOOKS = 5, } -pub const NFPROTO_UNSPEC: _bindgen_ty_99 = 0; -pub const NFPROTO_INET: _bindgen_ty_99 = 1; -pub const NFPROTO_IPV4: _bindgen_ty_99 = 2; -pub const NFPROTO_ARP: _bindgen_ty_99 = 3; -pub const NFPROTO_NETDEV: _bindgen_ty_99 = 5; -pub const NFPROTO_BRIDGE: _bindgen_ty_99 = 7; -pub const NFPROTO_IPV6: _bindgen_ty_99 = 10; -pub const NFPROTO_DECNET: _bindgen_ty_99 = 12; -pub const NFPROTO_NUMPROTO: _bindgen_ty_99 = 13; -pub type _bindgen_ty_99 = ::core::ffi::c_uint; +pub const NFPROTO_UNSPEC: _bindgen_ty_101 = 0; +pub const NFPROTO_INET: _bindgen_ty_101 = 1; +pub const NFPROTO_IPV4: _bindgen_ty_101 = 2; +pub const NFPROTO_ARP: _bindgen_ty_101 = 3; +pub const NFPROTO_NETDEV: _bindgen_ty_101 = 5; +pub const NFPROTO_BRIDGE: _bindgen_ty_101 = 7; +pub const NFPROTO_IPV6: _bindgen_ty_101 = 10; +pub const NFPROTO_DECNET: _bindgen_ty_101 = 12; +pub const NFPROTO_NUMPROTO: _bindgen_ty_101 = 13; +pub type _bindgen_ty_101 = ::core::ffi::c_uint; #[repr(u32)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub enum perf_type_id { @@ -4111,20 +4127,20 @@ pub enum perf_event_type { PERF_RECORD_AUX_OUTPUT_HW_ID = 21, PERF_RECORD_MAX = 22, } -pub const TCA_BPF_UNSPEC: _bindgen_ty_154 = 0; -pub const TCA_BPF_ACT: _bindgen_ty_154 = 1; -pub const TCA_BPF_POLICE: _bindgen_ty_154 = 2; -pub const TCA_BPF_CLASSID: _bindgen_ty_154 = 3; -pub const TCA_BPF_OPS_LEN: _bindgen_ty_154 = 4; -pub const TCA_BPF_OPS: _bindgen_ty_154 = 5; -pub const TCA_BPF_FD: _bindgen_ty_154 = 6; -pub const TCA_BPF_NAME: _bindgen_ty_154 = 7; -pub const TCA_BPF_FLAGS: _bindgen_ty_154 = 8; -pub const TCA_BPF_FLAGS_GEN: _bindgen_ty_154 = 9; -pub const TCA_BPF_TAG: _bindgen_ty_154 = 10; -pub const TCA_BPF_ID: _bindgen_ty_154 = 11; -pub const __TCA_BPF_MAX: _bindgen_ty_154 = 12; -pub type _bindgen_ty_154 = ::core::ffi::c_uint; +pub const TCA_BPF_UNSPEC: _bindgen_ty_156 = 0; +pub const TCA_BPF_ACT: _bindgen_ty_156 = 1; +pub const TCA_BPF_POLICE: _bindgen_ty_156 = 2; +pub const TCA_BPF_CLASSID: _bindgen_ty_156 = 3; +pub const TCA_BPF_OPS_LEN: _bindgen_ty_156 = 4; +pub const TCA_BPF_OPS: _bindgen_ty_156 = 5; +pub const TCA_BPF_FD: _bindgen_ty_156 = 6; +pub const TCA_BPF_NAME: _bindgen_ty_156 = 7; +pub const TCA_BPF_FLAGS: _bindgen_ty_156 = 8; +pub const TCA_BPF_FLAGS_GEN: _bindgen_ty_156 = 9; +pub const TCA_BPF_TAG: _bindgen_ty_156 = 10; +pub const TCA_BPF_ID: _bindgen_ty_156 = 11; +pub const __TCA_BPF_MAX: _bindgen_ty_156 = 12; +pub type _bindgen_ty_156 = ::core::ffi::c_uint; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct ifinfomsg { @@ -4146,22 +4162,22 @@ pub struct tcmsg { pub tcm_parent: __u32, pub tcm_info: __u32, } -pub const TCA_UNSPEC: _bindgen_ty_174 = 0; -pub const TCA_KIND: _bindgen_ty_174 = 1; -pub const TCA_OPTIONS: _bindgen_ty_174 = 2; -pub const TCA_STATS: _bindgen_ty_174 = 3; -pub const TCA_XSTATS: _bindgen_ty_174 = 4; -pub const TCA_RATE: _bindgen_ty_174 = 5; -pub const TCA_FCNT: _bindgen_ty_174 = 6; -pub const TCA_STATS2: _bindgen_ty_174 = 7; -pub const TCA_STAB: _bindgen_ty_174 = 8; -pub const TCA_PAD: _bindgen_ty_174 = 9; -pub const TCA_DUMP_INVISIBLE: _bindgen_ty_174 = 10; -pub const TCA_CHAIN: _bindgen_ty_174 = 11; -pub const TCA_HW_OFFLOAD: _bindgen_ty_174 = 12; -pub const TCA_INGRESS_BLOCK: _bindgen_ty_174 = 13; -pub const TCA_EGRESS_BLOCK: _bindgen_ty_174 = 14; -pub const TCA_DUMP_FLAGS: _bindgen_ty_174 = 15; -pub const TCA_EXT_WARN_MSG: _bindgen_ty_174 = 16; -pub const __TCA_MAX: _bindgen_ty_174 = 17; -pub type _bindgen_ty_174 = ::core::ffi::c_uint; +pub const TCA_UNSPEC: _bindgen_ty_176 = 0; +pub const TCA_KIND: _bindgen_ty_176 = 1; +pub const TCA_OPTIONS: _bindgen_ty_176 = 2; +pub const TCA_STATS: _bindgen_ty_176 = 3; +pub const TCA_XSTATS: _bindgen_ty_176 = 4; +pub const TCA_RATE: _bindgen_ty_176 = 5; +pub const TCA_FCNT: _bindgen_ty_176 = 6; +pub const TCA_STATS2: _bindgen_ty_176 = 7; +pub const TCA_STAB: _bindgen_ty_176 = 8; +pub const TCA_PAD: _bindgen_ty_176 = 9; +pub const TCA_DUMP_INVISIBLE: _bindgen_ty_176 = 10; +pub const TCA_CHAIN: _bindgen_ty_176 = 11; +pub const TCA_HW_OFFLOAD: _bindgen_ty_176 = 12; +pub const TCA_INGRESS_BLOCK: _bindgen_ty_176 = 13; +pub const TCA_EGRESS_BLOCK: _bindgen_ty_176 = 14; +pub const TCA_DUMP_FLAGS: _bindgen_ty_176 = 15; +pub const TCA_EXT_WARN_MSG: _bindgen_ty_176 = 16; +pub const __TCA_MAX: _bindgen_ty_176 = 17; +pub type _bindgen_ty_176 = ::core::ffi::c_uint; diff --git a/aya/src/programs/perf_event.rs b/aya/src/programs/perf_event.rs index 0b52bd04..93421ba7 100644 --- a/aya/src/programs/perf_event.rs +++ b/aya/src/programs/perf_event.rs @@ -3,7 +3,9 @@ use std::os::fd::AsFd as _; use aya_obj::generated::{ - bpf_link_type, bpf_prog_type::BPF_PROG_TYPE_PERF_EVENT, perf_hw_cache_id, perf_hw_cache_op_id, + HW_BREAKPOINT_LEN_1, HW_BREAKPOINT_LEN_2, HW_BREAKPOINT_LEN_4, HW_BREAKPOINT_LEN_8, + HW_BREAKPOINT_R, HW_BREAKPOINT_RW, HW_BREAKPOINT_W, bpf_link_type, + bpf_prog_type::BPF_PROG_TYPE_PERF_EVENT, perf_hw_cache_id, perf_hw_cache_op_id, perf_hw_cache_op_result_id, perf_hw_id, perf_sw_ids, perf_type_id, }; @@ -11,8 +13,8 @@ use crate::{ programs::{ FdLink, LinkError, ProgramData, ProgramError, ProgramType, impl_try_into_fdlink, links::define_link_wrapper, - load_program, perf_attach, - perf_attach::{PerfLinkIdInner, PerfLinkInner}, + load_program, + perf_attach::{PerfLinkIdInner, PerfLinkInner, perf_attach}, }, sys::{SyscallError, bpf_link_get_info_by_fd, perf_event_open}, }; @@ -52,12 +54,8 @@ pub enum PerfEventConfig { event_id: u64, }, /// A hardware breakpoint. - /// - /// Note: this variant is not fully implemented at the moment. - // TODO: Variant not fully implemented due to additional `perf_event_attr` fields like - // `bp_type`, `bp_addr`, etc. #[doc(alias = "PERF_TYPE_BREAKPOINT")] - Breakpoint, + Breakpoint(BreakpointConfig), /// The dynamic PMU (Performance Monitor Unit) event to report. /// /// Available PMU's may be found under `/sys/bus/event_source/devices`. @@ -276,6 +274,74 @@ impl HwCacheResult { } } +/// The breakpoint type. +#[repr(u32)] +#[derive(Debug, Clone, Copy)] +pub enum PerfBreakpointType { + /// HW_BREAKPOINT_R, trigger when we read the memory location. + #[doc(alias = "HW_BREAKPOINT_R")] + Read = HW_BREAKPOINT_R, + /// HW_BREAKPOINT_W, trigger when we write the memory location. + #[doc(alias = "HW_BREAKPOINT_W")] + Write = HW_BREAKPOINT_W, + /// HW_BREAKPOINT_RW, trigger when we read or write the memory location. + #[doc(alias = "HW_BREAKPOINT_RW")] + ReadWrite = HW_BREAKPOINT_RW, +} + +impl PerfBreakpointType { + pub(crate) const fn into_primitive(self) -> u32 { + const _: [(); 4] = [(); std::mem::size_of::()]; + self as u32 + } +} + +/// The number of bytes covered by a data breakpoint. +#[repr(u32)] +#[derive(Debug, Clone, Copy)] +pub enum PerfBreakpointLength { + /// HW_BREAKPOINT_LEN_1 + #[doc(alias = "HW_BREAKPOINT_LEN_1")] + Len1 = HW_BREAKPOINT_LEN_1, + /// HW_BREAKPOINT_LEN_2 + #[doc(alias = "HW_BREAKPOINT_LEN_2")] + Len2 = HW_BREAKPOINT_LEN_2, + /// HW_BREAKPOINT_LEN_4 + #[doc(alias = "HW_BREAKPOINT_LEN_4")] + Len4 = HW_BREAKPOINT_LEN_4, + /// HW_BREAKPOINT_LEN_8 + #[doc(alias = "HW_BREAKPOINT_LEN_8")] + Len8 = HW_BREAKPOINT_LEN_8, +} + +impl PerfBreakpointLength { + pub(crate) const fn into_primitive(self) -> u32 { + const _: [(); 4] = [(); std::mem::size_of::()]; + self as u32 + } +} + +/// Type of hardware breakpoint, determines if we break on read, write, or +/// execute, or if there should be no breakpoint on the given address. +#[derive(Debug, Clone, Copy)] +pub enum BreakpointConfig { + /// A memory access breakpoint. + Data { + /// The type of the breakpoint. + r#type: PerfBreakpointType, + /// The address of the breakpoint. + address: u64, + /// The contiguous byte window to monitor starting at `address`. + length: PerfBreakpointLength, + }, + /// A code execution breakpoint. + #[doc(alias = "HW_BREAKPOINT_X")] + Instruction { + /// The address of the breakpoint. + address: u64, + }, +} + /// Sample Policy #[derive(Debug, Clone, Copy)] pub enum SamplePolicy { @@ -306,7 +372,7 @@ pub enum PerfEventScope { /// one process OneProcess { /// process id - pid: i32, + pid: u32, /// cpu id or any cpu if None cpu: Option, }, @@ -376,13 +442,10 @@ impl PerfEvent { /// Attaches to the given perf event. /// - /// [`perf_type`](PerfEventConfig) defines the event `type` and `config` of interest. - /// - /// [`scope`](PerfEventScope) determines which processes are sampled. If `inherit` is - /// `true`, any new processes spawned by those processes will also automatically be - /// sampled. + /// If `inherit` is `true`, any new processes spawned by those processes + /// will also automatically be sampled. /// - /// The returned value can be used to detach, see [PerfEvent::detach]. + /// The returned value can be used to detach, see [`Self::detach`]. pub fn attach( &mut self, config: PerfEventConfig, diff --git a/aya/src/sys/perf_event.rs b/aya/src/sys/perf_event.rs index 3514ef4e..b9de4c71 100644 --- a/aya/src/sys/perf_event.rs +++ b/aya/src/sys/perf_event.rs @@ -1,11 +1,12 @@ use std::{ - ffi::{CString, OsStr, c_int}, + ffi::{CString, OsStr, c_int, c_long, c_uint}, io, mem, os::fd::{BorrowedFd, FromRawFd as _}, }; use aya_obj::generated::{ - PERF_FLAG_FD_CLOEXEC, perf_event_attr, + HW_BREAKPOINT_LEN_1, HW_BREAKPOINT_LEN_2, HW_BREAKPOINT_LEN_4, HW_BREAKPOINT_LEN_8, + HW_BREAKPOINT_X, PERF_FLAG_FD_CLOEXEC, perf_event_attr, perf_event_sample_format::PERF_SAMPLE_RAW, perf_type_id::{ PERF_TYPE_BREAKPOINT, PERF_TYPE_HARDWARE, PERF_TYPE_HW_CACHE, PERF_TYPE_RAW, @@ -16,7 +17,8 @@ use libc::pid_t; use super::{PerfEventIoctlRequest, Syscall, syscall}; use crate::programs::perf_event::{ - PerfEventConfig, PerfEventScope, SamplePolicy, SoftwareEvent, WakeupPolicy, perf_type_id_to_u32, + BreakpointConfig, PerfEventConfig, PerfEventScope, SamplePolicy, SoftwareEvent, WakeupPolicy, + perf_type_id_to_u32, }; pub(crate) fn perf_event_open( @@ -53,7 +55,42 @@ pub(crate) fn perf_event_open( | (u64::from(result.into_primitive()) << 16), ), PerfEventConfig::Raw { event_id } => (perf_type_id_to_u32(PERF_TYPE_RAW), event_id), - PerfEventConfig::Breakpoint => (perf_type_id_to_u32(PERF_TYPE_BREAKPOINT), 0), + PerfEventConfig::Breakpoint(breakpoint) => { + let (type_, address, length) = match breakpoint { + BreakpointConfig::Data { + r#type, + address, + length, + } => ( + r#type.into_primitive(), + address, + u64::from(length.into_primitive()), + ), + BreakpointConfig::Instruction { address } => { + const fn length(size: usize) -> c_uint { + match size { + 1 => HW_BREAKPOINT_LEN_1, + 2 => HW_BREAKPOINT_LEN_2, + 4 => HW_BREAKPOINT_LEN_4, + 8 => HW_BREAKPOINT_LEN_8, + // NB: cannot emit the value because: + // + // error[E0015]: cannot call non-const formatting macro in constant functions + _ => panic!("invalid hardware breakpoint size"), + } + } + const LENGTH: c_uint = length(std::mem::size_of::()); + (HW_BREAKPOINT_X, address, u64::from(LENGTH)) + } + }; + + attr.bp_type = type_; + attr.__bindgen_anon_3.bp_addr = address; + attr.__bindgen_anon_4.bp_len = length; + attr.set_precise_ip(2); + + (perf_type_id_to_u32(PERF_TYPE_BREAKPOINT), 0) + } }; attr.config = config; @@ -84,7 +121,7 @@ pub(crate) fn perf_event_open( let (pid, cpu) = match scope { PerfEventScope::CallingProcess { cpu } => (0, cpu.map_or(-1, |cpu| cpu as i32)), - PerfEventScope::OneProcess { pid, cpu } => (pid, cpu.map_or(-1, |cpu| cpu as i32)), + PerfEventScope::OneProcess { pid, cpu } => (pid as i32, cpu.map_or(-1, |cpu| cpu as i32)), PerfEventScope::AllProcessesOneCpu { cpu } => (-1, cpu as i32), }; diff --git a/ebpf/aya-ebpf-bindings/include/bindings.h b/ebpf/aya-ebpf-bindings/include/bindings.h index aa831c57..ba2f9183 100644 --- a/ebpf/aya-ebpf-bindings/include/bindings.h +++ b/ebpf/aya-ebpf-bindings/include/bindings.h @@ -6,6 +6,7 @@ typedef __u32 __bitwise __wsum; #include #include +#include // needed for TC_ACT_* #include #include diff --git a/ebpf/aya-ebpf-bindings/src/aarch64/bindings.rs b/ebpf/aya-ebpf-bindings/src/aarch64/bindings.rs index 87ef0587..473db3c6 100644 --- a/ebpf/aya-ebpf-bindings/src/aarch64/bindings.rs +++ b/ebpf/aya-ebpf-bindings/src/aarch64/bindings.rs @@ -365,11 +365,6 @@ pub type __be32 = __u32; pub type __wsum = __u32; #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct bpf_perf_event_data { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] pub struct linux_binprm { _unused: [u8; 0], } @@ -2887,6 +2882,14 @@ pub struct user_pt_regs { pub pc: __u64, pub pstate: __u64, } +pub type bpf_user_pt_regs_t = user_pt_regs; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct bpf_perf_event_data { + pub regs: bpf_user_pt_regs_t, + pub sample_period: __u64, + pub addr: __u64, +} pub type sa_family_t = ::aya_ebpf_cty::c_ushort; #[repr(C)] #[derive(Debug, Copy, Clone)] diff --git a/ebpf/aya-ebpf-bindings/src/armv7/bindings.rs b/ebpf/aya-ebpf-bindings/src/armv7/bindings.rs index 54140c49..50c1d6f7 100644 --- a/ebpf/aya-ebpf-bindings/src/armv7/bindings.rs +++ b/ebpf/aya-ebpf-bindings/src/armv7/bindings.rs @@ -365,11 +365,6 @@ pub type __be32 = __u32; pub type __wsum = __u32; #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct bpf_perf_event_data { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] pub struct linux_binprm { _unused: [u8; 0], } @@ -2896,6 +2891,14 @@ pub struct bpf_iter_num { pub struct pt_regs { pub uregs: [::aya_ebpf_cty::c_long; 18usize], } +pub type bpf_user_pt_regs_t = pt_regs; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct bpf_perf_event_data { + pub regs: bpf_user_pt_regs_t, + pub sample_period: __u64, + pub addr: __u64, +} pub type sa_family_t = ::aya_ebpf_cty::c_ushort; #[repr(C)] #[derive(Debug, Copy, Clone)] diff --git a/ebpf/aya-ebpf-bindings/src/loongarch64/bindings.rs b/ebpf/aya-ebpf-bindings/src/loongarch64/bindings.rs index f769d7b9..4ffb76ce 100644 --- a/ebpf/aya-ebpf-bindings/src/loongarch64/bindings.rs +++ b/ebpf/aya-ebpf-bindings/src/loongarch64/bindings.rs @@ -365,11 +365,6 @@ pub type __be32 = __u32; pub type __wsum = __u32; #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct bpf_perf_event_data { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] pub struct linux_binprm { _unused: [u8; 0], } @@ -2888,6 +2883,14 @@ pub struct user_pt_regs { pub csr_badv: ::aya_ebpf_cty::c_ulong, pub reserved: [::aya_ebpf_cty::c_ulong; 10usize], } +pub type bpf_user_pt_regs_t = user_pt_regs; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct bpf_perf_event_data { + pub regs: bpf_user_pt_regs_t, + pub sample_period: __u64, + pub addr: __u64, +} pub type sa_family_t = ::aya_ebpf_cty::c_ushort; #[repr(C)] #[derive(Debug, Copy, Clone)] diff --git a/ebpf/aya-ebpf-bindings/src/mips/bindings.rs b/ebpf/aya-ebpf-bindings/src/mips/bindings.rs index 65333c5c..1bacaa53 100644 --- a/ebpf/aya-ebpf-bindings/src/mips/bindings.rs +++ b/ebpf/aya-ebpf-bindings/src/mips/bindings.rs @@ -366,11 +366,6 @@ pub type __be32 = __u32; pub type __wsum = __u32; #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct bpf_perf_event_data { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] pub struct linux_binprm { _unused: [u8; 0], } @@ -2903,6 +2898,14 @@ pub struct pt_regs { pub cp0_status: __u64, pub cp0_cause: __u64, } +pub type bpf_user_pt_regs_t = pt_regs; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct bpf_perf_event_data { + pub regs: bpf_user_pt_regs_t, + pub sample_period: __u64, + pub addr: __u64, +} pub type sa_family_t = ::aya_ebpf_cty::c_ushort; #[repr(C)] #[derive(Debug, Copy, Clone)] diff --git a/ebpf/aya-ebpf-bindings/src/powerpc64/bindings.rs b/ebpf/aya-ebpf-bindings/src/powerpc64/bindings.rs index bc1388bf..7e46bcb7 100644 --- a/ebpf/aya-ebpf-bindings/src/powerpc64/bindings.rs +++ b/ebpf/aya-ebpf-bindings/src/powerpc64/bindings.rs @@ -365,11 +365,6 @@ pub type __be32 = __u32; pub type __wsum = __u32; #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct bpf_perf_event_data { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] pub struct linux_binprm { _unused: [u8; 0], } @@ -2891,6 +2886,14 @@ pub struct pt_regs { pub dsisr: ::aya_ebpf_cty::c_ulong, pub result: ::aya_ebpf_cty::c_ulong, } +pub type bpf_user_pt_regs_t = pt_regs; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct bpf_perf_event_data { + pub regs: bpf_user_pt_regs_t, + pub sample_period: __u64, + pub addr: __u64, +} pub type sa_family_t = ::aya_ebpf_cty::c_ushort; #[repr(C)] #[derive(Debug, Copy, Clone)] diff --git a/ebpf/aya-ebpf-bindings/src/riscv64/bindings.rs b/ebpf/aya-ebpf-bindings/src/riscv64/bindings.rs index 98b85819..c90a7d2a 100644 --- a/ebpf/aya-ebpf-bindings/src/riscv64/bindings.rs +++ b/ebpf/aya-ebpf-bindings/src/riscv64/bindings.rs @@ -365,11 +365,6 @@ pub type __be32 = __u32; pub type __wsum = __u32; #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct bpf_perf_event_data { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] pub struct linux_binprm { _unused: [u8; 0], } @@ -2915,6 +2910,14 @@ pub struct user_regs_struct { pub t5: ::aya_ebpf_cty::c_ulong, pub t6: ::aya_ebpf_cty::c_ulong, } +pub type bpf_user_pt_regs_t = user_regs_struct; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct bpf_perf_event_data { + pub regs: bpf_user_pt_regs_t, + pub sample_period: __u64, + pub addr: __u64, +} pub type sa_family_t = ::aya_ebpf_cty::c_ushort; #[repr(C)] #[derive(Debug, Copy, Clone)] diff --git a/ebpf/aya-ebpf-bindings/src/s390x/bindings.rs b/ebpf/aya-ebpf-bindings/src/s390x/bindings.rs index 15804301..015cafe7 100644 --- a/ebpf/aya-ebpf-bindings/src/s390x/bindings.rs +++ b/ebpf/aya-ebpf-bindings/src/s390x/bindings.rs @@ -365,11 +365,6 @@ pub type __be32 = __u32; pub type __wsum = __u32; #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct bpf_perf_event_data { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] pub struct linux_binprm { _unused: [u8; 0], } @@ -3848,6 +3843,14 @@ pub struct user_regs_struct { pub per_info: per_struct, pub ieee_instruction_pointer: ::aya_ebpf_cty::c_ulong, } +pub type bpf_user_pt_regs_t = user_pt_regs; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct bpf_perf_event_data { + pub regs: bpf_user_pt_regs_t, + pub sample_period: __u64, + pub addr: __u64, +} pub type sa_family_t = ::aya_ebpf_cty::c_ushort; #[repr(C)] #[derive(Debug, Copy, Clone)] diff --git a/ebpf/aya-ebpf-bindings/src/x86_64/bindings.rs b/ebpf/aya-ebpf-bindings/src/x86_64/bindings.rs index 89fec488..72c24b75 100644 --- a/ebpf/aya-ebpf-bindings/src/x86_64/bindings.rs +++ b/ebpf/aya-ebpf-bindings/src/x86_64/bindings.rs @@ -365,11 +365,6 @@ pub type __be32 = __u32; pub type __wsum = __u32; #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct bpf_perf_event_data { - _unused: [u8; 0], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] pub struct linux_binprm { _unused: [u8; 0], } @@ -2899,6 +2894,14 @@ pub struct pt_regs { pub rsp: ::aya_ebpf_cty::c_ulong, pub ss: ::aya_ebpf_cty::c_ulong, } +pub type bpf_user_pt_regs_t = pt_regs; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct bpf_perf_event_data { + pub regs: bpf_user_pt_regs_t, + pub sample_period: __u64, + pub addr: __u64, +} pub type sa_family_t = ::aya_ebpf_cty::c_ushort; #[repr(C)] #[derive(Debug, Copy, Clone)] diff --git a/ebpf/aya-ebpf/src/programs/perf_event.rs b/ebpf/aya-ebpf/src/programs/perf_event.rs index d847fc31..f8de1c0a 100644 --- a/ebpf/aya-ebpf/src/programs/perf_event.rs +++ b/ebpf/aya-ebpf/src/programs/perf_event.rs @@ -1,19 +1,21 @@ use core::ffi::c_void; +use aya_ebpf_bindings::bindings::bpf_perf_event_data; + use crate::EbpfContext; pub struct PerfEventContext { - ctx: *mut c_void, + pub ctx: *mut bpf_perf_event_data, } impl PerfEventContext { - pub fn new(ctx: *mut c_void) -> Self { + pub fn new(ctx: *mut bpf_perf_event_data) -> Self { Self { ctx } } } impl EbpfContext for PerfEventContext { fn as_ptr(&self) -> *mut c_void { - self.ctx + self.ctx.cast() } } diff --git a/test/integration-ebpf/Cargo.toml b/test/integration-ebpf/Cargo.toml index cb52e728..33715cfb 100644 --- a/test/integration-ebpf/Cargo.toml +++ b/test/integration-ebpf/Cargo.toml @@ -103,3 +103,7 @@ path = "src/xdp_sec.rs" [[bin]] name = "uprobe_cookie" path = "src/uprobe_cookie.rs" + +[[bin]] +name = "perf_event_bp" +path = "src/perf_event_bp.rs" diff --git a/test/integration-ebpf/src/perf_event_bp.rs b/test/integration-ebpf/src/perf_event_bp.rs new file mode 100644 index 00000000..f6928c01 --- /dev/null +++ b/test/integration-ebpf/src/perf_event_bp.rs @@ -0,0 +1,24 @@ +#![no_std] +#![no_main] +#![expect(unused_crate_dependencies, reason = "used in other bins")] + +use aya_ebpf::{ + EbpfContext as _, + macros::{map, perf_event}, + maps::HashMap, + programs::PerfEventContext, +}; + +#[cfg(not(test))] +extern crate ebpf_panic; + +#[map] +static READERS: HashMap = HashMap::with_max_entries(1, 0); + +#[perf_event] +fn perf_event_bp(ctx: PerfEventContext) -> u32 { + let tgid = ctx.tgid(); + let addr = unsafe { (*ctx.ctx).addr }; + let _ = READERS.insert(tgid, addr, 0); + 0 +} diff --git a/test/integration-test/src/lib.rs b/test/integration-test/src/lib.rs index 64f37d18..01e26f03 100644 --- a/test/integration-test/src/lib.rs +++ b/test/integration-test/src/lib.rs @@ -46,6 +46,7 @@ bpf_file!( MEMMOVE_TEST => "memmove_test", NAME_TEST => "name_test", PASS => "pass", + PERF_EVENT_BP => "perf_event_bp", RAW_TRACEPOINT => "raw_tracepoint", REDIRECT => "redirect", RELOCATIONS => "relocations", diff --git a/test/integration-test/src/tests.rs b/test/integration-test/src/tests.rs index 8c605313..4de831aa 100644 --- a/test/integration-test/src/tests.rs +++ b/test/integration-test/src/tests.rs @@ -11,6 +11,7 @@ mod log; mod lsm; mod map_pin; mod maps_disjoint; +mod perf_event_bp; mod raw_tracepoint; mod rbpf; mod relocations; diff --git a/test/integration-test/src/tests/perf_event_bp.rs b/test/integration-test/src/tests/perf_event_bp.rs new file mode 100644 index 00000000..5667fdc5 --- /dev/null +++ b/test/integration-test/src/tests/perf_event_bp.rs @@ -0,0 +1,320 @@ +use std::{collections::HashMap, fs, io::ErrorKind, num::ParseIntError, path::PathBuf}; + +use assert_matches::assert_matches; +use aya::{ + Ebpf, maps, + programs::{ + ProgramError, + perf_event::{ + BreakpointConfig, PerfBreakpointLength, PerfBreakpointType, PerfEventConfig, + PerfEventScope, SamplePolicy, + }, + }, + sys::SyscallError, + util::online_cpus, +}; +use scopeguard::defer; + +fn find_system_map() -> Vec { + const BOOT_PATH: &str = "/boot/"; + const SYSTEM_MAP_PREFIX: &str = "System.map-"; + let mut system_maps = Vec::new(); + for (i, entry) in fs::read_dir(BOOT_PATH) + .unwrap_or_else(|error| panic!("fs::read_dir({BOOT_PATH}): {error:?}")) + .enumerate() + { + let entry = entry.unwrap_or_else(|error| { + panic!("fs::read_dir({BOOT_PATH}).enumerate().nth({i}): {error:?}") + }); + if !entry + .file_name() + .as_encoded_bytes() + .starts_with(SYSTEM_MAP_PREFIX.as_bytes()) + { + continue; + } + system_maps.push(entry.path()); + } + system_maps +} + +struct KernelSymbol<'a> { + address: u64, + #[expect(dead_code)] + r#type: &'a str, + name: &'a str, + #[expect(dead_code)] + module: Option<&'a str>, +} + +fn parse_kernel_symbol(line: &str) -> Option> { + let mut parts = line.splitn(4, char::is_whitespace); + let address = parts.next()?; + let r#type = parts.next()?; + let name = parts.next()?; + let module = parts.next(); + // TODO(https://github.com/rust-lang/rust-clippy/issues/14112): Remove this allowance + // when the lint behaves more sensibly. + #[expect(clippy::manual_ok_err)] + let address = match u64::from_str_radix(address, 16) { + Ok(address) => Some(address), + Err(ParseIntError { .. }) => None, + }?; + Some(KernelSymbol { + address, + r#type, + name, + module, + }) +} + +fn parse_kernel_symbols(content: &str) -> HashMap<&str, Vec> { + let mut kernel_symbols = HashMap::<_, Vec<_>>::new(); + for line in content.lines() { + let KernelSymbol { + address, + r#type: _, + name, + module: _, + } = parse_kernel_symbol(line).unwrap_or_else(|| panic!("parse_kernel_symbol({line})")); + kernel_symbols.entry(name).or_default().push(address); + } + kernel_symbols +} + +#[track_caller] +fn run_breakpoint_case(config: BreakpointConfig, mut trigger: F, expected_addr: u64) +where + F: FnMut(), +{ + let mut bpf = Ebpf::load(crate::PERF_EVENT_BP).unwrap(); + + let map: maps::HashMap<_, u32, u64> = bpf.take_map("READERS").unwrap().try_into().unwrap(); + + let prog: &mut aya::programs::PerfEvent = bpf + .program_mut("perf_event_bp") + .unwrap() + .try_into() + .unwrap(); + prog.load().unwrap(); + + // x86 debug registers cannot trigger on read-only watchpoints, so the + // kernel rejects `HW_BREAKPOINT_R` outright, see + // https://github.com/torvalds/linux/blob/v6.12/arch/x86/kernel/hw_breakpoint.c#L345-L377. + let type_supported = !(cfg!(target_arch = "x86_64") + && matches!( + config, + BreakpointConfig::Data { + r#type: PerfBreakpointType::Read, + .. + } + )); + + let mut calling_process_scopes = Vec::new(); + let mut one_process_scopes = Vec::new(); + let mut all_processes_one_cpu_scopes = Vec::new(); + + let pid = std::process::id(); + for cpu in online_cpus().unwrap() { + calling_process_scopes.push(PerfEventScope::CallingProcess { cpu: Some(cpu) }); + one_process_scopes.push(PerfEventScope::OneProcess { + pid, + cpu: Some(cpu), + }); + all_processes_one_cpu_scopes.push(PerfEventScope::AllProcessesOneCpu { cpu }); + } + + let scope_groups = &[ + &[PerfEventScope::CallingProcess { cpu: None }][..], + &[PerfEventScope::OneProcess { pid, cpu: None }][..], + calling_process_scopes.as_slice(), + one_process_scopes.as_slice(), + all_processes_one_cpu_scopes.as_slice(), + ]; + + for scope_group in scope_groups { + let mut link_ids = Vec::new(); + for scope in *scope_group { + // arm64 rejects per-task kernel breakpoints (the scopes that carry + // a PID) to avoid single-step bookkeeping, see + // https://github.com/torvalds/linux/blob/v6.12/arch/arm64/kernel/hw_breakpoint.c#L566-L571. + let scope_supported = type_supported + && (!cfg!(target_arch = "aarch64") + || matches!(scope, PerfEventScope::AllProcessesOneCpu { cpu: _ })); + let attach = prog.attach( + PerfEventConfig::Breakpoint(config), + *scope, + SamplePolicy::Period(1), + true, + ); + if scope_supported { + let link_id = attach.unwrap_or_else(|error| { + panic!("{config:?} {scope:?} attach failed: {error:?}") + }); + link_ids.push(link_id); + } else { + assert_matches!( + attach.unwrap_err(), + ProgramError::SyscallError(SyscallError { + call: "perf_event_open", + io_error, + }) => io_error.kind() == ErrorKind::InvalidInput + ); + } + } + let attached = !link_ids.is_empty(); + defer! { + for link_id in link_ids { + prog.detach(link_id).unwrap(); + } + } + + trigger(); + + let lookup = map.get(&pid, 0); + if attached { + let recorded = + lookup.unwrap_or_else(|error| panic!("{config:?} map lookup failed: {error:?}")); + assert_eq!( + recorded, expected_addr, + "{config:?} recorded unexpected address" + ); + } else { + assert_matches!(lookup.unwrap_err(), maps::MapError::KeyNotFound); + } + } +} + +fn get_address(symbols: &HashMap<&str, Vec>, name: &str) -> Option { + symbols.get(name).map(|addrs| match addrs.as_slice() { + [addr] => *addr, + [] => panic!("no address found for {name} in {symbols:?}"), + addrs => panic!("multiple addresses found for {name}: {addrs:?}"), + }) +} + +#[test_log::test] +fn perf_event_bp() { + // Search for the address of modprobe_path. Prefer to grab it directly from + // kallsyms, but if it's not there we can grab it from System.map and apply + // the kaslr offset. + const KALLSYMS_PATH: &str = "/proc/kallsyms"; + let kernel_symbols = fs::read_to_string(KALLSYMS_PATH) + .unwrap_or_else(|error| panic!("fs::read_to_string({KALLSYMS_PATH}): {error:?}")); + let kernel_symbols = parse_kernel_symbols(&kernel_symbols); + + let attach_addr = if let Some(addr) = get_address(&kernel_symbols, "modprobe_path") { + addr + } else { + let gunzip_addr = get_address(&kernel_symbols, "gunzip") + .unwrap_or_else(|| panic!("gunzip not found in {kernel_symbols:?}")); + + let system_map = find_system_map(); + let system_map = match system_map.as_slice() { + [system_map] => system_map, + [] => panic!("no system map found"), + system_maps => panic!("multiple system maps found: {:?}", system_maps), + }; + let system_map = fs::read_to_string(system_map).unwrap_or_else(|error| { + panic!("fs::read_to_string({}): {error:?}", system_map.display()) + }); + let system_map = parse_kernel_symbols(&system_map); + + let gunzip_debug_addr = get_address(&system_map, "gunzip") + .unwrap_or_else(|| panic!("gunzip not found in {system_map:?}")); + let modprobe_path_debug_addr = get_address(&system_map, "modprobe_path") + .unwrap_or_else(|| panic!("modprobe_path not found in {system_map:?}")); + + let kaslr_offset = gunzip_addr.wrapping_sub(gunzip_debug_addr); + modprobe_path_debug_addr.wrapping_add(kaslr_offset) + }; + + // Trigger the hardware breakpoint by reading or writing + // /proc/sys/kernel/modprobe, the sysctl connected to modprobe_path. + // + // See https://github.com/torvalds/linux/blob/v6.17/kernel/module/main.c#L132-L150. + const MODPROBE_PATH: &str = "/proc/sys/kernel/modprobe"; + + let read = |modprobe_contents: &mut Option| { + let contents = fs::read_to_string(MODPROBE_PATH) + .unwrap_or_else(|error| panic!("fs::read_to_string({MODPROBE_PATH}): {error:?}")); + if let Some(modprobe_contents) = modprobe_contents { + assert_eq!(*modprobe_contents, contents); + } + *modprobe_contents = Some(contents); + }; + + let write = |contents: &str| { + fs::write(MODPROBE_PATH, contents.as_bytes()) + .unwrap_or_else(|error| panic!("fs::write({MODPROBE_PATH}, ..): {error:?}")); + }; + + let mut modprobe_contents_before = None; + run_breakpoint_case( + BreakpointConfig::Data { + r#type: PerfBreakpointType::Read, + address: attach_addr, + length: PerfBreakpointLength::Len1, + }, + || read(&mut modprobe_contents_before), + attach_addr, + ); + let modprobe_contents_before = modprobe_contents_before.unwrap(); + + run_breakpoint_case( + BreakpointConfig::Data { + r#type: PerfBreakpointType::Write, + address: attach_addr, + length: PerfBreakpointLength::Len1, + }, + || write(&modprobe_contents_before), + attach_addr, + ); + + let mut modprobe_contents_after = None; + run_breakpoint_case( + BreakpointConfig::Data { + r#type: PerfBreakpointType::ReadWrite, + address: attach_addr, + length: PerfBreakpointLength::Len1, + }, + || read(&mut modprobe_contents_after), + attach_addr, + ); + let modprobe_contents_after = modprobe_contents_after.unwrap(); + + run_breakpoint_case( + BreakpointConfig::Data { + r#type: PerfBreakpointType::ReadWrite, + address: attach_addr, + length: PerfBreakpointLength::Len1, + }, + || write(&modprobe_contents_after), + attach_addr, + ); + + // Just for fun. + assert_eq!(modprobe_contents_before, modprobe_contents_after); + + let execute_addr = { + let getpgid_symbol = if cfg!(target_arch = "x86_64") { + "__x64_sys_getpgid" + } else if cfg!(target_arch = "aarch64") { + "__arm64_sys_getpgid" + } else { + panic!("unsupported architecture"); + }; + get_address(&kernel_symbols, getpgid_symbol) + .unwrap_or_else(|| panic!("{getpgid_symbol} not found in {kernel_symbols:?}")) + }; + + run_breakpoint_case( + BreakpointConfig::Instruction { + address: execute_addr, + }, + || { + nix::unistd::getpgid(None).unwrap(); + }, + execute_addr, + ); +} diff --git a/xtask/public-api/aya-ebpf-bindings.txt b/xtask/public-api/aya-ebpf-bindings.txt index 7a38ec39..00a60f70 100644 --- a/xtask/public-api/aya-ebpf-bindings.txt +++ b/xtask/public-api/aya-ebpf-bindings.txt @@ -4972,6 +4972,9 @@ pub unsafe fn aya_ebpf_bindings::bindings::bpf_map_info::clone_to_uninit(&self, impl core::convert::From for aya_ebpf_bindings::bindings::bpf_map_info pub fn aya_ebpf_bindings::bindings::bpf_map_info::from(t: T) -> T #[repr(C)] pub struct aya_ebpf_bindings::bindings::bpf_perf_event_data +pub aya_ebpf_bindings::bindings::bpf_perf_event_data::addr: aya_ebpf_bindings::bindings::__u64 +pub aya_ebpf_bindings::bindings::bpf_perf_event_data::regs: aya_ebpf_bindings::bindings::bpf_user_pt_regs_t +pub aya_ebpf_bindings::bindings::bpf_perf_event_data::sample_period: aya_ebpf_bindings::bindings::__u64 impl core::clone::Clone for aya_ebpf_bindings::bindings::bpf_perf_event_data pub fn aya_ebpf_bindings::bindings::bpf_perf_event_data::clone(&self) -> aya_ebpf_bindings::bindings::bpf_perf_event_data impl core::fmt::Debug for aya_ebpf_bindings::bindings::bpf_perf_event_data @@ -7057,6 +7060,7 @@ pub type aya_ebpf_bindings::bindings::_bindgen_ty_6 = aya_ebpf_cty::ad::c_uint pub type aya_ebpf_bindings::bindings::_bindgen_ty_7 = aya_ebpf_cty::ad::c_uint pub type aya_ebpf_bindings::bindings::_bindgen_ty_8 = aya_ebpf_cty::ad::c_uint pub type aya_ebpf_bindings::bindings::_bindgen_ty_9 = aya_ebpf_cty::ad::c_uint +pub type aya_ebpf_bindings::bindings::bpf_user_pt_regs_t = aya_ebpf_bindings::bindings::pt_regs pub type aya_ebpf_bindings::bindings::sa_family_t = aya_ebpf_cty::c_ushort pub mod aya_ebpf_bindings::helpers pub unsafe fn aya_ebpf_bindings::helpers::bpf_bind(ctx: *mut aya_ebpf_bindings::bindings::bpf_sock_addr, addr: *mut aya_ebpf_bindings::bindings::sockaddr, addr_len: aya_ebpf_cty::ad::c_int) -> aya_ebpf_cty::od::c_long diff --git a/xtask/public-api/aya-ebpf.txt b/xtask/public-api/aya-ebpf.txt index a78b1758..b8e672ee 100644 --- a/xtask/public-api/aya-ebpf.txt +++ b/xtask/public-api/aya-ebpf.txt @@ -1723,8 +1723,9 @@ impl core::convert::From for aya_ebpf::programs::lsm::LsmContext pub fn aya_ebpf::programs::lsm::LsmContext::from(t: T) -> T pub mod aya_ebpf::programs::perf_event pub struct aya_ebpf::programs::perf_event::PerfEventContext +pub aya_ebpf::programs::perf_event::PerfEventContext::ctx: *mut aya_ebpf_bindings::x86_64::bindings::bpf_perf_event_data impl aya_ebpf::programs::perf_event::PerfEventContext -pub fn aya_ebpf::programs::perf_event::PerfEventContext::new(ctx: *mut core::ffi::c_void) -> Self +pub fn aya_ebpf::programs::perf_event::PerfEventContext::new(ctx: *mut aya_ebpf_bindings::x86_64::bindings::bpf_perf_event_data) -> Self impl aya_ebpf::EbpfContext for aya_ebpf::programs::perf_event::PerfEventContext pub fn aya_ebpf::programs::perf_event::PerfEventContext::as_ptr(&self) -> *mut core::ffi::c_void impl core::marker::Freeze for aya_ebpf::programs::perf_event::PerfEventContext @@ -2461,8 +2462,9 @@ pub fn aya_ebpf::programs::lsm::LsmContext::borrow_mut(&mut self) -> &mut T impl core::convert::From for aya_ebpf::programs::lsm::LsmContext pub fn aya_ebpf::programs::lsm::LsmContext::from(t: T) -> T pub struct aya_ebpf::programs::PerfEventContext +pub aya_ebpf::programs::PerfEventContext::ctx: *mut aya_ebpf_bindings::x86_64::bindings::bpf_perf_event_data impl aya_ebpf::programs::perf_event::PerfEventContext -pub fn aya_ebpf::programs::perf_event::PerfEventContext::new(ctx: *mut core::ffi::c_void) -> Self +pub fn aya_ebpf::programs::perf_event::PerfEventContext::new(ctx: *mut aya_ebpf_bindings::x86_64::bindings::bpf_perf_event_data) -> Self impl aya_ebpf::EbpfContext for aya_ebpf::programs::perf_event::PerfEventContext pub fn aya_ebpf::programs::perf_event::PerfEventContext::as_ptr(&self) -> *mut core::ffi::c_void impl core::marker::Freeze for aya_ebpf::programs::perf_event::PerfEventContext diff --git a/xtask/public-api/aya-obj.txt b/xtask/public-api/aya-obj.txt index 8406f83a..5e59c5ea 100644 --- a/xtask/public-api/aya-obj.txt +++ b/xtask/public-api/aya-obj.txt @@ -8057,24 +8057,38 @@ pub const aya_obj::generated::BTF_KIND_VOLATILE: aya_obj::generated::_bindgen_ty pub const aya_obj::generated::BTF_VAR_GLOBAL_ALLOCATED: aya_obj::generated::_bindgen_ty_43 pub const aya_obj::generated::BTF_VAR_GLOBAL_EXTERN: aya_obj::generated::_bindgen_ty_43 pub const aya_obj::generated::BTF_VAR_STATIC: aya_obj::generated::_bindgen_ty_43 -pub const aya_obj::generated::IFLA_XDP_ATTACHED: aya_obj::generated::_bindgen_ty_92 -pub const aya_obj::generated::IFLA_XDP_DRV_PROG_ID: aya_obj::generated::_bindgen_ty_92 -pub const aya_obj::generated::IFLA_XDP_EXPECTED_FD: aya_obj::generated::_bindgen_ty_92 -pub const aya_obj::generated::IFLA_XDP_FD: aya_obj::generated::_bindgen_ty_92 -pub const aya_obj::generated::IFLA_XDP_FLAGS: aya_obj::generated::_bindgen_ty_92 -pub const aya_obj::generated::IFLA_XDP_HW_PROG_ID: aya_obj::generated::_bindgen_ty_92 -pub const aya_obj::generated::IFLA_XDP_PROG_ID: aya_obj::generated::_bindgen_ty_92 -pub const aya_obj::generated::IFLA_XDP_SKB_PROG_ID: aya_obj::generated::_bindgen_ty_92 -pub const aya_obj::generated::IFLA_XDP_UNSPEC: aya_obj::generated::_bindgen_ty_92 -pub const aya_obj::generated::NFPROTO_ARP: aya_obj::generated::_bindgen_ty_99 -pub const aya_obj::generated::NFPROTO_BRIDGE: aya_obj::generated::_bindgen_ty_99 -pub const aya_obj::generated::NFPROTO_DECNET: aya_obj::generated::_bindgen_ty_99 -pub const aya_obj::generated::NFPROTO_INET: aya_obj::generated::_bindgen_ty_99 -pub const aya_obj::generated::NFPROTO_IPV4: aya_obj::generated::_bindgen_ty_99 -pub const aya_obj::generated::NFPROTO_IPV6: aya_obj::generated::_bindgen_ty_99 -pub const aya_obj::generated::NFPROTO_NETDEV: aya_obj::generated::_bindgen_ty_99 -pub const aya_obj::generated::NFPROTO_NUMPROTO: aya_obj::generated::_bindgen_ty_99 -pub const aya_obj::generated::NFPROTO_UNSPEC: aya_obj::generated::_bindgen_ty_99 +pub const aya_obj::generated::HW_BREAKPOINT_EMPTY: aya_obj::generated::_bindgen_ty_45 +pub const aya_obj::generated::HW_BREAKPOINT_INVALID: aya_obj::generated::_bindgen_ty_45 +pub const aya_obj::generated::HW_BREAKPOINT_LEN_1: aya_obj::generated::_bindgen_ty_44 +pub const aya_obj::generated::HW_BREAKPOINT_LEN_2: aya_obj::generated::_bindgen_ty_44 +pub const aya_obj::generated::HW_BREAKPOINT_LEN_3: aya_obj::generated::_bindgen_ty_44 +pub const aya_obj::generated::HW_BREAKPOINT_LEN_4: aya_obj::generated::_bindgen_ty_44 +pub const aya_obj::generated::HW_BREAKPOINT_LEN_5: aya_obj::generated::_bindgen_ty_44 +pub const aya_obj::generated::HW_BREAKPOINT_LEN_6: aya_obj::generated::_bindgen_ty_44 +pub const aya_obj::generated::HW_BREAKPOINT_LEN_7: aya_obj::generated::_bindgen_ty_44 +pub const aya_obj::generated::HW_BREAKPOINT_LEN_8: aya_obj::generated::_bindgen_ty_44 +pub const aya_obj::generated::HW_BREAKPOINT_R: aya_obj::generated::_bindgen_ty_45 +pub const aya_obj::generated::HW_BREAKPOINT_RW: aya_obj::generated::_bindgen_ty_45 +pub const aya_obj::generated::HW_BREAKPOINT_W: aya_obj::generated::_bindgen_ty_45 +pub const aya_obj::generated::HW_BREAKPOINT_X: aya_obj::generated::_bindgen_ty_45 +pub const aya_obj::generated::IFLA_XDP_ATTACHED: aya_obj::generated::_bindgen_ty_94 +pub const aya_obj::generated::IFLA_XDP_DRV_PROG_ID: aya_obj::generated::_bindgen_ty_94 +pub const aya_obj::generated::IFLA_XDP_EXPECTED_FD: aya_obj::generated::_bindgen_ty_94 +pub const aya_obj::generated::IFLA_XDP_FD: aya_obj::generated::_bindgen_ty_94 +pub const aya_obj::generated::IFLA_XDP_FLAGS: aya_obj::generated::_bindgen_ty_94 +pub const aya_obj::generated::IFLA_XDP_HW_PROG_ID: aya_obj::generated::_bindgen_ty_94 +pub const aya_obj::generated::IFLA_XDP_PROG_ID: aya_obj::generated::_bindgen_ty_94 +pub const aya_obj::generated::IFLA_XDP_SKB_PROG_ID: aya_obj::generated::_bindgen_ty_94 +pub const aya_obj::generated::IFLA_XDP_UNSPEC: aya_obj::generated::_bindgen_ty_94 +pub const aya_obj::generated::NFPROTO_ARP: aya_obj::generated::_bindgen_ty_101 +pub const aya_obj::generated::NFPROTO_BRIDGE: aya_obj::generated::_bindgen_ty_101 +pub const aya_obj::generated::NFPROTO_DECNET: aya_obj::generated::_bindgen_ty_101 +pub const aya_obj::generated::NFPROTO_INET: aya_obj::generated::_bindgen_ty_101 +pub const aya_obj::generated::NFPROTO_IPV4: aya_obj::generated::_bindgen_ty_101 +pub const aya_obj::generated::NFPROTO_IPV6: aya_obj::generated::_bindgen_ty_101 +pub const aya_obj::generated::NFPROTO_NETDEV: aya_obj::generated::_bindgen_ty_101 +pub const aya_obj::generated::NFPROTO_NUMPROTO: aya_obj::generated::_bindgen_ty_101 +pub const aya_obj::generated::NFPROTO_UNSPEC: aya_obj::generated::_bindgen_ty_101 pub const aya_obj::generated::NLMSG_ALIGNTO: u32 pub const aya_obj::generated::NR_BTF_KINDS: aya_obj::generated::_bindgen_ty_42 pub const aya_obj::generated::PERF_EVENT_IOC_DISABLE: u32 @@ -8097,36 +8111,36 @@ pub const aya_obj::generated::PERF_MAX_CONTEXTS_PER_STACK: u32 pub const aya_obj::generated::PERF_MAX_STACK_DEPTH: u32 pub const aya_obj::generated::SO_ATTACH_BPF: u32 pub const aya_obj::generated::SO_DETACH_BPF: u32 -pub const aya_obj::generated::TCA_BPF_ACT: aya_obj::generated::_bindgen_ty_154 -pub const aya_obj::generated::TCA_BPF_CLASSID: aya_obj::generated::_bindgen_ty_154 -pub const aya_obj::generated::TCA_BPF_FD: aya_obj::generated::_bindgen_ty_154 -pub const aya_obj::generated::TCA_BPF_FLAGS: aya_obj::generated::_bindgen_ty_154 -pub const aya_obj::generated::TCA_BPF_FLAGS_GEN: aya_obj::generated::_bindgen_ty_154 +pub const aya_obj::generated::TCA_BPF_ACT: aya_obj::generated::_bindgen_ty_156 +pub const aya_obj::generated::TCA_BPF_CLASSID: aya_obj::generated::_bindgen_ty_156 +pub const aya_obj::generated::TCA_BPF_FD: aya_obj::generated::_bindgen_ty_156 +pub const aya_obj::generated::TCA_BPF_FLAGS: aya_obj::generated::_bindgen_ty_156 +pub const aya_obj::generated::TCA_BPF_FLAGS_GEN: aya_obj::generated::_bindgen_ty_156 pub const aya_obj::generated::TCA_BPF_FLAG_ACT_DIRECT: u32 -pub const aya_obj::generated::TCA_BPF_ID: aya_obj::generated::_bindgen_ty_154 -pub const aya_obj::generated::TCA_BPF_NAME: aya_obj::generated::_bindgen_ty_154 -pub const aya_obj::generated::TCA_BPF_OPS: aya_obj::generated::_bindgen_ty_154 -pub const aya_obj::generated::TCA_BPF_OPS_LEN: aya_obj::generated::_bindgen_ty_154 -pub const aya_obj::generated::TCA_BPF_POLICE: aya_obj::generated::_bindgen_ty_154 -pub const aya_obj::generated::TCA_BPF_TAG: aya_obj::generated::_bindgen_ty_154 -pub const aya_obj::generated::TCA_BPF_UNSPEC: aya_obj::generated::_bindgen_ty_154 -pub const aya_obj::generated::TCA_CHAIN: aya_obj::generated::_bindgen_ty_174 -pub const aya_obj::generated::TCA_DUMP_FLAGS: aya_obj::generated::_bindgen_ty_174 -pub const aya_obj::generated::TCA_DUMP_INVISIBLE: aya_obj::generated::_bindgen_ty_174 -pub const aya_obj::generated::TCA_EGRESS_BLOCK: aya_obj::generated::_bindgen_ty_174 -pub const aya_obj::generated::TCA_EXT_WARN_MSG: aya_obj::generated::_bindgen_ty_174 -pub const aya_obj::generated::TCA_FCNT: aya_obj::generated::_bindgen_ty_174 -pub const aya_obj::generated::TCA_HW_OFFLOAD: aya_obj::generated::_bindgen_ty_174 -pub const aya_obj::generated::TCA_INGRESS_BLOCK: aya_obj::generated::_bindgen_ty_174 -pub const aya_obj::generated::TCA_KIND: aya_obj::generated::_bindgen_ty_174 -pub const aya_obj::generated::TCA_OPTIONS: aya_obj::generated::_bindgen_ty_174 -pub const aya_obj::generated::TCA_PAD: aya_obj::generated::_bindgen_ty_174 -pub const aya_obj::generated::TCA_RATE: aya_obj::generated::_bindgen_ty_174 -pub const aya_obj::generated::TCA_STAB: aya_obj::generated::_bindgen_ty_174 -pub const aya_obj::generated::TCA_STATS: aya_obj::generated::_bindgen_ty_174 -pub const aya_obj::generated::TCA_STATS2: aya_obj::generated::_bindgen_ty_174 -pub const aya_obj::generated::TCA_UNSPEC: aya_obj::generated::_bindgen_ty_174 -pub const aya_obj::generated::TCA_XSTATS: aya_obj::generated::_bindgen_ty_174 +pub const aya_obj::generated::TCA_BPF_ID: aya_obj::generated::_bindgen_ty_156 +pub const aya_obj::generated::TCA_BPF_NAME: aya_obj::generated::_bindgen_ty_156 +pub const aya_obj::generated::TCA_BPF_OPS: aya_obj::generated::_bindgen_ty_156 +pub const aya_obj::generated::TCA_BPF_OPS_LEN: aya_obj::generated::_bindgen_ty_156 +pub const aya_obj::generated::TCA_BPF_POLICE: aya_obj::generated::_bindgen_ty_156 +pub const aya_obj::generated::TCA_BPF_TAG: aya_obj::generated::_bindgen_ty_156 +pub const aya_obj::generated::TCA_BPF_UNSPEC: aya_obj::generated::_bindgen_ty_156 +pub const aya_obj::generated::TCA_CHAIN: aya_obj::generated::_bindgen_ty_176 +pub const aya_obj::generated::TCA_DUMP_FLAGS: aya_obj::generated::_bindgen_ty_176 +pub const aya_obj::generated::TCA_DUMP_INVISIBLE: aya_obj::generated::_bindgen_ty_176 +pub const aya_obj::generated::TCA_EGRESS_BLOCK: aya_obj::generated::_bindgen_ty_176 +pub const aya_obj::generated::TCA_EXT_WARN_MSG: aya_obj::generated::_bindgen_ty_176 +pub const aya_obj::generated::TCA_FCNT: aya_obj::generated::_bindgen_ty_176 +pub const aya_obj::generated::TCA_HW_OFFLOAD: aya_obj::generated::_bindgen_ty_176 +pub const aya_obj::generated::TCA_INGRESS_BLOCK: aya_obj::generated::_bindgen_ty_176 +pub const aya_obj::generated::TCA_KIND: aya_obj::generated::_bindgen_ty_176 +pub const aya_obj::generated::TCA_OPTIONS: aya_obj::generated::_bindgen_ty_176 +pub const aya_obj::generated::TCA_PAD: aya_obj::generated::_bindgen_ty_176 +pub const aya_obj::generated::TCA_RATE: aya_obj::generated::_bindgen_ty_176 +pub const aya_obj::generated::TCA_STAB: aya_obj::generated::_bindgen_ty_176 +pub const aya_obj::generated::TCA_STATS: aya_obj::generated::_bindgen_ty_176 +pub const aya_obj::generated::TCA_STATS2: aya_obj::generated::_bindgen_ty_176 +pub const aya_obj::generated::TCA_UNSPEC: aya_obj::generated::_bindgen_ty_176 +pub const aya_obj::generated::TCA_XSTATS: aya_obj::generated::_bindgen_ty_176 pub const aya_obj::generated::TC_H_CLSACT: u32 pub const aya_obj::generated::TC_H_INGRESS: u32 pub const aya_obj::generated::TC_H_MAJ_MASK: u32 @@ -8143,10 +8157,10 @@ pub const aya_obj::generated::XDP_FLAGS_MODES: u32 pub const aya_obj::generated::XDP_FLAGS_REPLACE: u32 pub const aya_obj::generated::XDP_FLAGS_SKB_MODE: u32 pub const aya_obj::generated::XDP_FLAGS_UPDATE_IF_NOEXIST: u32 -pub const aya_obj::generated::__IFLA_XDP_MAX: aya_obj::generated::_bindgen_ty_92 +pub const aya_obj::generated::__IFLA_XDP_MAX: aya_obj::generated::_bindgen_ty_94 pub const aya_obj::generated::__MAX_BPF_REG: aya_obj::generated::_bindgen_ty_1 -pub const aya_obj::generated::__TCA_BPF_MAX: aya_obj::generated::_bindgen_ty_154 -pub const aya_obj::generated::__TCA_MAX: aya_obj::generated::_bindgen_ty_174 +pub const aya_obj::generated::__TCA_BPF_MAX: aya_obj::generated::_bindgen_ty_156 +pub const aya_obj::generated::__TCA_MAX: aya_obj::generated::_bindgen_ty_176 pub type aya_obj::generated::__s16 = core::ffi::primitives::c_short pub type aya_obj::generated::__s32 = core::ffi::primitives::c_int pub type aya_obj::generated::__s64 = core::ffi::primitives::c_longlong @@ -8155,14 +8169,15 @@ pub type aya_obj::generated::__u32 = core::ffi::primitives::c_uint pub type aya_obj::generated::__u64 = core::ffi::primitives::c_ulonglong pub type aya_obj::generated::__u8 = core::ffi::primitives::c_uchar pub type aya_obj::generated::_bindgen_ty_10 = core::ffi::primitives::c_uint +pub type aya_obj::generated::_bindgen_ty_101 = core::ffi::primitives::c_uint pub type aya_obj::generated::_bindgen_ty_11 = core::ffi::primitives::c_uint pub type aya_obj::generated::_bindgen_ty_12 = core::ffi::primitives::c_uint pub type aya_obj::generated::_bindgen_ty_13 = core::ffi::primitives::c_uint pub type aya_obj::generated::_bindgen_ty_14 = core::ffi::primitives::c_ulong pub type aya_obj::generated::_bindgen_ty_15 = core::ffi::primitives::c_int -pub type aya_obj::generated::_bindgen_ty_154 = core::ffi::primitives::c_uint +pub type aya_obj::generated::_bindgen_ty_156 = core::ffi::primitives::c_uint pub type aya_obj::generated::_bindgen_ty_17 = core::ffi::primitives::c_uint -pub type aya_obj::generated::_bindgen_ty_174 = core::ffi::primitives::c_uint +pub type aya_obj::generated::_bindgen_ty_176 = core::ffi::primitives::c_uint pub type aya_obj::generated::_bindgen_ty_19 = core::ffi::primitives::c_uint pub type aya_obj::generated::_bindgen_ty_2 = core::ffi::primitives::c_uint pub type aya_obj::generated::_bindgen_ty_21 = core::ffi::primitives::c_uint @@ -8174,13 +8189,14 @@ pub type aya_obj::generated::_bindgen_ty_4 = core::ffi::primitives::c_uint pub type aya_obj::generated::_bindgen_ty_41 = core::ffi::primitives::c_uint pub type aya_obj::generated::_bindgen_ty_42 = core::ffi::primitives::c_uint pub type aya_obj::generated::_bindgen_ty_43 = core::ffi::primitives::c_uint +pub type aya_obj::generated::_bindgen_ty_44 = core::ffi::primitives::c_uint +pub type aya_obj::generated::_bindgen_ty_45 = core::ffi::primitives::c_uint pub type aya_obj::generated::_bindgen_ty_5 = core::ffi::primitives::c_uint pub type aya_obj::generated::_bindgen_ty_6 = core::ffi::primitives::c_uint pub type aya_obj::generated::_bindgen_ty_7 = core::ffi::primitives::c_uint pub type aya_obj::generated::_bindgen_ty_8 = core::ffi::primitives::c_uint pub type aya_obj::generated::_bindgen_ty_9 = core::ffi::primitives::c_uint -pub type aya_obj::generated::_bindgen_ty_92 = core::ffi::primitives::c_uint -pub type aya_obj::generated::_bindgen_ty_99 = core::ffi::primitives::c_uint +pub type aya_obj::generated::_bindgen_ty_94 = core::ffi::primitives::c_uint pub mod aya_obj::links pub mod aya_obj::maps pub enum aya_obj::maps::Map diff --git a/xtask/public-api/aya.txt b/xtask/public-api/aya.txt index 27a51ec5..8690f622 100644 --- a/xtask/public-api/aya.txt +++ b/xtask/public-api/aya.txt @@ -5299,6 +5299,46 @@ pub fn aya::programs::perf_attach::PerfLinkId::borrow_mut(&mut self) -> &mut T impl core::convert::From for aya::programs::perf_attach::PerfLinkId pub fn aya::programs::perf_attach::PerfLinkId::from(t: T) -> T pub mod aya::programs::perf_event +pub enum aya::programs::perf_event::BreakpointConfig +pub aya::programs::perf_event::BreakpointConfig::Data +pub aya::programs::perf_event::BreakpointConfig::Data::address: u64 +pub aya::programs::perf_event::BreakpointConfig::Data::length: aya::programs::perf_event::PerfBreakpointLength +pub aya::programs::perf_event::BreakpointConfig::Data::type: aya::programs::perf_event::PerfBreakpointType +pub aya::programs::perf_event::BreakpointConfig::Instruction +pub aya::programs::perf_event::BreakpointConfig::Instruction::address: u64 +impl core::clone::Clone for aya::programs::perf_event::BreakpointConfig +pub fn aya::programs::perf_event::BreakpointConfig::clone(&self) -> aya::programs::perf_event::BreakpointConfig +impl core::fmt::Debug for aya::programs::perf_event::BreakpointConfig +pub fn aya::programs::perf_event::BreakpointConfig::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result +impl core::marker::Copy for aya::programs::perf_event::BreakpointConfig +impl core::marker::Freeze for aya::programs::perf_event::BreakpointConfig +impl core::marker::Send for aya::programs::perf_event::BreakpointConfig +impl core::marker::Sync for aya::programs::perf_event::BreakpointConfig +impl core::marker::Unpin for aya::programs::perf_event::BreakpointConfig +impl core::panic::unwind_safe::RefUnwindSafe for aya::programs::perf_event::BreakpointConfig +impl core::panic::unwind_safe::UnwindSafe for aya::programs::perf_event::BreakpointConfig +impl core::convert::Into for aya::programs::perf_event::BreakpointConfig where U: core::convert::From +pub fn aya::programs::perf_event::BreakpointConfig::into(self) -> U +impl core::convert::TryFrom for aya::programs::perf_event::BreakpointConfig where U: core::convert::Into +pub type aya::programs::perf_event::BreakpointConfig::Error = core::convert::Infallible +pub fn aya::programs::perf_event::BreakpointConfig::try_from(value: U) -> core::result::Result>::Error> +impl core::convert::TryInto for aya::programs::perf_event::BreakpointConfig where U: core::convert::TryFrom +pub type aya::programs::perf_event::BreakpointConfig::Error = >::Error +pub fn aya::programs::perf_event::BreakpointConfig::try_into(self) -> core::result::Result>::Error> +impl alloc::borrow::ToOwned for aya::programs::perf_event::BreakpointConfig where T: core::clone::Clone +pub type aya::programs::perf_event::BreakpointConfig::Owned = T +pub fn aya::programs::perf_event::BreakpointConfig::clone_into(&self, target: &mut T) +pub fn aya::programs::perf_event::BreakpointConfig::to_owned(&self) -> T +impl core::any::Any for aya::programs::perf_event::BreakpointConfig where T: 'static + ?core::marker::Sized +pub fn aya::programs::perf_event::BreakpointConfig::type_id(&self) -> core::any::TypeId +impl core::borrow::Borrow for aya::programs::perf_event::BreakpointConfig where T: ?core::marker::Sized +pub fn aya::programs::perf_event::BreakpointConfig::borrow(&self) -> &T +impl core::borrow::BorrowMut for aya::programs::perf_event::BreakpointConfig where T: ?core::marker::Sized +pub fn aya::programs::perf_event::BreakpointConfig::borrow_mut(&mut self) -> &mut T +impl core::clone::CloneToUninit for aya::programs::perf_event::BreakpointConfig where T: core::clone::Clone +pub unsafe fn aya::programs::perf_event::BreakpointConfig::clone_to_uninit(&self, dest: *mut u8) +impl core::convert::From for aya::programs::perf_event::BreakpointConfig +pub fn aya::programs::perf_event::BreakpointConfig::from(t: T) -> T #[repr(u32)] pub enum aya::programs::perf_event::HardwareEvent pub aya::programs::perf_event::HardwareEvent::BranchInstructions = 4 pub aya::programs::perf_event::HardwareEvent::BranchMisses = 5 @@ -5457,8 +5497,83 @@ impl core::clone::CloneToUninit for aya::programs::perf_event::HwCacheResult pub unsafe fn aya::programs::perf_event::HwCacheResult::clone_to_uninit(&self, dest: *mut u8) impl core::convert::From for aya::programs::perf_event::HwCacheResult pub fn aya::programs::perf_event::HwCacheResult::from(t: T) -> T +#[repr(u32)] pub enum aya::programs::perf_event::PerfBreakpointLength +pub aya::programs::perf_event::PerfBreakpointLength::Len1 = 1 +pub aya::programs::perf_event::PerfBreakpointLength::Len2 = 2 +pub aya::programs::perf_event::PerfBreakpointLength::Len4 = 4 +pub aya::programs::perf_event::PerfBreakpointLength::Len8 = 8 +impl core::clone::Clone for aya::programs::perf_event::PerfBreakpointLength +pub fn aya::programs::perf_event::PerfBreakpointLength::clone(&self) -> aya::programs::perf_event::PerfBreakpointLength +impl core::fmt::Debug for aya::programs::perf_event::PerfBreakpointLength +pub fn aya::programs::perf_event::PerfBreakpointLength::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result +impl core::marker::Copy for aya::programs::perf_event::PerfBreakpointLength +impl core::marker::Freeze for aya::programs::perf_event::PerfBreakpointLength +impl core::marker::Send for aya::programs::perf_event::PerfBreakpointLength +impl core::marker::Sync for aya::programs::perf_event::PerfBreakpointLength +impl core::marker::Unpin for aya::programs::perf_event::PerfBreakpointLength +impl core::panic::unwind_safe::RefUnwindSafe for aya::programs::perf_event::PerfBreakpointLength +impl core::panic::unwind_safe::UnwindSafe for aya::programs::perf_event::PerfBreakpointLength +impl core::convert::Into for aya::programs::perf_event::PerfBreakpointLength where U: core::convert::From +pub fn aya::programs::perf_event::PerfBreakpointLength::into(self) -> U +impl core::convert::TryFrom for aya::programs::perf_event::PerfBreakpointLength where U: core::convert::Into +pub type aya::programs::perf_event::PerfBreakpointLength::Error = core::convert::Infallible +pub fn aya::programs::perf_event::PerfBreakpointLength::try_from(value: U) -> core::result::Result>::Error> +impl core::convert::TryInto for aya::programs::perf_event::PerfBreakpointLength where U: core::convert::TryFrom +pub type aya::programs::perf_event::PerfBreakpointLength::Error = >::Error +pub fn aya::programs::perf_event::PerfBreakpointLength::try_into(self) -> core::result::Result>::Error> +impl alloc::borrow::ToOwned for aya::programs::perf_event::PerfBreakpointLength where T: core::clone::Clone +pub type aya::programs::perf_event::PerfBreakpointLength::Owned = T +pub fn aya::programs::perf_event::PerfBreakpointLength::clone_into(&self, target: &mut T) +pub fn aya::programs::perf_event::PerfBreakpointLength::to_owned(&self) -> T +impl core::any::Any for aya::programs::perf_event::PerfBreakpointLength where T: 'static + ?core::marker::Sized +pub fn aya::programs::perf_event::PerfBreakpointLength::type_id(&self) -> core::any::TypeId +impl core::borrow::Borrow for aya::programs::perf_event::PerfBreakpointLength where T: ?core::marker::Sized +pub fn aya::programs::perf_event::PerfBreakpointLength::borrow(&self) -> &T +impl core::borrow::BorrowMut for aya::programs::perf_event::PerfBreakpointLength where T: ?core::marker::Sized +pub fn aya::programs::perf_event::PerfBreakpointLength::borrow_mut(&mut self) -> &mut T +impl core::clone::CloneToUninit for aya::programs::perf_event::PerfBreakpointLength where T: core::clone::Clone +pub unsafe fn aya::programs::perf_event::PerfBreakpointLength::clone_to_uninit(&self, dest: *mut u8) +impl core::convert::From for aya::programs::perf_event::PerfBreakpointLength +pub fn aya::programs::perf_event::PerfBreakpointLength::from(t: T) -> T +#[repr(u32)] pub enum aya::programs::perf_event::PerfBreakpointType +pub aya::programs::perf_event::PerfBreakpointType::Read = 1 +pub aya::programs::perf_event::PerfBreakpointType::ReadWrite = 3 +pub aya::programs::perf_event::PerfBreakpointType::Write = 2 +impl core::clone::Clone for aya::programs::perf_event::PerfBreakpointType +pub fn aya::programs::perf_event::PerfBreakpointType::clone(&self) -> aya::programs::perf_event::PerfBreakpointType +impl core::fmt::Debug for aya::programs::perf_event::PerfBreakpointType +pub fn aya::programs::perf_event::PerfBreakpointType::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result +impl core::marker::Copy for aya::programs::perf_event::PerfBreakpointType +impl core::marker::Freeze for aya::programs::perf_event::PerfBreakpointType +impl core::marker::Send for aya::programs::perf_event::PerfBreakpointType +impl core::marker::Sync for aya::programs::perf_event::PerfBreakpointType +impl core::marker::Unpin for aya::programs::perf_event::PerfBreakpointType +impl core::panic::unwind_safe::RefUnwindSafe for aya::programs::perf_event::PerfBreakpointType +impl core::panic::unwind_safe::UnwindSafe for aya::programs::perf_event::PerfBreakpointType +impl core::convert::Into for aya::programs::perf_event::PerfBreakpointType where U: core::convert::From +pub fn aya::programs::perf_event::PerfBreakpointType::into(self) -> U +impl core::convert::TryFrom for aya::programs::perf_event::PerfBreakpointType where U: core::convert::Into +pub type aya::programs::perf_event::PerfBreakpointType::Error = core::convert::Infallible +pub fn aya::programs::perf_event::PerfBreakpointType::try_from(value: U) -> core::result::Result>::Error> +impl core::convert::TryInto for aya::programs::perf_event::PerfBreakpointType where U: core::convert::TryFrom +pub type aya::programs::perf_event::PerfBreakpointType::Error = >::Error +pub fn aya::programs::perf_event::PerfBreakpointType::try_into(self) -> core::result::Result>::Error> +impl alloc::borrow::ToOwned for aya::programs::perf_event::PerfBreakpointType where T: core::clone::Clone +pub type aya::programs::perf_event::PerfBreakpointType::Owned = T +pub fn aya::programs::perf_event::PerfBreakpointType::clone_into(&self, target: &mut T) +pub fn aya::programs::perf_event::PerfBreakpointType::to_owned(&self) -> T +impl core::any::Any for aya::programs::perf_event::PerfBreakpointType where T: 'static + ?core::marker::Sized +pub fn aya::programs::perf_event::PerfBreakpointType::type_id(&self) -> core::any::TypeId +impl core::borrow::Borrow for aya::programs::perf_event::PerfBreakpointType where T: ?core::marker::Sized +pub fn aya::programs::perf_event::PerfBreakpointType::borrow(&self) -> &T +impl core::borrow::BorrowMut for aya::programs::perf_event::PerfBreakpointType where T: ?core::marker::Sized +pub fn aya::programs::perf_event::PerfBreakpointType::borrow_mut(&mut self) -> &mut T +impl core::clone::CloneToUninit for aya::programs::perf_event::PerfBreakpointType where T: core::clone::Clone +pub unsafe fn aya::programs::perf_event::PerfBreakpointType::clone_to_uninit(&self, dest: *mut u8) +impl core::convert::From for aya::programs::perf_event::PerfBreakpointType +pub fn aya::programs::perf_event::PerfBreakpointType::from(t: T) -> T pub enum aya::programs::perf_event::PerfEventConfig -pub aya::programs::perf_event::PerfEventConfig::Breakpoint +pub aya::programs::perf_event::PerfEventConfig::Breakpoint(aya::programs::perf_event::BreakpointConfig) pub aya::programs::perf_event::PerfEventConfig::Hardware(aya::programs::perf_event::HardwareEvent) pub aya::programs::perf_event::PerfEventConfig::HwCache pub aya::programs::perf_event::PerfEventConfig::HwCache::event: aya::programs::perf_event::HwCacheEvent @@ -5512,7 +5627,7 @@ pub aya::programs::perf_event::PerfEventScope::CallingProcess pub aya::programs::perf_event::PerfEventScope::CallingProcess::cpu: core::option::Option pub aya::programs::perf_event::PerfEventScope::OneProcess pub aya::programs::perf_event::PerfEventScope::OneProcess::cpu: core::option::Option -pub aya::programs::perf_event::PerfEventScope::OneProcess::pid: i32 +pub aya::programs::perf_event::PerfEventScope::OneProcess::pid: u32 impl core::clone::Clone for aya::programs::perf_event::PerfEventScope pub fn aya::programs::perf_event::PerfEventScope::clone(&self) -> aya::programs::perf_event::PerfEventScope impl core::fmt::Debug for aya::programs::perf_event::PerfEventScope diff --git a/xtask/src/codegen/aya.rs b/xtask/src/codegen/aya.rs index b8330e83..042ea9d5 100644 --- a/xtask/src/codegen/aya.rs +++ b/xtask/src/codegen/aya.rs @@ -67,6 +67,8 @@ fn codegen_bindings(opts: &SysrootOptions, libbpf_dir: &Path) -> Result<()> { .constified_enum("IFLA_.*") .constified_enum("TCA_.*") .constified_enum("BPF_RINGBUF_.*") + // PERF + .constified_enum("HW_BREAKPOINT_.*") // NETFILTER .constified_enum("NFPROTO_.*"); @@ -141,6 +143,7 @@ fn codegen_bindings(opts: &SysrootOptions, libbpf_dir: &Path) -> Result<()> { "PERF_FLAG_.*", "PERF_EVENT_.*", "PERF_MAX_.*", + "HW_BREAKPOINT_.*", // NETLINK "NLMSG_ALIGNTO", "IFLA_XDP_FD", diff --git a/xtask/src/run.rs b/xtask/src/run.rs index 2580f26d..fe1ed92d 100644 --- a/xtask/src/run.rs +++ b/xtask/src/run.rs @@ -1,6 +1,7 @@ use std::{ - ffi::OsString, - fmt::Write as _, + collections::BTreeMap, + ffi::{OsStr, OsString}, + fmt::{Debug, Write as _}, fs::{self, File, OpenOptions}, io::{BufRead as _, BufReader, Write as _}, ops::Deref as _, @@ -112,13 +113,18 @@ enum Disposition { Unpack(T), } +enum ControlFlow { + Continue, + Break, +} + fn with_deb(archive: &Path, dest: &Path, mut state: S, mut select: F) -> Result where F: for<'state> FnMut( &'state mut S, &Path, tar::EntryType, - ) -> Disposition>>, + ) -> Disposition<(Option<&'state mut Vec>, ControlFlow)>, { fs::create_dir_all(dest).with_context(|| format!("failed to create {}", dest.display()))?; @@ -154,9 +160,9 @@ where ) })?; let entry_type = entry.header().entry_type(); - let selected = match select(&mut state, path.as_ref(), entry_type) { + let (selected, control_flow) = match select(&mut state, path.as_ref(), entry_type) { Disposition::Skip => continue, - Disposition::Unpack(selected) => selected, + Disposition::Unpack(unpack) => unpack, }; if let Some(selected) = selected { println!( @@ -180,6 +186,10 @@ where archive.display(), dest.display(), ); + match control_flow { + ControlFlow::Continue => continue, + ControlFlow::Break => break, + } } } println!("{} in {:?}", archive.display(), start.elapsed()); @@ -187,6 +197,14 @@ where Ok(state) } +fn one(slice: &[T]) -> Result<&T> { + if let [item] = slice { + Ok(item) + } else { + bail!("expected [{}], got {slice:?}", std::any::type_name::()) + } +} + /// Build and run the project. pub(crate) fn run(opts: Options) -> Result<()> { let Options { @@ -372,13 +390,63 @@ pub(crate) fn run(opts: Options) -> Result<()> { } let extraction_root = tempfile::tempdir().context("tempdir failed")?; + + #[derive(Eq, PartialEq, Ord, PartialOrd)] + struct KernelPackageKey<'a> { + base: &'a [u8], + } + + #[derive(Default)] + struct KernelPackageGroup<'a> { + kernel: Vec<&'a Path>, + debug: Vec<&'a Path>, + } + + let mut package_groups = BTreeMap::new(); + for archive in &kernel_archives { + let file_name = archive.file_name().ok_or_else(|| { + anyhow!("archive path missing filename: {}", archive.display()) + })?; + let file_name = file_name.as_encoded_bytes(); + // TODO(https://github.com/rust-lang/rust/issues/112811): use split_once when stable. + let package_name = file_name + .split(|&byte| byte == b'_') + .next() + .ok_or_else(|| anyhow!("unexpected archive filename: {}", archive.display()))?; + let (base, is_debug) = if let Some(base) = package_name.strip_suffix(b"-dbg") { + (base, true) + } else if let Some(base) = package_name.strip_suffix(b"-dbgsym") { + (base, true) + } else if let Some(base) = package_name.strip_suffix(b"-unsigned") { + (base, false) + } else { + bail!("unexpected archive filename: {}", archive.display()) + }; + let KernelPackageGroup { kernel, debug } = + package_groups.entry(KernelPackageKey { base }).or_default(); + let dst = if is_debug { debug } else { kernel }; + dst.push(archive.as_path()); + } + let mut errors = Vec::new(); - for (index, archive) in kernel_archives.iter().enumerate() { + for (index, (KernelPackageKey { base }, KernelPackageGroup { kernel, debug })) in + package_groups.into_iter().enumerate() + { + let base = { + use std::os::unix::ffi::OsStrExt as _; + OsStr::from_bytes(base) + }; + + let kernel_archive = one(kernel.as_slice()) + .with_context(|| format!("kernel archive for {}", base.display()))?; + let debug_archive = one(debug.as_slice()) + .with_context(|| format!("debug archive for {}", base.display()))?; + let (kernel_images, configs, modules_dirs) = with_deb( - archive, + kernel_archive, &extraction_root .path() - .join(format!("kernel-archive-{index}")), + .join(format!("kernel-archive-{index}-image")), (Vec::new(), Vec::new(), Vec::new()), |(kernel_images, configs, modules_dirs), path, entry_type| { if let Some(path) = ["./lib/modules/", "./usr/lib/modules/"] @@ -393,9 +461,10 @@ pub(crate) fn run(opts: Options) -> Result<()> { } }) { - return Disposition::Unpack( + return Disposition::Unpack(( (path.iter().count() == 1).then_some(modules_dirs), - ); + ControlFlow::Continue, + )); } if !entry_type.is_file() { return Disposition::Skip; @@ -414,37 +483,59 @@ pub(crate) fn run(opts: Options) -> Result<()> { }; let name = name.as_encoded_bytes(); if name.starts_with(b"vmlinuz-") { - Disposition::Unpack(Some(kernel_images)) + Disposition::Unpack((Some(kernel_images), ControlFlow::Continue)) } else if name.starts_with(b"config-") { - Disposition::Unpack(Some(configs)) + Disposition::Unpack((Some(configs), ControlFlow::Continue)) } else { Disposition::Skip } }, )?; - let kernel_image = match kernel_images.as_slice() { - [kernel_image] => kernel_image, - [] => bail!("no kernel images in {}", archive.display()), - kernel_images => bail!( - "multiple kernel images in {}: {:?}", - archive.display(), - kernel_images - ), - }; - let config = match configs.as_slice() { - [config] => config, - [] => bail!("no configs in {}", archive.display()), - configs => bail!("multiple configs in {}: {:?}", archive.display(), configs), - }; - let modules_dir = match modules_dirs.as_slice() { - [modules_dir] => modules_dir, - [] => bail!("no modules directories in {}", archive.display()), - modules_dirs => bail!( - "multiple modules directories in {}: {:?}", - archive.display(), - modules_dirs - ), - }; + let kernel_image = one(kernel_images.as_slice()) + .with_context(|| format!("kernel image in {}", kernel_archive.display()))?; + let config = one(configs.as_slice()) + .with_context(|| format!("config in {}", kernel_archive.display()))?; + let modules_dir = one(modules_dirs.as_slice()).with_context(|| { + format!("modules directory in {}", kernel_archive.display()) + })?; + + let system_maps = with_deb( + debug_archive, + &extraction_root + .path() + .join(format!("kernel-archive-{index}-debug")), + Vec::new(), + |system_maps: &mut Vec, path, entry_type| { + if entry_type != tar::EntryType::Regular { + return Disposition::Skip; + } + let name = match path.strip_prefix("./usr/lib/debug/boot/") { + Ok(path) => { + if let Some(path::Component::Normal(name)) = + path.components().next() + { + name + } else { + return Disposition::Skip; + } + } + Err(path::StripPrefixError { .. }) => { + return Disposition::Skip; + } + }; + if name.as_encoded_bytes().starts_with(b"System.map-") { + // We only expect one System.map in the debug archive; ordinarily + // we'd walk the whole archive to assert this fact but it turns out + // that doing so takes around 10 seconds while stopping early takes + // around 1ms. + Disposition::Unpack((Some(system_maps), ControlFlow::Break)) + } else { + Disposition::Skip + } + }, + )?; + let system_map = one(system_maps.as_slice()) + .with_context(|| format!("System.map in {}", debug_archive.display()))?; // Guess the guest architecture. let mut file = Command::new("file"); @@ -580,6 +671,11 @@ pub(crate) fn run(opts: Options) -> Result<()> { write_file(&Path::new("/boot").join(name), config, "644 0 0"); } + write_file(Path::new("/boot/System.map"), system_map, "644 0 0"); + if let Some(name) = system_map.file_name() { + write_file(&Path::new("/boot").join(name), system_map, "644 0 0"); + } + test_distro.iter().for_each(|(name, path)| { if name == "init" { write_file(Path::new("/init"), path, "755 0 0"); From 5dd6d94342b685c015e91c8b1a54bd844e76c345 Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Tue, 11 Nov 2025 09:07:06 -0500 Subject: [PATCH 25/46] .github: update reference The referenced issue has hundreds of automated mentions, making it quite hard to look at. --- .github/workflows/ci.yml | 3 ++- .github/workflows/gen.yml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0a3ca4c9..1a0307e1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,8 +55,9 @@ jobs: # abuse; the canonical workaround is to use a sufficiently authorized # token. # - # See https://github.com/peter-evans/create-pull-request/issues/48. + # See https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#workarounds-to-trigger-further-workflow-runs. token: ${{ secrets.CRABBY_GITHUB_TOKEN }} + push-to-fork: crabby-the-crab/aya branch: create-pull-request/public-api commit-message: 'public-api: regenerate' title: 'public-api: regenerate' diff --git a/.github/workflows/gen.yml b/.github/workflows/gen.yml index e63ccc1b..c2204c87 100644 --- a/.github/workflows/gen.yml +++ b/.github/workflows/gen.yml @@ -47,8 +47,9 @@ jobs: # abuse; the canonical workaround is to use a sufficiently authorized # token. # - # See https://github.com/peter-evans/create-pull-request/issues/48. + # See https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#workarounds-to-trigger-further-workflow-runs. token: ${{ secrets.CRABBY_GITHUB_TOKEN }} + push-to-fork: crabby-the-crab/aya branch: create-pull-request/codegen commit-message: | aya-obj, aya-ebpf-bindings: regenerate From 9518ff8ca66145804f6ddb252f7674ab3b22b6aa Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Tue, 11 Nov 2025 09:20:48 -0500 Subject: [PATCH 26/46] .github: use alls-green --- .github/workflows/ci.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1a0307e1..f9a5bf0a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -374,11 +374,8 @@ jobs: cargo xtask integration-test vm --cache-dir test/.tmp \ --github-api-token ${{ secrets.GITHUB_TOKEN }} - # Provides a single status check for the entire build workflow. - # This is used for merge automation, like Mergify, since GH actions - # has no concept of "when all status checks pass". - # https://docs.mergify.com/conditions/#validating-all-status-checks - build-workflow-complete: + check: + if: always() needs: - lint - build-test-aya @@ -386,4 +383,6 @@ jobs: - run-integration-test runs-on: ubuntu-latest steps: - - run: echo 'Build Complete' + - uses: re-actors/alls-green@release/v1 + with: + jobs: ${{ toJSON(needs) }} From a3282e1d1415eef2673a40c16f000cadac94f3ba Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Tue, 11 Nov 2025 09:02:05 -0500 Subject: [PATCH 27/46] .github: make minimally-authorized token We only use this to download public repos. --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f9a5bf0a..d522283d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -212,6 +212,7 @@ jobs: fi run-integration-test: + permissions: {} strategy: fail-fast: false matrix: From b21284f36b8a886da97ea5f34f787941bd9755e7 Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Tue, 11 Nov 2025 09:52:09 -0500 Subject: [PATCH 28/46] .github: move permissions to workflow root --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d522283d..b77ad09d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,6 +11,8 @@ on: env: CARGO_TERM_COLOR: always +permissions: {} + jobs: lint: runs-on: ubuntu-latest @@ -212,7 +214,6 @@ jobs: fi run-integration-test: - permissions: {} strategy: fail-fast: false matrix: From 62a92af00e76c834f3f37d16b4d2554fd855f95c Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Tue, 11 Nov 2025 09:57:49 -0500 Subject: [PATCH 29/46] .github: restrict permissions --- .github/workflows/gen.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/gen.yml b/.github/workflows/gen.yml index c2204c87..2ddbc90f 100644 --- a/.github/workflows/gen.yml +++ b/.github/workflows/gen.yml @@ -10,6 +10,8 @@ on: workflow_dispatch: +permissions: {} + jobs: codegen: runs-on: ubuntu-latest From 2a33c642de01f8c7f1e3165e71066412e96df31a Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Tue, 11 Nov 2025 09:58:20 -0500 Subject: [PATCH 30/46] .github: remove push-to-fork We need to create the fork first. --- .github/workflows/ci.yml | 1 - .github/workflows/gen.yml | 1 - 2 files changed, 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b77ad09d..2cb36c5e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,7 +59,6 @@ jobs: # # See https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#workarounds-to-trigger-further-workflow-runs. token: ${{ secrets.CRABBY_GITHUB_TOKEN }} - push-to-fork: crabby-the-crab/aya branch: create-pull-request/public-api commit-message: 'public-api: regenerate' title: 'public-api: regenerate' diff --git a/.github/workflows/gen.yml b/.github/workflows/gen.yml index 2ddbc90f..03d5c43b 100644 --- a/.github/workflows/gen.yml +++ b/.github/workflows/gen.yml @@ -51,7 +51,6 @@ jobs: # # See https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#workarounds-to-trigger-further-workflow-runs. token: ${{ secrets.CRABBY_GITHUB_TOKEN }} - push-to-fork: crabby-the-crab/aya branch: create-pull-request/codegen commit-message: | aya-obj, aya-ebpf-bindings: regenerate From 14a844256a5140c45cb12b05c265a245b6022f9e Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Tue, 11 Nov 2025 10:18:48 -0500 Subject: [PATCH 31/46] macros: remove glob imports --- aya-ebpf-macros/src/kprobe.rs | 5 ++--- aya-ebpf-macros/src/uprobe.rs | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/aya-ebpf-macros/src/kprobe.rs b/aya-ebpf-macros/src/kprobe.rs index ba5ea31b..97cd53b3 100644 --- a/aya-ebpf-macros/src/kprobe.rs +++ b/aya-ebpf-macros/src/kprobe.rs @@ -15,10 +15,9 @@ pub(crate) enum KProbeKind { impl std::fmt::Display for KProbeKind { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - use KProbeKind::*; match self { - KProbe => write!(f, "kprobe"), - KRetProbe => write!(f, "kretprobe"), + Self::KProbe => write!(f, "kprobe"), + Self::KRetProbe => write!(f, "kretprobe"), } } } diff --git a/aya-ebpf-macros/src/uprobe.rs b/aya-ebpf-macros/src/uprobe.rs index bc748635..8005c50c 100644 --- a/aya-ebpf-macros/src/uprobe.rs +++ b/aya-ebpf-macros/src/uprobe.rs @@ -15,10 +15,9 @@ pub(crate) enum UProbeKind { impl std::fmt::Display for UProbeKind { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - use UProbeKind::*; match self { - UProbe => write!(f, "uprobe"), - URetProbe => write!(f, "uretprobe"), + Self::UProbe => write!(f, "uprobe"), + Self::URetProbe => write!(f, "uretprobe"), } } } From 1791d497d3af39bd8da4eb666dece22c60e97281 Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Tue, 11 Nov 2025 14:58:50 -0500 Subject: [PATCH 32/46] programs: remove superfluous type ascription --- aya/src/programs/probe.rs | 4 ++-- aya/src/programs/trace_point.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/aya/src/programs/probe.rs b/aya/src/programs/probe.rs index 9f6eea90..21419e08 100644 --- a/aya/src/programs/probe.rs +++ b/aya/src/programs/probe.rs @@ -324,7 +324,7 @@ fn read_sys_fs_perf_type(pmu: &str) -> Result { .join("type"); fs::read_to_string(&file) - .and_then(|perf_ty| perf_ty.trim().parse::().map_err(io::Error::other)) + .and_then(|perf_ty| perf_ty.trim().parse().map_err(io::Error::other)) .map_err(|e| (file, e)) } @@ -340,7 +340,7 @@ fn read_sys_fs_perf_ret_probe(pmu: &str) -> Result { .next() .ok_or_else(|| io::Error::other("invalid format"))?; - config.parse::().map_err(io::Error::other) + config.parse().map_err(io::Error::other) }) .map_err(|e| (file, e)) } diff --git a/aya/src/programs/trace_point.rs b/aya/src/programs/trace_point.rs index 651e8b13..564e3a57 100644 --- a/aya/src/programs/trace_point.rs +++ b/aya/src/programs/trace_point.rs @@ -122,7 +122,7 @@ pub(crate) fn read_sys_fs_trace_point_id( Ok(id) => id, Err(io_error) => return Err(TracePointError::FileError { filename, io_error }), }; - let id = match id.trim().parse::() { + let id = match id.trim().parse() { Ok(id) => id, Err(error) => { return Err(TracePointError::FileError { From 27c7f1c84f29a6f5e775ce6761a87859a351d95d Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Wed, 12 Nov 2025 11:26:08 -0500 Subject: [PATCH 33/46] programs: disambiguate `fd` names --- aya/src/programs/perf_attach.rs | 24 ++++++++++++------------ aya/src/programs/perf_event.rs | 4 ++-- aya/src/programs/probe.rs | 12 ++++++------ aya/src/programs/trace_point.rs | 4 ++-- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/aya/src/programs/perf_attach.rs b/aya/src/programs/perf_attach.rs index 00cddbd1..2e73501a 100644 --- a/aya/src/programs/perf_attach.rs +++ b/aya/src/programs/perf_attach.rs @@ -83,7 +83,7 @@ id_as_key!(PerfLink, PerfLinkId); pub(crate) fn perf_attach( prog_fd: BorrowedFd<'_>, - fd: crate::MockableFd, + perf_fd: crate::MockableFd, cookie: Option, ) -> Result { if cookie.is_some() && (!is_bpf_cookie_supported() || !FEATURES.bpf_perf_link()) { @@ -92,7 +92,7 @@ pub(crate) fn perf_attach( if FEATURES.bpf_perf_link() { let link_fd = bpf_link_create( prog_fd, - LinkTarget::Fd(fd.as_fd()), + LinkTarget::Fd(perf_fd.as_fd()), BPF_PERF_EVENT, 0, cookie.map(|bpf_cookie| BpfLinkCreateArgs::PerfEvent { bpf_cookie }), @@ -103,35 +103,35 @@ pub(crate) fn perf_attach( })?; Ok(PerfLinkInner::Fd(FdLink::new(link_fd))) } else { - perf_attach_either(prog_fd, fd, None) + perf_attach_either(prog_fd, perf_fd, None) } } pub(crate) fn perf_attach_debugfs( prog_fd: BorrowedFd<'_>, - fd: crate::MockableFd, + perf_fd: crate::MockableFd, event: ProbeEvent, ) -> Result { - perf_attach_either(prog_fd, fd, Some(event)) + perf_attach_either(prog_fd, perf_fd, Some(event)) } fn perf_attach_either( prog_fd: BorrowedFd<'_>, - fd: crate::MockableFd, + perf_fd: crate::MockableFd, event: Option, ) -> Result { - perf_event_ioctl(fd.as_fd(), PerfEventIoctlRequest::SetBpf(prog_fd)).map_err(|io_error| { - SyscallError { + perf_event_ioctl(perf_fd.as_fd(), PerfEventIoctlRequest::SetBpf(prog_fd)).map_err( + |io_error| SyscallError { call: "PERF_EVENT_IOC_SET_BPF", io_error, - } - })?; - perf_event_ioctl(fd.as_fd(), PerfEventIoctlRequest::Enable).map_err(|io_error| { + }, + )?; + perf_event_ioctl(perf_fd.as_fd(), PerfEventIoctlRequest::Enable).map_err(|io_error| { SyscallError { call: "PERF_EVENT_IOC_ENABLE", io_error, } })?; - Ok(PerfLinkInner::PerfLink(PerfLink { perf_fd: fd, event })) + Ok(PerfLinkInner::PerfLink(PerfLink { perf_fd, event })) } diff --git a/aya/src/programs/perf_event.rs b/aya/src/programs/perf_event.rs index 93421ba7..2e14918e 100644 --- a/aya/src/programs/perf_event.rs +++ b/aya/src/programs/perf_event.rs @@ -456,7 +456,7 @@ impl PerfEvent { let prog_fd = self.fd()?; let prog_fd = prog_fd.as_fd(); - let fd = perf_event_open( + let perf_fd = perf_event_open( config, scope, sample_policy, @@ -469,7 +469,7 @@ impl PerfEvent { io_error, })?; - let link = perf_attach(prog_fd, fd, None /* cookie */)?; + let link = perf_attach(prog_fd, perf_fd, None /* cookie */)?; self.data.links.insert(PerfEventLink::new(link)) } } diff --git a/aya/src/programs/probe.rs b/aya/src/programs/probe.rs index 21419e08..a8a0d1ab 100644 --- a/aya/src/programs/probe.rs +++ b/aya/src/programs/probe.rs @@ -122,11 +122,11 @@ pub(crate) fn attach>( if cookie.is_some() { return Err(ProgramError::AttachCookieNotSupported); } - let (fd, event_alias) = create_as_trace_point(kind, fn_name, offset, pid)?; - perf_attach_debugfs(prog_fd, fd, ProbeEvent { kind, event_alias }) + let (perf_fd, event_alias) = create_as_trace_point(kind, fn_name, offset, pid)?; + perf_attach_debugfs(prog_fd, perf_fd, ProbeEvent { kind, event_alias }) } else { - let fd = create_as_probe(kind, fn_name, offset, pid)?; - perf_attach(prog_fd, fd, cookie) + let perf_fd = create_as_probe(kind, fn_name, offset, pid)?; + perf_attach(prog_fd, perf_fd, cookie) }?; program_data.links.insert(T::from(link)) } @@ -203,12 +203,12 @@ fn create_as_trace_point( let category = format!("{}s", kind.pmu()); let tpid = read_sys_fs_trace_point_id(tracefs, &category, event_alias.as_ref())?; - let fd = perf_event_open_trace_point(tpid, pid).map_err(|io_error| SyscallError { + let perf_fd = perf_event_open_trace_point(tpid, pid).map_err(|io_error| SyscallError { call: "perf_event_open", io_error, })?; - Ok((fd, event_alias)) + Ok((perf_fd, event_alias)) } fn create_probe_event( diff --git a/aya/src/programs/trace_point.rs b/aya/src/programs/trace_point.rs index 564e3a57..7edbae3e 100644 --- a/aya/src/programs/trace_point.rs +++ b/aya/src/programs/trace_point.rs @@ -79,12 +79,12 @@ impl TracePoint { let prog_fd = prog_fd.as_fd(); let tracefs = find_tracefs_path()?; let id = read_sys_fs_trace_point_id(tracefs, category, name.as_ref())?; - let fd = perf_event_open_trace_point(id, None).map_err(|io_error| SyscallError { + let perf_fd = perf_event_open_trace_point(id, None).map_err(|io_error| SyscallError { call: "perf_event_open_trace_point", io_error, })?; - let link = perf_attach(prog_fd, fd, None /* cookie */)?; + let link = perf_attach(prog_fd, perf_fd, None /* cookie */)?; self.data.links.insert(TracePointLink::new(link)) } } From 7e07f85edcbdbe2f5d1c49a872e56d1ff458991e Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Tue, 11 Nov 2025 14:48:52 -0500 Subject: [PATCH 34/46] perf_attach: privatize PerfLink There's no way to obtain this type externally. --- aya/src/programs/perf_attach.rs | 2 +- xtask/public-api/aya.txt | 48 --------------------------------- 2 files changed, 1 insertion(+), 49 deletions(-) diff --git a/aya/src/programs/perf_attach.rs b/aya/src/programs/perf_attach.rs index 2e73501a..5118321f 100644 --- a/aya/src/programs/perf_attach.rs +++ b/aya/src/programs/perf_attach.rs @@ -56,7 +56,7 @@ pub struct PerfLinkId(RawFd); /// The attachment type of PerfEvent programs. #[derive(Debug)] -pub struct PerfLink { +pub(crate) struct PerfLink { perf_fd: crate::MockableFd, event: Option, } diff --git a/xtask/public-api/aya.txt b/xtask/public-api/aya.txt index 8690f622..da53c8d3 100644 --- a/xtask/public-api/aya.txt +++ b/xtask/public-api/aya.txt @@ -4781,10 +4781,6 @@ impl aya::programs::links::Link for aya::programs::lsm_cgroup::LsmLink pub type aya::programs::lsm_cgroup::LsmLink::Id = aya::programs::lsm_cgroup::LsmLinkId pub fn aya::programs::lsm_cgroup::LsmLink::detach(self) -> core::result::Result<(), aya::programs::ProgramError> pub fn aya::programs::lsm_cgroup::LsmLink::id(&self) -> Self::Id -impl aya::programs::links::Link for aya::programs::perf_attach::PerfLink -pub type aya::programs::perf_attach::PerfLink::Id = aya::programs::perf_attach::PerfLinkId -pub fn aya::programs::perf_attach::PerfLink::detach(self) -> core::result::Result<(), aya::programs::ProgramError> -pub fn aya::programs::perf_attach::PerfLink::id(&self) -> Self::Id impl aya::programs::links::Link for aya::programs::perf_event::PerfEventLink pub type aya::programs::perf_event::PerfEventLink::Id = aya::programs::perf_event::PerfEventLinkId pub fn aya::programs::perf_event::PerfEventLink::detach(self) -> core::result::Result<(), aya::programs::ProgramError> @@ -5225,44 +5221,6 @@ pub fn aya::programs::lsm_cgroup::LsmLinkId::borrow_mut(&mut self) -> &mut T impl core::convert::From for aya::programs::lsm_cgroup::LsmLinkId pub fn aya::programs::lsm_cgroup::LsmLinkId::from(t: T) -> T pub mod aya::programs::perf_attach -pub struct aya::programs::perf_attach::PerfLink -impl aya::programs::links::Link for aya::programs::perf_attach::PerfLink -pub type aya::programs::perf_attach::PerfLink::Id = aya::programs::perf_attach::PerfLinkId -pub fn aya::programs::perf_attach::PerfLink::detach(self) -> core::result::Result<(), aya::programs::ProgramError> -pub fn aya::programs::perf_attach::PerfLink::id(&self) -> Self::Id -impl core::cmp::Eq for aya::programs::perf_attach::PerfLink -impl core::cmp::PartialEq for aya::programs::perf_attach::PerfLink -pub fn aya::programs::perf_attach::PerfLink::eq(&self, other: &Self) -> bool -impl core::fmt::Debug for aya::programs::perf_attach::PerfLink -pub fn aya::programs::perf_attach::PerfLink::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result -impl core::hash::Hash for aya::programs::perf_attach::PerfLink -pub fn aya::programs::perf_attach::PerfLink::hash(&self, state: &mut H) -impl equivalent::Equivalent for aya::programs::perf_attach::PerfLinkId -pub fn aya::programs::perf_attach::PerfLinkId::equivalent(&self, key: &aya::programs::perf_attach::PerfLink) -> bool -impl core::marker::Freeze for aya::programs::perf_attach::PerfLink -impl core::marker::Send for aya::programs::perf_attach::PerfLink -impl core::marker::Sync for aya::programs::perf_attach::PerfLink -impl core::marker::Unpin for aya::programs::perf_attach::PerfLink -impl core::panic::unwind_safe::RefUnwindSafe for aya::programs::perf_attach::PerfLink -impl core::panic::unwind_safe::UnwindSafe for aya::programs::perf_attach::PerfLink -impl equivalent::Equivalent for aya::programs::perf_attach::PerfLink where Q: core::cmp::Eq + ?core::marker::Sized, K: core::borrow::Borrow + ?core::marker::Sized -pub fn aya::programs::perf_attach::PerfLink::equivalent(&self, key: &K) -> bool -impl core::convert::Into for aya::programs::perf_attach::PerfLink where U: core::convert::From -pub fn aya::programs::perf_attach::PerfLink::into(self) -> U -impl core::convert::TryFrom for aya::programs::perf_attach::PerfLink where U: core::convert::Into -pub type aya::programs::perf_attach::PerfLink::Error = core::convert::Infallible -pub fn aya::programs::perf_attach::PerfLink::try_from(value: U) -> core::result::Result>::Error> -impl core::convert::TryInto for aya::programs::perf_attach::PerfLink where U: core::convert::TryFrom -pub type aya::programs::perf_attach::PerfLink::Error = >::Error -pub fn aya::programs::perf_attach::PerfLink::try_into(self) -> core::result::Result>::Error> -impl core::any::Any for aya::programs::perf_attach::PerfLink where T: 'static + ?core::marker::Sized -pub fn aya::programs::perf_attach::PerfLink::type_id(&self) -> core::any::TypeId -impl core::borrow::Borrow for aya::programs::perf_attach::PerfLink where T: ?core::marker::Sized -pub fn aya::programs::perf_attach::PerfLink::borrow(&self) -> &T -impl core::borrow::BorrowMut for aya::programs::perf_attach::PerfLink where T: ?core::marker::Sized -pub fn aya::programs::perf_attach::PerfLink::borrow_mut(&mut self) -> &mut T -impl core::convert::From for aya::programs::perf_attach::PerfLink -pub fn aya::programs::perf_attach::PerfLink::from(t: T) -> T pub struct aya::programs::perf_attach::PerfLinkId(_) impl core::cmp::Eq for aya::programs::perf_attach::PerfLinkId impl core::cmp::PartialEq for aya::programs::perf_attach::PerfLinkId @@ -5272,8 +5230,6 @@ pub fn aya::programs::perf_attach::PerfLinkId::fmt(&self, f: &mut core::fmt::For impl core::hash::Hash for aya::programs::perf_attach::PerfLinkId pub fn aya::programs::perf_attach::PerfLinkId::hash<__H: core::hash::Hasher>(&self, state: &mut __H) impl core::marker::StructuralPartialEq for aya::programs::perf_attach::PerfLinkId -impl equivalent::Equivalent for aya::programs::perf_attach::PerfLinkId -pub fn aya::programs::perf_attach::PerfLinkId::equivalent(&self, key: &aya::programs::perf_attach::PerfLink) -> bool impl core::marker::Freeze for aya::programs::perf_attach::PerfLinkId impl core::marker::Send for aya::programs::perf_attach::PerfLinkId impl core::marker::Sync for aya::programs::perf_attach::PerfLinkId @@ -10482,10 +10438,6 @@ impl aya::programs::links::Link for aya::programs::lsm_cgroup::LsmLink pub type aya::programs::lsm_cgroup::LsmLink::Id = aya::programs::lsm_cgroup::LsmLinkId pub fn aya::programs::lsm_cgroup::LsmLink::detach(self) -> core::result::Result<(), aya::programs::ProgramError> pub fn aya::programs::lsm_cgroup::LsmLink::id(&self) -> Self::Id -impl aya::programs::links::Link for aya::programs::perf_attach::PerfLink -pub type aya::programs::perf_attach::PerfLink::Id = aya::programs::perf_attach::PerfLinkId -pub fn aya::programs::perf_attach::PerfLink::detach(self) -> core::result::Result<(), aya::programs::ProgramError> -pub fn aya::programs::perf_attach::PerfLink::id(&self) -> Self::Id impl aya::programs::links::Link for aya::programs::perf_event::PerfEventLink pub type aya::programs::perf_event::PerfEventLink::Id = aya::programs::perf_event::PerfEventLinkId pub fn aya::programs::perf_event::PerfEventLink::detach(self) -> core::result::Result<(), aya::programs::ProgramError> From d4b2dde78ac88b0e7e9141e0675bd8888f23c1f6 Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Mon, 10 Nov 2025 17:09:25 -0500 Subject: [PATCH 35/46] perf_event: inline `perf_event_open_bpf` This function has one caller and provides no abstraction. --- aya/src/maps/perf/perf_buffer.rs | 20 +++++++++++++++----- aya/src/sys/perf_event.rs | 16 ++-------------- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/aya/src/maps/perf/perf_buffer.rs b/aya/src/maps/perf/perf_buffer.rs index df0e4974..464262e3 100644 --- a/aya/src/maps/perf/perf_buffer.rs +++ b/aya/src/maps/perf/perf_buffer.rs @@ -6,7 +6,7 @@ use std::{ }; use aya_obj::generated::{ - perf_event_header, perf_event_mmap_page, + PERF_FLAG_FD_CLOEXEC, perf_event_header, perf_event_mmap_page, perf_event_type::{PERF_RECORD_LOST, PERF_RECORD_SAMPLE}, }; use bytes::BytesMut; @@ -14,7 +14,10 @@ use libc::{MAP_SHARED, PROT_READ, PROT_WRITE}; use thiserror::Error; use crate::{ - sys::{PerfEventIoctlRequest, SyscallError, perf_event_ioctl, perf_event_open_bpf}, + programs::perf_event::{ + PerfEventConfig, PerfEventScope, SamplePolicy, SoftwareEvent, WakeupPolicy, + }, + sys::{PerfEventIoctlRequest, SyscallError, perf_event_ioctl, perf_event_open}, util::MMap, }; @@ -92,7 +95,7 @@ pub(crate) struct PerfBuffer { impl PerfBuffer { pub(crate) fn open( - cpu_id: u32, + cpu: u32, page_size: usize, page_count: usize, ) -> Result { @@ -100,8 +103,15 @@ impl PerfBuffer { return Err(PerfBufferError::InvalidPageCount { page_count }); } - let fd = perf_event_open_bpf(cpu_id as i32) - .map_err(|io_error| PerfBufferError::OpenError { io_error })?; + let fd = perf_event_open( + PerfEventConfig::Software(SoftwareEvent::BpfOutput), + PerfEventScope::AllProcessesOneCpu { cpu }, + SamplePolicy::Period(1), + WakeupPolicy::Events(1), + false, + PERF_FLAG_FD_CLOEXEC, + ) + .map_err(|io_error| PerfBufferError::OpenError { io_error })?; let size = page_size * page_count; let mmap = MMap::new( fd.as_fd(), diff --git a/aya/src/sys/perf_event.rs b/aya/src/sys/perf_event.rs index b9de4c71..50fcabcb 100644 --- a/aya/src/sys/perf_event.rs +++ b/aya/src/sys/perf_event.rs @@ -1,5 +1,5 @@ use std::{ - ffi::{CString, OsStr, c_int, c_long, c_uint}, + ffi::{CString, OsStr, c_long, c_uint}, io, mem, os::fd::{BorrowedFd, FromRawFd as _}, }; @@ -17,7 +17,7 @@ use libc::pid_t; use super::{PerfEventIoctlRequest, Syscall, syscall}; use crate::programs::perf_event::{ - BreakpointConfig, PerfEventConfig, PerfEventScope, SamplePolicy, SoftwareEvent, WakeupPolicy, + BreakpointConfig, PerfEventConfig, PerfEventScope, SamplePolicy, WakeupPolicy, perf_type_id_to_u32, }; @@ -128,18 +128,6 @@ pub(crate) fn perf_event_open( perf_event_sys(attr, pid, cpu, flags) } -pub(crate) fn perf_event_open_bpf(cpu: c_int) -> io::Result { - let cpu = cpu as u32; - perf_event_open( - PerfEventConfig::Software(SoftwareEvent::BpfOutput), - PerfEventScope::AllProcessesOneCpu { cpu }, - SamplePolicy::Period(1), - WakeupPolicy::Events(1), - false, - PERF_FLAG_FD_CLOEXEC, - ) -} - pub(crate) fn perf_event_open_probe( ty: u32, ret_bit: Option, From 1944c4aa008d685053bb617b728e3e4f723d7672 Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Tue, 11 Nov 2025 16:29:27 -0500 Subject: [PATCH 36/46] perf_event: refactor perf_event_open_trace_point Rewrite it in terms of perf_event_open. --- aya/src/programs/probe.rs | 8 +++----- aya/src/programs/trace_point.rs | 2 +- aya/src/programs/uprobe.rs | 18 ++++++++--------- aya/src/sys/perf_event.rs | 34 ++++++++++++++++++--------------- xtask/public-api/aya.txt | 8 ++++---- 5 files changed, 36 insertions(+), 34 deletions(-) diff --git a/aya/src/programs/probe.rs b/aya/src/programs/probe.rs index a8a0d1ab..e921fbdb 100644 --- a/aya/src/programs/probe.rs +++ b/aya/src/programs/probe.rs @@ -9,8 +9,6 @@ use std::{ sync::atomic::{AtomicUsize, Ordering}, }; -use libc::pid_t; - use crate::{ programs::{ Link, ProgramData, ProgramError, kprobe::KProbeError, perf_attach, @@ -111,7 +109,7 @@ pub(crate) fn attach>( // separate argument. fn_name: &OsStr, offset: u64, - pid: Option, + pid: Option, cookie: Option, ) -> Result { // https://github.com/torvalds/linux/commit/e12f03d7031a977356e3d7b75a68c2185ff8d155 @@ -153,7 +151,7 @@ fn create_as_probe( kind: ProbeKind, fn_name: &OsStr, offset: u64, - pid: Option, + pid: Option, ) -> Result { use ProbeKind::*; @@ -188,7 +186,7 @@ fn create_as_trace_point( kind: ProbeKind, name: &OsStr, offset: u64, - pid: Option, + pid: Option, ) -> Result<(crate::MockableFd, OsString), ProgramError> { use ProbeKind::*; diff --git a/aya/src/programs/trace_point.rs b/aya/src/programs/trace_point.rs index 7edbae3e..4fbc83b9 100644 --- a/aya/src/programs/trace_point.rs +++ b/aya/src/programs/trace_point.rs @@ -115,7 +115,7 @@ pub(crate) fn read_sys_fs_trace_point_id( tracefs: &Path, category: &str, name: &Path, -) -> Result { +) -> Result { let filename = tracefs.join("events").join(category).join(name).join("id"); let id = match fs::read_to_string(&filename) { diff --git a/aya/src/programs/uprobe.rs b/aya/src/programs/uprobe.rs index d762f8a8..16899c35 100644 --- a/aya/src/programs/uprobe.rs +++ b/aya/src/programs/uprobe.rs @@ -11,7 +11,6 @@ use std::{ }; use aya_obj::generated::{bpf_link_type, bpf_prog_type::BPF_PROG_TYPE_KPROBE}; -use libc::pid_t; use object::{Object as _, ObjectSection as _, ObjectSymbol as _, Symbol}; use thiserror::Error; @@ -109,7 +108,7 @@ impl UProbe { &mut self, location: Loc, target: T, - pid: Option, + pid: Option, cookie: Option, ) -> Result { let proc_map = pid.map(ProcMap::new).transpose()?; @@ -159,9 +158,10 @@ where .and_then(|proc_map| { proc_map .find_library_path_by_name(target) - .map_err(|source| UProbeError::ProcMap { - pid: proc_map.pid, - source, + .map_err(|source| { + let ProcMap { pid, data: _ } = proc_map; + let pid = *pid; + UProbeError::ProcMap { pid, source } }) .transpose() }) @@ -190,7 +190,7 @@ where )] fn test_resolve_attach_path() { // Look up the current process's pid. - let pid = std::process::id().try_into().unwrap(); + let pid = std::process::id(); let proc_map = ProcMap::new(pid).unwrap(); // Now let's resolve the path to libc. It should exist in the current process's memory map and @@ -287,7 +287,7 @@ pub enum UProbeError { #[error("error fetching libs for {pid}")] ProcMap { /// The pid. - pid: i32, + pid: u32, /// The [`ProcMapError`] that caused the error. #[source] source: ProcMapError, @@ -419,12 +419,12 @@ impl<'a> ProcMapEntry<'a> { /// /// The information here may be used to resolve addresses to paths. struct ProcMap { - pid: pid_t, + pid: u32, data: T, } impl ProcMap> { - fn new(pid: pid_t) -> Result { + fn new(pid: u32) -> Result { let filename = PathBuf::from(format!("/proc/{pid}/maps")); let data = fs::read(&filename) .map_err(|io_error| UProbeError::FileError { filename, io_error })?; diff --git a/aya/src/sys/perf_event.rs b/aya/src/sys/perf_event.rs index 50fcabcb..c5592c83 100644 --- a/aya/src/sys/perf_event.rs +++ b/aya/src/sys/perf_event.rs @@ -133,7 +133,7 @@ pub(crate) fn perf_event_open_probe( ret_bit: Option, name: &OsStr, offset: u64, - pid: Option, + pid: Option, ) -> io::Result { use std::os::unix::ffi::OsStrExt as _; @@ -150,26 +150,30 @@ pub(crate) fn perf_event_open_probe( attr.__bindgen_anon_3.config1 = c_name.as_ptr() as u64; attr.__bindgen_anon_4.config2 = offset; - let cpu = if pid.is_some() { -1 } else { 0 }; - let pid = pid.unwrap_or(-1); + let (pid, cpu) = match pid { + Some(pid) => (pid as i32, -1), + None => (-1, 0), + }; perf_event_sys(attr, pid, cpu, PERF_FLAG_FD_CLOEXEC) } pub(crate) fn perf_event_open_trace_point( - id: u32, - pid: Option, + event_id: u64, + pid: Option, ) -> io::Result { - let mut attr = unsafe { mem::zeroed::() }; - - attr.size = mem::size_of::() as u32; - attr.type_ = PERF_TYPE_TRACEPOINT as u32; - attr.config = u64::from(id); - - let cpu = if pid.is_some() { -1 } else { 0 }; - let pid = pid.unwrap_or(-1); - - perf_event_sys(attr, pid, cpu, PERF_FLAG_FD_CLOEXEC) + let scope = match pid { + Some(pid) => PerfEventScope::OneProcess { pid, cpu: None }, + None => PerfEventScope::AllProcessesOneCpu { cpu: 0 }, + }; + perf_event_open( + PerfEventConfig::TracePoint { event_id }, + scope, + SamplePolicy::Period(0), + WakeupPolicy::Events(1), + false, + PERF_FLAG_FD_CLOEXEC, + ) } pub(crate) fn perf_event_ioctl( diff --git a/xtask/public-api/aya.txt b/xtask/public-api/aya.txt index da53c8d3..fce3d730 100644 --- a/xtask/public-api/aya.txt +++ b/xtask/public-api/aya.txt @@ -7374,7 +7374,7 @@ pub aya::programs::uprobe::UProbeError::InvalidLdSoCache::io_error: &'static std pub aya::programs::uprobe::UProbeError::InvalidTarget pub aya::programs::uprobe::UProbeError::InvalidTarget::path: std::path::PathBuf pub aya::programs::uprobe::UProbeError::ProcMap -pub aya::programs::uprobe::UProbeError::ProcMap::pid: i32 +pub aya::programs::uprobe::UProbeError::ProcMap::pid: u32 pub aya::programs::uprobe::UProbeError::ProcMap::source: aya::programs::uprobe::ProcMapError pub aya::programs::uprobe::UProbeError::SymbolError pub aya::programs::uprobe::UProbeError::SymbolError::error: alloc::boxed::Box<(dyn core::error::Error + core::marker::Send + core::marker::Sync)> @@ -7414,7 +7414,7 @@ pub fn aya::programs::uprobe::UProbeError::from(t: T) -> T pub struct aya::programs::uprobe::UProbe impl aya::programs::uprobe::UProbe pub const aya::programs::uprobe::UProbe::PROGRAM_TYPE: aya::programs::ProgramType -pub fn aya::programs::uprobe::UProbe::attach<'loc, T: core::convert::AsRef, Loc: core::convert::Into>>(&mut self, location: Loc, target: T, pid: core::option::Option, cookie: core::option::Option) -> core::result::Result +pub fn aya::programs::uprobe::UProbe::attach<'loc, T: core::convert::AsRef, Loc: core::convert::Into>>(&mut self, location: Loc, target: T, pid: core::option::Option, cookie: core::option::Option) -> core::result::Result pub fn aya::programs::uprobe::UProbe::from_pin>(path: P, kind: aya::programs::ProbeKind) -> core::result::Result pub fn aya::programs::uprobe::UProbe::kind(&self) -> aya::programs::ProbeKind pub fn aya::programs::uprobe::UProbe::load(&mut self) -> core::result::Result<(), aya::programs::ProgramError> @@ -8627,7 +8627,7 @@ pub aya::programs::UProbeError::InvalidLdSoCache::io_error: &'static std::io::er pub aya::programs::UProbeError::InvalidTarget pub aya::programs::UProbeError::InvalidTarget::path: std::path::PathBuf pub aya::programs::UProbeError::ProcMap -pub aya::programs::UProbeError::ProcMap::pid: i32 +pub aya::programs::UProbeError::ProcMap::pid: u32 pub aya::programs::UProbeError::ProcMap::source: aya::programs::uprobe::ProcMapError pub aya::programs::UProbeError::SymbolError pub aya::programs::UProbeError::SymbolError::error: alloc::boxed::Box<(dyn core::error::Error + core::marker::Send + core::marker::Sync)> @@ -10149,7 +10149,7 @@ pub fn aya::programs::trace_point::TracePoint::from(t: T) -> T pub struct aya::programs::UProbe impl aya::programs::uprobe::UProbe pub const aya::programs::uprobe::UProbe::PROGRAM_TYPE: aya::programs::ProgramType -pub fn aya::programs::uprobe::UProbe::attach<'loc, T: core::convert::AsRef, Loc: core::convert::Into>>(&mut self, location: Loc, target: T, pid: core::option::Option, cookie: core::option::Option) -> core::result::Result +pub fn aya::programs::uprobe::UProbe::attach<'loc, T: core::convert::AsRef, Loc: core::convert::Into>>(&mut self, location: Loc, target: T, pid: core::option::Option, cookie: core::option::Option) -> core::result::Result pub fn aya::programs::uprobe::UProbe::from_pin>(path: P, kind: aya::programs::ProbeKind) -> core::result::Result pub fn aya::programs::uprobe::UProbe::kind(&self) -> aya::programs::ProbeKind pub fn aya::programs::uprobe::UProbe::load(&mut self) -> core::result::Result<(), aya::programs::ProgramError> From a4a3c1641f8b6006363be6c66516daf73a94aec7 Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Mon, 10 Nov 2025 17:42:46 -0500 Subject: [PATCH 37/46] probe: use exhaustive matches --- aya/src/programs/probe.rs | 42 ++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/aya/src/programs/probe.rs b/aya/src/programs/probe.rs index e921fbdb..62ffedc8 100644 --- a/aya/src/programs/probe.rs +++ b/aya/src/programs/probe.rs @@ -130,8 +130,6 @@ pub(crate) fn attach>( } pub(crate) fn detach_debug_fs(event: ProbeEvent) -> Result<(), ProgramError> { - use ProbeKind::*; - let tracefs = find_tracefs_path()?; let ProbeEvent { @@ -142,8 +140,12 @@ pub(crate) fn detach_debug_fs(event: ProbeEvent) -> Result<(), ProgramError> { let result = delete_probe_event(tracefs, event); result.map_err(|(filename, io_error)| match kind { - KProbe | KRetProbe => KProbeError::FileError { filename, io_error }.into(), - UProbe | URetProbe => UProbeError::FileError { filename, io_error }.into(), + ProbeKind::KProbe | ProbeKind::KRetProbe => { + KProbeError::FileError { filename, io_error }.into() + } + ProbeKind::UProbe | ProbeKind::URetProbe => { + UProbeError::FileError { filename, io_error }.into() + } }) } @@ -153,25 +155,23 @@ fn create_as_probe( offset: u64, pid: Option, ) -> Result { - use ProbeKind::*; - let perf_ty = match kind { - KProbe | KRetProbe => read_sys_fs_perf_type(kind.pmu()) + ProbeKind::KProbe | ProbeKind::KRetProbe => read_sys_fs_perf_type(kind.pmu()) .map_err(|(filename, io_error)| KProbeError::FileError { filename, io_error })?, - UProbe | URetProbe => read_sys_fs_perf_type(kind.pmu()) + ProbeKind::UProbe | ProbeKind::URetProbe => read_sys_fs_perf_type(kind.pmu()) .map_err(|(filename, io_error)| UProbeError::FileError { filename, io_error })?, }; let ret_bit = match kind { - KRetProbe => Some( + ProbeKind::KRetProbe => Some( read_sys_fs_perf_ret_probe(kind.pmu()) .map_err(|(filename, io_error)| KProbeError::FileError { filename, io_error })?, ), - URetProbe => Some( + ProbeKind::URetProbe => Some( read_sys_fs_perf_ret_probe(kind.pmu()) .map_err(|(filename, io_error)| UProbeError::FileError { filename, io_error })?, ), - _ => None, + ProbeKind::UProbe | ProbeKind::KProbe => None, }; perf_event_open_probe(perf_ty, ret_bit, fn_name, offset, pid) @@ -188,14 +188,12 @@ fn create_as_trace_point( offset: u64, pid: Option, ) -> Result<(crate::MockableFd, OsString), ProgramError> { - use ProbeKind::*; - let tracefs = find_tracefs_path()?; let event_alias = match kind { - KProbe | KRetProbe => create_probe_event(tracefs, kind, name, offset) + ProbeKind::KProbe | ProbeKind::KRetProbe => create_probe_event(tracefs, kind, name, offset) .map_err(|(filename, io_error)| KProbeError::FileError { filename, io_error })?, - UProbe | URetProbe => create_probe_event(tracefs, kind, name, offset) + ProbeKind::UProbe | ProbeKind::URetProbe => create_probe_event(tracefs, kind, name, offset) .map_err(|(filename, io_error)| UProbeError::FileError { filename, io_error })?, }; @@ -217,12 +215,9 @@ fn create_probe_event( ) -> Result { use std::os::unix::ffi::OsStrExt as _; - use ProbeKind::*; - - let events_file_name = tracefs.join(format!("{}_events", kind.pmu())); let probe_type_prefix = match kind { - KProbe | UProbe => 'p', - KRetProbe | URetProbe => 'r', + ProbeKind::KProbe | ProbeKind::UProbe => 'p', + ProbeKind::KRetProbe | ProbeKind::URetProbe => 'r', }; let mut event_alias = OsString::new(); @@ -254,12 +249,13 @@ fn create_probe_event( probe.push(" "); probe.push(fn_name); match kind { - KProbe => write!(&mut probe, "+{offset}").unwrap(), - UProbe | URetProbe => write!(&mut probe, ":{offset:#x}").unwrap(), - _ => {} + ProbeKind::KProbe => write!(&mut probe, "+{offset}").unwrap(), + ProbeKind::UProbe | ProbeKind::URetProbe => write!(&mut probe, ":{offset:#x}").unwrap(), + ProbeKind::KRetProbe => {} }; probe.push("\n"); + let events_file_name = tracefs.join(format!("{}_events", kind.pmu())); OpenOptions::new() .append(true) .open(&events_file_name) From 72810f095f1461d5d254d37e7174bb47bd15f691 Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Tue, 11 Nov 2025 10:28:54 -0500 Subject: [PATCH 38/46] aya: ProbeKind is Entry/Return We already have separate types for KProbe and UProbe. --- aya/src/bpf.rs | 8 +- aya/src/programs/kprobe.rs | 31 +++++- aya/src/programs/perf_attach.rs | 7 +- aya/src/programs/probe.rs | 139 +++++++++++------------- aya/src/programs/uprobe.rs | 24 +++- test/integration-test/src/tests/info.rs | 2 +- test/integration-test/src/tests/load.rs | 4 +- xtask/public-api/aya.txt | 6 +- 8 files changed, 119 insertions(+), 102 deletions(-) diff --git a/aya/src/bpf.rs b/aya/src/bpf.rs index 90ad428a..3e1d4404 100644 --- a/aya/src/bpf.rs +++ b/aya/src/bpf.rs @@ -598,11 +598,11 @@ impl<'a> EbpfLoader<'a> { match §ion { ProgramSection::KProbe => Program::KProbe(KProbe { data: ProgramData::new(prog_name, obj, btf_fd, *verifier_log_level), - kind: ProbeKind::KProbe, + kind: ProbeKind::Entry, }), ProgramSection::KRetProbe => Program::KProbe(KProbe { data: ProgramData::new(prog_name, obj, btf_fd, *verifier_log_level), - kind: ProbeKind::KRetProbe, + kind: ProbeKind::Return, }), ProgramSection::UProbe { sleepable } => { let mut data = @@ -612,7 +612,7 @@ impl<'a> EbpfLoader<'a> { } Program::UProbe(UProbe { data, - kind: ProbeKind::UProbe, + kind: ProbeKind::Entry, }) } ProgramSection::URetProbe { sleepable } => { @@ -623,7 +623,7 @@ impl<'a> EbpfLoader<'a> { } Program::UProbe(UProbe { data, - kind: ProbeKind::URetProbe, + kind: ProbeKind::Return, }) } ProgramSection::TracePoint => Program::TracePoint(TracePoint { diff --git a/aya/src/programs/kprobe.rs b/aya/src/programs/kprobe.rs index 46158ce6..3e30be27 100644 --- a/aya/src/programs/kprobe.rs +++ b/aya/src/programs/kprobe.rs @@ -1,6 +1,7 @@ //! Kernel space probes. use std::{ ffi::OsStr, + fmt::{self, Write}, io, os::fd::AsFd as _, path::{Path, PathBuf}, @@ -15,7 +16,7 @@ use crate::{ FdLink, LinkError, ProgramData, ProgramError, ProgramType, define_link_wrapper, impl_try_into_fdlink, load_program, perf_attach::{PerfLinkIdInner, PerfLinkInner}, - probe::{ProbeKind, attach}, + probe::{Probe, ProbeKind, attach}, }, sys::bpf_link_get_info_by_fd, }; @@ -59,8 +60,8 @@ impl KProbe { load_program(BPF_PROG_TYPE_KPROBE, &mut self.data) } - /// Returns `KProbe` if the program is a `kprobe`, or `KRetProbe` if the - /// program is a `kretprobe`. + /// Returns [`ProbeKind::Entry`] if the program is a `kprobe`, or + /// [`ProbeKind::Return`] if the program is a `kretprobe`. pub fn kind(&self) -> ProbeKind { self.kind } @@ -81,9 +82,10 @@ impl KProbe { fn_name: T, offset: u64, ) -> Result { - attach( - &mut self.data, - self.kind, + let Self { data, kind } = self; + attach::( + data, + *kind, fn_name.as_ref(), offset, None, // pid @@ -103,6 +105,23 @@ impl KProbe { } } +impl Probe for KProbe { + const PMU: &'static str = "kprobe"; + + type Error = KProbeError; + + fn file_error(filename: PathBuf, io_error: io::Error) -> Self::Error { + KProbeError::FileError { filename, io_error } + } + + fn write_offset(w: &mut W, kind: ProbeKind, offset: u64) -> fmt::Result { + match kind { + ProbeKind::Entry => write!(w, "+{offset}"), + ProbeKind::Return => Ok(()), + } + } +} + define_link_wrapper!( KProbeLink, KProbeLinkId, diff --git a/aya/src/programs/perf_attach.rs b/aya/src/programs/perf_attach.rs index 5118321f..7391031c 100644 --- a/aya/src/programs/perf_attach.rs +++ b/aya/src/programs/perf_attach.rs @@ -8,10 +8,7 @@ use aya_obj::generated::bpf_attach_type::BPF_PERF_EVENT; use crate::{ FEATURES, - programs::{ - FdLink, Link, ProgramError, id_as_key, - probe::{ProbeEvent, detach_debug_fs}, - }, + programs::{FdLink, Link, ProgramError, id_as_key, probe::ProbeEvent}, sys::{ BpfLinkCreateArgs, LinkTarget, PerfEventIoctlRequest, SyscallError, bpf_link_create, is_bpf_cookie_supported, perf_event_ioctl, @@ -72,7 +69,7 @@ impl Link for PerfLink { let Self { perf_fd, event } = self; let _: io::Result<()> = perf_event_ioctl(perf_fd.as_fd(), PerfEventIoctlRequest::Disable); if let Some(event) = event { - let _: Result<_, _> = detach_debug_fs(event); + let _: Result<(), ProgramError> = event.detach(); } Ok(()) diff --git a/aya/src/programs/probe.rs b/aya/src/programs/probe.rs index 62ffedc8..3925be9f 100644 --- a/aya/src/programs/probe.rs +++ b/aya/src/programs/probe.rs @@ -1,6 +1,6 @@ use std::{ ffi::{OsStr, OsString}, - fmt::Write as _, + fmt::{self, Write}, fs::{self, OpenOptions}, io::{self, Write as _}, os::fd::AsFd as _, @@ -11,9 +11,8 @@ use std::{ use crate::{ programs::{ - Link, ProgramData, ProgramError, kprobe::KProbeError, perf_attach, - perf_attach::PerfLinkInner, perf_attach_debugfs, trace_point::read_sys_fs_trace_point_id, - uprobe::UProbeError, utils::find_tracefs_path, + Link, ProgramData, ProgramError, perf_attach, perf_attach::PerfLinkInner, + perf_attach_debugfs, trace_point::read_sys_fs_trace_point_id, utils::find_tracefs_path, }, sys::{SyscallError, perf_event_open_probe, perf_event_open_trace_point}, util::KernelVersion, @@ -24,23 +23,20 @@ static PROBE_NAME_INDEX: AtomicUsize = AtomicUsize::new(0); /// Kind of probe program #[derive(Debug, Copy, Clone)] pub enum ProbeKind { - /// Kernel probe - KProbe, - /// Kernel return probe - KRetProbe, - /// User space probe - UProbe, - /// User space return probe - URetProbe, + /// Probe the entry of the function + Entry, + /// Probe the return of the function + Return, } -impl ProbeKind { - fn pmu(&self) -> &'static str { - match *self { - Self::KProbe | Self::KRetProbe => "kprobe", - Self::UProbe | Self::URetProbe => "uprobe", - } - } +pub(crate) trait Probe { + const PMU: &'static str; + + type Error: Into; + + fn file_error(filename: PathBuf, io_error: io::Error) -> Self::Error; + + fn write_offset(w: &mut W, kind: ProbeKind, offset: u64) -> fmt::Result; } pub(crate) fn lines(bytes: &[u8]) -> impl Iterator { @@ -94,11 +90,21 @@ impl OsStringExt for OsStr { #[derive(Debug)] pub(crate) struct ProbeEvent { - kind: ProbeKind, event_alias: OsString, + detach_debug_fs: fn(&OsStr) -> Result<(), ProgramError>, +} + +impl ProbeEvent { + pub(crate) fn detach(self) -> Result<(), ProgramError> { + let Self { + event_alias, + detach_debug_fs, + } = self; + detach_debug_fs(&event_alias) + } } -pub(crate) fn attach>( +pub(crate) fn attach>( program_data: &mut ProgramData, kind: ProbeKind, // NB: the meaning of this argument is different for kprobe/kretprobe and uprobe/uretprobe; in @@ -120,58 +126,44 @@ pub(crate) fn attach>( if cookie.is_some() { return Err(ProgramError::AttachCookieNotSupported); } - let (perf_fd, event_alias) = create_as_trace_point(kind, fn_name, offset, pid)?; - perf_attach_debugfs(prog_fd, perf_fd, ProbeEvent { kind, event_alias }) + let (perf_fd, event_alias) = create_as_trace_point::

(kind, fn_name, offset, pid)?; + perf_attach_debugfs( + prog_fd, + perf_fd, + ProbeEvent { + event_alias, + detach_debug_fs: detach_debug_fs::

, + }, + ) } else { - let perf_fd = create_as_probe(kind, fn_name, offset, pid)?; + let perf_fd = create_as_probe::

(kind, fn_name, offset, pid)?; perf_attach(prog_fd, perf_fd, cookie) }?; program_data.links.insert(T::from(link)) } -pub(crate) fn detach_debug_fs(event: ProbeEvent) -> Result<(), ProgramError> { +fn detach_debug_fs(event_alias: &OsStr) -> Result<(), ProgramError> { let tracefs = find_tracefs_path()?; - let ProbeEvent { - kind, - event_alias: _, - } = &event; - let kind = *kind; - let result = delete_probe_event(tracefs, event); - - result.map_err(|(filename, io_error)| match kind { - ProbeKind::KProbe | ProbeKind::KRetProbe => { - KProbeError::FileError { filename, io_error }.into() - } - ProbeKind::UProbe | ProbeKind::URetProbe => { - UProbeError::FileError { filename, io_error }.into() - } - }) + delete_probe_event(tracefs, P::PMU, event_alias) + .map_err(|(filename, io_error)| P::file_error(filename, io_error).into()) } -fn create_as_probe( +fn create_as_probe( kind: ProbeKind, fn_name: &OsStr, offset: u64, pid: Option, ) -> Result { - let perf_ty = match kind { - ProbeKind::KProbe | ProbeKind::KRetProbe => read_sys_fs_perf_type(kind.pmu()) - .map_err(|(filename, io_error)| KProbeError::FileError { filename, io_error })?, - ProbeKind::UProbe | ProbeKind::URetProbe => read_sys_fs_perf_type(kind.pmu()) - .map_err(|(filename, io_error)| UProbeError::FileError { filename, io_error })?, - }; + let perf_ty = read_sys_fs_perf_type(P::PMU) + .map_err(|(filename, io_error)| P::file_error(filename, io_error).into())?; let ret_bit = match kind { - ProbeKind::KRetProbe => Some( - read_sys_fs_perf_ret_probe(kind.pmu()) - .map_err(|(filename, io_error)| KProbeError::FileError { filename, io_error })?, + ProbeKind::Return => Some( + read_sys_fs_perf_ret_probe(P::PMU) + .map_err(|(filename, io_error)| P::file_error(filename, io_error).into())?, ), - ProbeKind::URetProbe => Some( - read_sys_fs_perf_ret_probe(kind.pmu()) - .map_err(|(filename, io_error)| UProbeError::FileError { filename, io_error })?, - ), - ProbeKind::UProbe | ProbeKind::KProbe => None, + ProbeKind::Entry => None, }; perf_event_open_probe(perf_ty, ret_bit, fn_name, offset, pid) @@ -182,7 +174,7 @@ fn create_as_probe( .map_err(Into::into) } -fn create_as_trace_point( +fn create_as_trace_point( kind: ProbeKind, name: &OsStr, offset: u64, @@ -190,14 +182,10 @@ fn create_as_trace_point( ) -> Result<(crate::MockableFd, OsString), ProgramError> { let tracefs = find_tracefs_path()?; - let event_alias = match kind { - ProbeKind::KProbe | ProbeKind::KRetProbe => create_probe_event(tracefs, kind, name, offset) - .map_err(|(filename, io_error)| KProbeError::FileError { filename, io_error })?, - ProbeKind::UProbe | ProbeKind::URetProbe => create_probe_event(tracefs, kind, name, offset) - .map_err(|(filename, io_error)| UProbeError::FileError { filename, io_error })?, - }; + let event_alias = create_probe_event::

(tracefs, kind, name, offset) + .map_err(|(filename, io_error)| P::file_error(filename, io_error).into())?; - let category = format!("{}s", kind.pmu()); + let category = format!("{}s", P::PMU); let tpid = read_sys_fs_trace_point_id(tracefs, &category, event_alias.as_ref())?; let perf_fd = perf_event_open_trace_point(tpid, pid).map_err(|io_error| SyscallError { call: "perf_event_open", @@ -207,7 +195,7 @@ fn create_as_trace_point( Ok((perf_fd, event_alias)) } -fn create_probe_event( +fn create_probe_event( tracefs: &Path, kind: ProbeKind, fn_name: &OsStr, @@ -216,8 +204,8 @@ fn create_probe_event( use std::os::unix::ffi::OsStrExt as _; let probe_type_prefix = match kind { - ProbeKind::KProbe | ProbeKind::UProbe => 'p', - ProbeKind::KRetProbe | ProbeKind::URetProbe => 'r', + ProbeKind::Entry => 'p', + ProbeKind::Return => 'r', }; let mut event_alias = OsString::new(); @@ -244,18 +232,14 @@ fn create_probe_event( .unwrap(); let mut probe = OsString::new(); - write!(&mut probe, "{}:{}s/", probe_type_prefix, kind.pmu()).unwrap(); + write!(&mut probe, "{}:{}s/", probe_type_prefix, P::PMU).unwrap(); probe.push(&event_alias); probe.push(" "); probe.push(fn_name); - match kind { - ProbeKind::KProbe => write!(&mut probe, "+{offset}").unwrap(), - ProbeKind::UProbe | ProbeKind::URetProbe => write!(&mut probe, ":{offset:#x}").unwrap(), - ProbeKind::KRetProbe => {} - }; + P::write_offset(&mut probe, kind, offset).unwrap(); probe.push("\n"); - let events_file_name = tracefs.join(format!("{}_events", kind.pmu())); + let events_file_name = tracefs.join(format!("{}_events", P::PMU)); OpenOptions::new() .append(true) .open(&events_file_name) @@ -265,11 +249,14 @@ fn create_probe_event( Ok(event_alias) } -fn delete_probe_event(tracefs: &Path, event: ProbeEvent) -> Result<(), (PathBuf, io::Error)> { +fn delete_probe_event( + tracefs: &Path, + pmu: &str, + event_alias: &OsStr, +) -> Result<(), (PathBuf, io::Error)> { use std::os::unix::ffi::OsStrExt as _; - let ProbeEvent { kind, event_alias } = event; - let events_file_name = tracefs.join(format!("{}_events", kind.pmu())); + let events_file_name = tracefs.join(format!("{}_events", pmu)); fs::read(&events_file_name) .and_then(|events| { diff --git a/aya/src/programs/uprobe.rs b/aya/src/programs/uprobe.rs index 16899c35..0e15fc39 100644 --- a/aya/src/programs/uprobe.rs +++ b/aya/src/programs/uprobe.rs @@ -2,6 +2,7 @@ use std::{ error::Error, ffi::{CStr, OsStr, OsString}, + fmt::{self, Write}, fs, io::{self, BufRead as _, Cursor, Read as _}, mem, @@ -20,7 +21,7 @@ use crate::{ FdLink, LinkError, ProgramData, ProgramError, ProgramType, define_link_wrapper, impl_try_into_fdlink, load_program, perf_attach::{PerfLinkIdInner, PerfLinkInner}, - probe::{OsStringExt as _, ProbeKind, attach}, + probe::{OsStringExt as _, Probe, ProbeKind, attach}, }, sys::bpf_link_get_info_by_fd, util::MMap, @@ -80,8 +81,8 @@ impl UProbe { load_program(BPF_PROG_TYPE_KPROBE, &mut self.data) } - /// Returns `UProbe` if the program is a `uprobe`, or `URetProbe` if the - /// program is a `uretprobe`. + /// Returns [`ProbeKind::Entry`] if the program is a `uprobe`, or + /// [`ProbeKind::Return`] if the program is a `uretprobe`. pub fn kind(&self) -> ProbeKind { self.kind } @@ -129,8 +130,9 @@ impl UProbe { offset }; + let Self { data, kind } = self; let path = path.as_os_str(); - attach(&mut self.data, self.kind, path, offset, pid, cookie) + attach::(data, *kind, path, offset, pid, cookie) } /// Creates a program from a pinned entry on a bpffs. @@ -145,6 +147,20 @@ impl UProbe { } } +impl Probe for UProbe { + const PMU: &'static str = "uprobe"; + + type Error = UProbeError; + + fn file_error(filename: PathBuf, io_error: io::Error) -> Self::Error { + UProbeError::FileError { filename, io_error } + } + + fn write_offset(w: &mut W, _: ProbeKind, offset: u64) -> fmt::Result { + write!(w, ":{offset:#x}") + } +} + fn resolve_attach_path<'a, 'b, 'c, T>( target: &'a Path, proc_map: Option<&'b ProcMap>, diff --git a/test/integration-test/src/tests/info.rs b/test/integration-test/src/tests/info.rs index 9a4740c3..20c92c75 100644 --- a/test/integration-test/src/tests/info.rs +++ b/test/integration-test/src/tests/info.rs @@ -60,7 +60,7 @@ fn test_loaded_programs() { .unwrap(); let mut p: UProbe = unsafe { - UProbe::from_program_info(info, "test_uprobe".into(), aya::programs::ProbeKind::UProbe) + UProbe::from_program_info(info, "test_uprobe".into(), aya::programs::ProbeKind::Entry) .unwrap() }; diff --git a/test/integration-test/src/tests/load.rs b/test/integration-test/src/tests/load.rs index dd50fe2d..26046824 100644 --- a/test/integration-test/src/tests/load.rs +++ b/test/integration-test/src/tests/load.rs @@ -557,7 +557,7 @@ fn pin_lifecycle_kprobe() { let attach = |prog: &mut P| prog.attach("try_to_wake_up", 0).unwrap(); let program_pin = "/sys/fs/bpf/aya-kprobe-test-prog"; let link_pin = "/sys/fs/bpf/aya-kprobe-test-try-to-wake-up"; - let from_pin = |program_pin: &str| P::from_pin(program_pin, ProbeKind::KProbe).unwrap(); + let from_pin = |program_pin: &str| P::from_pin(program_pin, ProbeKind::Entry).unwrap(); run_pin_program_lifecycle_test( crate::TEST, program_name, @@ -587,7 +587,7 @@ fn pin_lifecycle_uprobe() { }; let program_pin = "/sys/fs/bpf/aya-uprobe-test-prog"; let link_pin = "/sys/fs/bpf/aya-uprobe-test-uprobe-function"; - let from_pin = |program_pin: &str| P::from_pin(program_pin, ProbeKind::UProbe).unwrap(); + let from_pin = |program_pin: &str| P::from_pin(program_pin, ProbeKind::Entry).unwrap(); run_pin_program_lifecycle_test( crate::TEST, program_name, diff --git a/xtask/public-api/aya.txt b/xtask/public-api/aya.txt index fce3d730..3b6618be 100644 --- a/xtask/public-api/aya.txt +++ b/xtask/public-api/aya.txt @@ -8014,10 +8014,8 @@ pub unsafe fn aya::programs::LsmAttachType::clone_to_uninit(&self, dest: *mut u8 impl core::convert::From for aya::programs::LsmAttachType pub fn aya::programs::LsmAttachType::from(t: T) -> T pub enum aya::programs::ProbeKind -pub aya::programs::ProbeKind::KProbe -pub aya::programs::ProbeKind::KRetProbe -pub aya::programs::ProbeKind::UProbe -pub aya::programs::ProbeKind::URetProbe +pub aya::programs::ProbeKind::Entry +pub aya::programs::ProbeKind::Return impl core::clone::Clone for aya::programs::ProbeKind pub fn aya::programs::ProbeKind::clone(&self) -> aya::programs::ProbeKind impl core::fmt::Debug for aya::programs::ProbeKind From 46221ad11dfb44fc0cc46425e1648c6750d98a5e Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Wed, 12 Nov 2025 11:27:27 -0500 Subject: [PATCH 39/46] probe: use RAII to clean up in the error path --- aya/src/programs/perf_attach.rs | 6 +++- aya/src/programs/probe.rs | 64 ++++++++++++++++++++++++--------- 2 files changed, 52 insertions(+), 18 deletions(-) diff --git a/aya/src/programs/perf_attach.rs b/aya/src/programs/perf_attach.rs index 7391031c..d6ed6676 100644 --- a/aya/src/programs/perf_attach.rs +++ b/aya/src/programs/perf_attach.rs @@ -115,7 +115,7 @@ pub(crate) fn perf_attach_debugfs( fn perf_attach_either( prog_fd: BorrowedFd<'_>, perf_fd: crate::MockableFd, - event: Option, + mut event: Option, ) -> Result { perf_event_ioctl(perf_fd.as_fd(), PerfEventIoctlRequest::SetBpf(prog_fd)).map_err( |io_error| SyscallError { @@ -130,5 +130,9 @@ fn perf_attach_either( } })?; + if let Some(event) = event.as_mut() { + event.disarm(); + } + Ok(PerfLinkInner::PerfLink(PerfLink { perf_fd, event })) } diff --git a/aya/src/programs/probe.rs b/aya/src/programs/probe.rs index 3925be9f..0eecfc2c 100644 --- a/aya/src/programs/probe.rs +++ b/aya/src/programs/probe.rs @@ -88,19 +88,49 @@ impl OsStringExt for OsStr { } } +type DetachDebugFs = fn(&OsStr) -> Result<(), ProgramError>; + #[derive(Debug)] pub(crate) struct ProbeEvent { event_alias: OsString, - detach_debug_fs: fn(&OsStr) -> Result<(), ProgramError>, + detach_debug_fs: Option<(DetachDebugFs, bool)>, } impl ProbeEvent { - pub(crate) fn detach(self) -> Result<(), ProgramError> { + pub(crate) fn disarm(&mut self) { + let Self { + event_alias: _, + detach_debug_fs, + } = self; + if let Some((_detach_debug_fs, is_guard)) = detach_debug_fs { + *is_guard = false; + } + } + + pub(crate) fn detach(mut self) -> Result<(), ProgramError> { + let Self { + event_alias, + detach_debug_fs, + } = &mut self; + detach_debug_fs + .take() + .map(|(detach_debug_fs, _is_guard)| detach_debug_fs(event_alias)) + .transpose()?; + Ok(()) + } +} + +impl Drop for ProbeEvent { + fn drop(&mut self) { let Self { event_alias, detach_debug_fs, } = self; - detach_debug_fs(&event_alias) + if let Some((detach_debug_fs, is_guard)) = detach_debug_fs { + if *is_guard { + let _: Result<(), ProgramError> = detach_debug_fs(event_alias); + } + } } } @@ -126,15 +156,8 @@ pub(crate) fn attach>( if cookie.is_some() { return Err(ProgramError::AttachCookieNotSupported); } - let (perf_fd, event_alias) = create_as_trace_point::

(kind, fn_name, offset, pid)?; - perf_attach_debugfs( - prog_fd, - perf_fd, - ProbeEvent { - event_alias, - detach_debug_fs: detach_debug_fs::

, - }, - ) + let (perf_fd, event) = create_as_trace_point::

(kind, fn_name, offset, pid)?; + perf_attach_debugfs(prog_fd, perf_fd, event) } else { let perf_fd = create_as_probe::

(kind, fn_name, offset, pid)?; perf_attach(prog_fd, perf_fd, cookie) @@ -179,12 +202,16 @@ fn create_as_trace_point( name: &OsStr, offset: u64, pid: Option, -) -> Result<(crate::MockableFd, OsString), ProgramError> { +) -> Result<(crate::MockableFd, ProbeEvent), ProgramError> { let tracefs = find_tracefs_path()?; - let event_alias = create_probe_event::

(tracefs, kind, name, offset) + let event = create_probe_event::

(tracefs, kind, name, offset) .map_err(|(filename, io_error)| P::file_error(filename, io_error).into())?; + let ProbeEvent { + event_alias, + detach_debug_fs: _, + } = &event; let category = format!("{}s", P::PMU); let tpid = read_sys_fs_trace_point_id(tracefs, &category, event_alias.as_ref())?; let perf_fd = perf_event_open_trace_point(tpid, pid).map_err(|io_error| SyscallError { @@ -192,7 +219,7 @@ fn create_as_trace_point( io_error, })?; - Ok((perf_fd, event_alias)) + Ok((perf_fd, event)) } fn create_probe_event( @@ -200,7 +227,7 @@ fn create_probe_event( kind: ProbeKind, fn_name: &OsStr, offset: u64, -) -> Result { +) -> Result { use std::os::unix::ffi::OsStrExt as _; let probe_type_prefix = match kind { @@ -246,7 +273,10 @@ fn create_probe_event( .and_then(|mut events_file| events_file.write_all(probe.as_bytes())) .map_err(|e| (events_file_name, e))?; - Ok(event_alias) + Ok(ProbeEvent { + event_alias, + detach_debug_fs: Some((detach_debug_fs::

, true)), + }) } fn delete_probe_event( From 7a8ad146f48c8a044bd9d47cabdd08e1c5542b6b Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Thu, 13 Nov 2025 08:34:23 -0500 Subject: [PATCH 40/46] Add macos-latest There's no way to get hardware acceleration on arm64 at all, so let's at least make sure our stuff keeps working on macOS. --- .github/workflows/ci.yml | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2cb36c5e..6673c4a9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -218,10 +218,10 @@ jobs: matrix: # We don't have a fast solution for running virtualized integration # tests on arm64 because: - # - Github broke nested virtualization on macos-15-intel (see below). - # - Github arm64 runners don't support nested virtualization (see + # - GitHub Ubuntu arm64 runners don't support nested virtualization (see # https://github.com/orgs/community/discussions/148648#discussioncomment-11863547). - # - Unlike HVF, KVM doesn't emulate CPUs. + # - GitHub macOS arm64 runners don't support nested virtualization (see + # https://docs.github.com/en/actions/reference/runners/github-hosted-runners#limitations-for-arm64-macos-runners). # # So we spin a runner for every arm64 kernel to avoid waiting 20 minutes # for CI. We use arm64 runners to avoid cross-compilation. @@ -234,15 +234,11 @@ jobs: skip-local: - true include: - # TODO(https://github.com/actions/runner-images/issues/13277): Reenable when fixed. - # macos-15 is arm64[0] which doesn't support nested - # virtualization[1]. - # - # [0] https://github.com/actions/runner-images#available-images - # - # [1] https://docs.github.com/en/actions/reference/runners/github-hosted-runners#limitations-for-arm64-macos-runners - # - # - os: macos-15-intel + - os: macos-latest + # Just one kernel to keep things fast. We just want to keep things from rotting on + # macOS. We use amd64 because otherwise qemu tries to use HVF and hits a hard error: + # qemu-system-aarch64: -accel hvf: Error: ret = HV_UNSUPPORTED (0xfae9400f, at ../target/arm/hvf/hvf.c:956) + download-kernel-images: amd64 5.10 # We don't use ubuntu-latest because we care about the apt packages available. - os: ubuntu-24.04 From 75cd7e835f9b3d182cd520d5983aef0dc2320021 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 Nov 2025 13:09:22 +0000 Subject: [PATCH 41/46] build(deps): bump DavidAnson/markdownlint-cli2-action Bumps the github-actions group with 1 update: [DavidAnson/markdownlint-cli2-action](https://github.com/davidanson/markdownlint-cli2-action). Updates `DavidAnson/markdownlint-cli2-action` from 20 to 21 - [Release notes](https://github.com/davidanson/markdownlint-cli2-action/releases) - [Commits](https://github.com/davidanson/markdownlint-cli2-action/compare/v20...v21) --- updated-dependencies: - dependency-name: DavidAnson/markdownlint-cli2-action dependency-version: '21' dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions ... Signed-off-by: dependabot[bot] --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6673c4a9..15927855 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,7 +35,7 @@ jobs: - run: git ls-files -- '*.c' '*.h' | xargs clang-format --dry-run --Werror - - uses: DavidAnson/markdownlint-cli2-action@v20 + - uses: DavidAnson/markdownlint-cli2-action@v21 - run: taplo fmt --check From acb1ddd2ecdc0c80d5255c452b02427fd94af377 Mon Sep 17 00:00:00 2001 From: Dave Tucker Date: Wed, 9 Oct 2024 13:41:39 +0100 Subject: [PATCH 42/46] docs: Add release documentation This describes the current process for performing releases from the aya workspace. Signed-off-by: Dave Tucker --- RELEASE.md | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 RELEASE.md diff --git a/RELEASE.md b/RELEASE.md new file mode 100644 index 00000000..5e3b176c --- /dev/null +++ b/RELEASE.md @@ -0,0 +1,72 @@ +# Releasing the aya project + +This document describes the process of releasing the aya project. + +## Release process + +### 0. Who can release? + +Only members of [aya-rs/owners][owners-team] have the permissions to: + +- Push packages to crates.io +- Make the necessary changes in GitHub to create a release + +### 1. Create a release branch and run cargo smart-release + +This project uses [cargo-smart-release] to automate the release process. Start +from the default branch, create a fresh release branch, and run the command +below on that branch. As soon as the command succeeds it will publish each crate +and push the branch plus tags to the remote automatically, so double-check that +everything is ready before invoking +it. + +> [!IMPORTANT] +> The `--execute` flag is used to actually perform the release. +> Remove it to do a dry-run first. + +```sh +git checkout -b my-release-branch +cargo smart-release \ + aya \ + aya-ebpf \ + aya-log-ebpf \ + aya-log \ + --execute \ + --signoff +``` + +### 2. Open a pull request + +Because the release branch gets pushed automatically on success, open a PR +against the default branch and merge it once everything looks good. This keeps +git history auditable even though crates.io already has the freshly published +artifacts. + +> [!IMPORTANT] +> Use a fast-forward merge to ensure the tags are reachable from the default +> branch. + +## Release Debugging + +Sometimes the release process can fail. + +Here are some common issues and how to fix them: + +### `cargo smart-release` doesn't compute the correct version + +You can manually specify the version to release by passing the `--bump` flag +and specifying either `major`, `minor`, or `patch`. This *should* be computed +from the commits in the changelog, but sometimes it doesn't work as expected. + +### WOULD stop release after commit as the changelog entry is empty for crate + +If you see the message ☝ in the output of `cargo smart-release`, it means that +the generated changelog entry for the crate is empty. This can happen if, for +example, the only change is a dependency update. In this case, you can manually +edit the changelog entry in the crate's `CHANGELOG.md` file to include a note +about the dependency update under the `## Unreleased` section. +[c3f0c7dc] is an example of such a commit. + +[cargo-smart-release]: https://github.com/Byron/cargo-smart-release +[owners-team]: https://github.com/orgs/aya-rs/teams/owners +[c3f0c7dc]: https://github.com/aya-rs/aya/commit/c3f0c7dc3fb285da091454426eeda0723389f0f1 From d238b2ea6f1b2c1aa09a9050415b1c96329af0aa Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Mon, 17 Nov 2025 11:03:08 -0500 Subject: [PATCH 43/46] Release crates - aya v0.13.2 - aya-build v0.1.3 - aya-ebpf v0.1.2 - aya-ebpf-bindings v0.1.2 - aya-ebpf-cty v0.2.3 - aya-ebpf-macros v0.1.2 - aya-log v0.2.2 - aya-log-common v0.1.16 - aya-log-ebpf v0.1.2 - aya-log-ebpf-macros v0.1.1 - aya-log-parser v0.1.14 - aya-obj v0.2.2 Signed-off-by: Tamir Duberstein --- RELEASE.md | 4 +- aya-build/Cargo.toml | 2 +- aya-ebpf-macros/CHANGELOG.md | 13 +++++++ aya-ebpf-macros/Cargo.toml | 2 +- aya-log-common/CHANGELOG.md | 17 ++++++++ aya-log-common/Cargo.toml | 2 +- aya-log-ebpf-macros/CHANGELOG.md | 19 +++++++++ aya-log-ebpf-macros/Cargo.toml | 6 +-- aya-log-parser/CHANGELOG.md | 13 +++++++ aya-log-parser/Cargo.toml | 4 +- aya-log/CHANGELOG.md | 17 ++++---- aya-log/Cargo.toml | 6 +-- aya-obj/CHANGELOG.md | 19 +++++++++ aya-obj/Cargo.toml | 2 +- aya/CHANGELOG.md | 36 +++++++++++------ aya/Cargo.toml | 4 +- ebpf/aya-ebpf-bindings/CHANGELOG.md | 12 ++++++ ebpf/aya-ebpf-bindings/Cargo.toml | 6 +-- ebpf/aya-ebpf-cty/CHANGELOG.md | 60 +++-------------------------- ebpf/aya-ebpf-cty/Cargo.toml | 4 +- ebpf/aya-ebpf/CHANGELOG.md | 29 ++++++++++++++ ebpf/aya-ebpf/Cargo.toml | 10 ++--- ebpf/aya-log-ebpf/CHANGELOG.md | 18 +++++++++ ebpf/aya-log-ebpf/Cargo.toml | 8 ++-- test/integration-test/Cargo.toml | 6 +-- 25 files changed, 212 insertions(+), 107 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index 5e3b176c..0e0438e0 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -28,10 +28,12 @@ it. git checkout -b my-release-branch cargo smart-release \ aya \ + aya-build \ aya-ebpf \ - aya-log-ebpf \ aya-log \ + aya-log-ebpf \ --execute \ + --no-changelog-github-release \ --signoff ``` diff --git a/aya-build/Cargo.toml b/aya-build/Cargo.toml index 5acc53c8..247c2d2e 100644 --- a/aya-build/Cargo.toml +++ b/aya-build/Cargo.toml @@ -1,7 +1,7 @@ [package] description = "Build-time support for aya projects" name = "aya-build" -version = "0.1.2" +version = "0.1.3" authors.workspace = true edition.workspace = true diff --git a/aya-ebpf-macros/CHANGELOG.md b/aya-ebpf-macros/CHANGELOG.md index 4e1df55f..92071845 100644 --- a/aya-ebpf-macros/CHANGELOG.md +++ b/aya-ebpf-macros/CHANGELOG.md @@ -5,6 +5,19 @@ 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). +## [Unreleased] + +## v0.1.2 (2025-11-17) + +### New Features + + - Added Flow Dissector macro support so attaching those programs no longer requires manual boilerplate. + - Switched error reporting to `proc-macro2-diagnostics`, providing richer compiler output when macro expansion fails. + +### Maintenance + + - Dropped the stale dev-dependency on `aya-ebpf` and kept the crate in sync with the workspace lint/edition configuration. + ## v0.1.1 (2024-10-09) ### Chore diff --git a/aya-ebpf-macros/Cargo.toml b/aya-ebpf-macros/Cargo.toml index 55a76f2c..f5753c66 100644 --- a/aya-ebpf-macros/Cargo.toml +++ b/aya-ebpf-macros/Cargo.toml @@ -1,7 +1,7 @@ [package] description = "Proc macros used by aya-ebpf" name = "aya-ebpf-macros" -version = "0.1.1" +version = "0.1.2" authors.workspace = true edition.workspace = true diff --git a/aya-log-common/CHANGELOG.md b/aya-log-common/CHANGELOG.md index e2e10823..4931914a 100644 --- a/aya-log-common/CHANGELOG.md +++ b/aya-log-common/CHANGELOG.md @@ -5,6 +5,23 @@ 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). +## [Unreleased] + +## v0.1.16 (2025-11-17) + +### Breaking Changes + + - Updated the shared types for the new ring-buffer transport used by `aya-log`, aligning the user- and eBPF-side structures. + - Sealed the `Argument` trait so downstream crates can no longer implement log argument types. + +### New Features + + - Added support for logging raw pointer values, mirroring the new host-side formatting capabilities. + +### Maintenance + + - , General lint, edition, and formatting cleanups to keep the crate in line with the workspace standards. + ## 0.1.15 (2024-10-09) diff --git a/aya-log-common/Cargo.toml b/aya-log-common/Cargo.toml index 4ee9d9b2..246ff6e6 100644 --- a/aya-log-common/Cargo.toml +++ b/aya-log-common/Cargo.toml @@ -3,7 +3,7 @@ description = "A logging library for eBPF programs." documentation = "https://docs.rs/aya-log" keywords = ["bpf", "ebpf", "log", "logging"] name = "aya-log-common" -version = "0.1.15" +version = "0.1.16" authors.workspace = true edition.workspace = true diff --git a/aya-log-ebpf-macros/CHANGELOG.md b/aya-log-ebpf-macros/CHANGELOG.md index eb24e948..65e69800 100644 --- a/aya-log-ebpf-macros/CHANGELOG.md +++ b/aya-log-ebpf-macros/CHANGELOG.md @@ -5,6 +5,25 @@ 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). +## [Unreleased] + +## v0.1.1 (2025-11-17) + +### Breaking Changes + + - Macros now emit ring-buffer based logging code to match the host transport, which requires kernel 5.8 or newer. + +### New Features + + - Added a load-time log level mask so unnecessary log calls can be compiled out entirely. + - Macros may now be used in expression position, simplifying complex logging statements. + - The generated code performs zero-copy writes into the ring buffer where possible, reducing instruction count inside probes. + - Added raw-pointer formatting support so eBPF logs can mirror host-side diagnostics. + +### Maintenance + + - , Tidied the macro support module and aligned the crate with the workspace lint/edition settings. + ## v0.1.0 (2024-04-12) diff --git a/aya-log-ebpf-macros/Cargo.toml b/aya-log-ebpf-macros/Cargo.toml index ff6aee04..40b3ec48 100644 --- a/aya-log-ebpf-macros/Cargo.toml +++ b/aya-log-ebpf-macros/Cargo.toml @@ -1,7 +1,7 @@ [package] description = "Proc macros used by aya-log-ebpf" name = "aya-log-ebpf-macros" -version = "0.1.0" +version = "0.1.1" authors.workspace = true edition.workspace = true @@ -14,8 +14,8 @@ rust-version.workspace = true workspace = true [dependencies] -aya-log-common = { path = "../aya-log-common", version = "^0.1.14", default-features = false } -aya-log-parser = { path = "../aya-log-parser", version = "^0.1.13", default-features = false } +aya-log-common = { path = "../aya-log-common", version = "^0.1.16", default-features = false } +aya-log-parser = { path = "../aya-log-parser", version = "^0.1.14", default-features = false } proc-macro2 = { workspace = true } quote = { workspace = true } syn = { workspace = true } diff --git a/aya-log-parser/CHANGELOG.md b/aya-log-parser/CHANGELOG.md index c419a2ab..f7df19fb 100644 --- a/aya-log-parser/CHANGELOG.md +++ b/aya-log-parser/CHANGELOG.md @@ -5,6 +5,19 @@ 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). +## [Unreleased] + +## v0.1.14 (2025-11-17) + +### Improvements + + - Simplified the parser’s parameter handling so formatting errors are surfaced earlier and with clearer context. + - Added raw-pointer format support to stay in sync with the new logging capabilities. + +### Maintenance + + - , Bumped the edition and refreshed lint/formatting settings alongside the rest of the workspace. + ## v0.1.13 (2024-04-12) diff --git a/aya-log-parser/Cargo.toml b/aya-log-parser/Cargo.toml index 502ef3e1..24a7c0a1 100644 --- a/aya-log-parser/Cargo.toml +++ b/aya-log-parser/Cargo.toml @@ -1,7 +1,7 @@ [package] description = "A parser for the aya log format strings" name = "aya-log-parser" -version = "0.1.13" +version = "0.1.14" authors.workspace = true edition.workspace = true @@ -14,7 +14,7 @@ rust-version.workspace = true workspace = true [dependencies] -aya-log-common = { path = "../aya-log-common", version = "^0.1.14", default-features = false } +aya-log-common = { path = "../aya-log-common", version = "^0.1.16", default-features = false } [dev-dependencies] assert_matches = { workspace = true } diff --git a/aya-log/CHANGELOG.md b/aya-log/CHANGELOG.md index 5508046d..19581d2a 100644 --- a/aya-log/CHANGELOG.md +++ b/aya-log/CHANGELOG.md @@ -7,19 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -### New Features - -- Add eBPF-side log level `AYA_LOG_LEVEL` allowing selective disabling of log - levels at load-time. Disabled levels are eliminated by the verifier, reducing - instruction count and avoiding program size limits when extensive logging is - present. +## v0.2.2 (2025-11-17) ### Breaking Changes -- The implementation is now backed by a ring buffer rather than a perf event array. This should - improve performance but increases the minimum supported kernel version to 5.8. + - Host-side logging now rides on a ring buffer instead of a perf array. This improves throughput but requires Linux ≥ 5.8. + - Dropped the built-in `tokio` dependency. Consumers must bring their own async runtime when forwarding log records. + +### New Features -- Drop the built-in `tokio` dependency. Users must now BYOR (bring your own runtime). + - Added the `AYA_LOG_LEVEL` mask so unwanted log levels can be disabled at load time and optimised away by the verifier. + - `EbpfLogger` now implements `AsFd`, simplifying integration with selectors and event loops. + - Added support for logging raw pointer types, which unlocks richer debugging output from probes. ## v0.2.1 (2024-10-09) diff --git a/aya-log/Cargo.toml b/aya-log/Cargo.toml index d1e7234c..c9c438af 100644 --- a/aya-log/Cargo.toml +++ b/aya-log/Cargo.toml @@ -4,7 +4,7 @@ documentation = "https://docs.rs/aya-log" keywords = ["bpf", "ebpf", "log", "logging"] name = "aya-log" readme = "README.md" -version = "0.2.1" +version = "0.2.2" authors.workspace = true edition.workspace = true @@ -17,8 +17,8 @@ rust-version.workspace = true workspace = true [dependencies] -aya = { path = "../aya", version = "^0.13.1", default-features = false } -aya-log-common = { path = "../aya-log-common", version = "^0.1.15", default-features = false } +aya = { path = "../aya", version = "^0.13.2", default-features = false } +aya-log-common = { path = "../aya-log-common", version = "^0.1.16", default-features = false } log = { workspace = true } thiserror = { workspace = true } diff --git a/aya-obj/CHANGELOG.md b/aya-obj/CHANGELOG.md index ceadbb1c..fea33bb5 100644 --- a/aya-obj/CHANGELOG.md +++ b/aya-obj/CHANGELOG.md @@ -5,6 +5,25 @@ 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). +## [Unreleased] + +## v0.2.2 (2025-11-17) + +### New Features + + - Updated the loader to understand Flow Dissector programs so objects containing those sections can now be parsed and attached. + - , Regenerated libbpf bindings, bringing in MIPS and LoongArch64 support. + - , Switched to generated constants and helper APIs (e.g. `CStr::from_bytes_until_nul`) for safer symbol handling. + +### Bug Fixes + + - , Fixed BTF relocations involving zero-sized sections and 64-bit enums so objects built with newer clang/jit toolchains load correctly. + - , Promoted BTF loading failures (and diagnostic output) to proper errors instead of panics/unreachable paths. + +### Maintenance + + - , Cached feature-probed info fields and preserved pointer provenance, plus the usual lint/edition updates to stay aligned with the workspace. + ## 0.2.1 (2024-11-01) ### New Features diff --git a/aya-obj/Cargo.toml b/aya-obj/Cargo.toml index c3056fe5..3a24ed5d 100644 --- a/aya-obj/Cargo.toml +++ b/aya-obj/Cargo.toml @@ -4,7 +4,7 @@ documentation = "https://docs.rs/aya-obj" keywords = ["bpf", "btf", "ebpf", "elf", "object"] name = "aya-obj" readme = "README.md" -version = "0.2.1" +version = "0.2.2" authors.workspace = true edition.workspace = true diff --git a/aya/CHANGELOG.md b/aya/CHANGELOG.md index efd3d42e..6ed20f67 100644 --- a/aya/CHANGELOG.md +++ b/aya/CHANGELOG.md @@ -7,21 +7,35 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## v0.13.2 (2025-11-17) + ### Breaking Changes - - Remove `AsyncPerfEventArray` and `AsyncPerfEventArrayBuffer` These types have been removed to - avoid maintaining support for multiple async runtimes. Use `PerfEventArrayBuffer`, which - implements `As{,Raw}Fd` for integration with async executors. - - Rename `EbpfLoader::map_pin_path` to `EbpfLoader::default_map_pin_directory`. - - Rename `EbpfLoader::set_global` to `EbpfLoader::override_global`. - - Rename `EbpfLoader::set_max_entries` to `EbpfLoader::map_max_entries`. + - Removed `AsyncPerfEventArray{,Buffer}` so Aya no longer needs to juggle multiple async runtimes. Use `PerfEventArrayBuffer`, which still implements `As{,Raw}Fd`, when integrating with an executor. + - `EbpfLoader::map_pin_path` is now `EbpfLoader::default_map_pin_directory`, clarifying that the value represents a base directory. + - The loader’s `set_*` helpers were renamed to builder-style APIs (`override_global`/`map_max_entries`). Deprecated shims remain for one release to ease migration. -### Other +### New Features + + - , Added the iterator program type and auto-generated `take_link`/`detach` helpers so iterator programs can be loaded and detached like any other attachment. + - , Added Flow Dissector program support, including ordered link attachment and full `FdLink` conversions for the new program type. + - , , Made pinned maps easier to manage with `Map::from_map_data()`, `XskMap::unset()`, and the ability to pick a custom map pin directory. + - , , Exposed additional metadata and handles: `LinkInfo`/`loaded_links` are now public, program names can be `&'static str`, and ring buffers implement `AsFd`. + - , , Expanded and cached feature probing, reducing redundant syscalls and adding built-in support for `BPF_MAP_TYPE_SK_STORAGE`. + - , Added `Ebpf::maps_disjoint_mut()` plus perf-event hardware breakpoint support to give loaders safer and more capable instrumentation hooks. + +### Bug Fixes + + - Netlink helpers now surface the kernel’s error message instead of returning opaque failures. + - Fixed `PerCpuHashMap::get()` returning `KeyNotFound` when CPU slots were missing; Flow Dissector links now always convert into `FdLink` thanks to . + - Stabilised ring-buffer producer tracking so first events are no longer dropped, and `/proc/$pid/maps` parsing now tolerates trailing newlines (, ). + - , Map names are forced to be NULL-terminated and `construct_debuglink_path()` no longer fails due to missing components. + +### Maintenance + + - , , Documented the exact bpf/perf syscall contracts inside Aya and automatically raise `RLIMIT_MEMLOCK` on kernels <5.11 to smooth out program loading. + - Continued to invest in documentation, resolver clean-ups, and lint/clippy hygiene across the crate so day-to-day maintenance stays manageable. - - Provide deprecated aliases to ease migration, these will be removed in a future release; - - `EbpfLoader::set_global` calls `EbpfLoader::override_global`, and - - `EbpfLoader::set_max_entries` calls `EbpfLoader::map_max_entries`. - ## 0.13.1 (2024-11-01) ### Chore diff --git a/aya/Cargo.toml b/aya/Cargo.toml index ad431440..1fce9f64 100644 --- a/aya/Cargo.toml +++ b/aya/Cargo.toml @@ -4,7 +4,7 @@ documentation = "https://docs.rs/aya" keywords = ["bpf", "ebpf", "kernel", "linux"] name = "aya" readme = "README.md" -version = "0.13.1" +version = "0.13.2" authors.workspace = true edition.workspace = true @@ -18,7 +18,7 @@ workspace = true [dependencies] assert_matches = { workspace = true } -aya-obj = { path = "../aya-obj", version = "^0.2.1", features = ["std"] } +aya-obj = { path = "../aya-obj", version = "^0.2.2", features = ["std"] } bitflags = { workspace = true } bytes = { workspace = true } hashbrown = { workspace = true } diff --git a/ebpf/aya-ebpf-bindings/CHANGELOG.md b/ebpf/aya-ebpf-bindings/CHANGELOG.md index 1bf9dac2..6dc862e8 100644 --- a/ebpf/aya-ebpf-bindings/CHANGELOG.md +++ b/ebpf/aya-ebpf-bindings/CHANGELOG.md @@ -5,6 +5,18 @@ 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). +## [Unreleased] + +## v0.1.2 (2025-11-17) + +### New Features + + - , , Regenerated the bindings from libbpf 324f3c38…, pulling in MIPS and LoongArch64 support alongside the latest kernel constants. + +### Maintenance + + - , General lint/build fixes (including the riscv64 build) to keep the generated code warning-free. + ## v0.1.1 (2024-10-09) ### Other diff --git a/ebpf/aya-ebpf-bindings/Cargo.toml b/ebpf/aya-ebpf-bindings/Cargo.toml index a75b8d0a..f906ab5e 100644 --- a/ebpf/aya-ebpf-bindings/Cargo.toml +++ b/ebpf/aya-ebpf-bindings/Cargo.toml @@ -1,7 +1,7 @@ [package] description = "Bindings for Linux Kernel eBPF types and helpers" name = "aya-ebpf-bindings" -version = "0.1.1" +version = "0.1.2" authors.workspace = true edition.workspace = true @@ -13,7 +13,7 @@ repository.workspace = true workspace = true [dependencies] -aya-ebpf-cty = { version = "^0.2.2", path = "../aya-ebpf-cty" } +aya-ebpf-cty = { version = "^0.2.3", path = "../aya-ebpf-cty" } [build-dependencies] -aya-build = { version = "^0.1.2", path = "../../aya-build" } +aya-build = { version = "^0.1.3", path = "../../aya-build" } diff --git a/ebpf/aya-ebpf-cty/CHANGELOG.md b/ebpf/aya-ebpf-cty/CHANGELOG.md index 23c0b0a1..dd3d09d4 100644 --- a/ebpf/aya-ebpf-cty/CHANGELOG.md +++ b/ebpf/aya-ebpf-cty/CHANGELOG.md @@ -5,65 +5,15 @@ This project adheres to $[Semantic Versioning](http://semver.org/). ## [Unreleased] -## [v0.2.1] - 2019-11-16 +## v0.2.3 (2025-11-17) -### Added +### New Features -- Support for the `xtensa`, `riscv32` and `riscv64` architectures + - , Added the missing MIPS and LoongArch definitions so the cty shim covers every architecture supported by Aya. -## [v0.2.0] - 2019-02-06 +### Maintenance -### Changed - -- [breaking-change] `cty::c_void` is now a type alias of `core::ffi::c_void`. - -## [v0.1.5] - 2017-05-29 - -### Added - -- More types like `int32_t` - -## [v0.1.4] - 2017-05-29 - -### Added - -- Support for the `msp430` architecture. - -### Fixed - -- [breaking-change] The type definitions of `c_long` and `c_ulong`. - -## [v0.1.3] - 2017-05-29 - YANKED - -### Added - -- Support for the `nvptx` and `nvptx64` architectures. - -## [v0.1.2] - 2017-05-29 - YANKED - -### Fixed - -- [breaking-change] The type definitions of `c_int` and `c_uint`. - -## [v0.1.1] - 2017-05-29 - YANKED - -### Fixed - -- [breaking-change] The type definitions of `c_long`, `c_ulong` and - `c_longlong`. - -## v0.1.0 - 2017-05-24 - YANKED - -- Initial release - -[Unreleased]: https://github.com/japaric/cty/compare/v0.2.1...HEAD -[v0.2.1]: https://github.com/japaric/cty/compare/v0.2.0...v0.2.1 -[v0.2.0]: https://github.com/japaric/cty/compare/v0.1.5...v0.2.0 -[v0.1.5]: https://github.com/japaric/cty/compare/v0.1.4...v0.1.5 -[v0.1.4]: https://github.com/japaric/cty/compare/v0.1.3...v0.1.4 -[v0.1.3]: https://github.com/japaric/cty/compare/v0.1.2...v0.1.3 -[v0.1.2]: https://github.com/japaric/cty/compare/v0.1.1...v0.1.2 -[v0.1.1]: https://github.com/japaric/cty/compare/v0.1.0...v0.1.1 + - , Tidied the crate (removing the abandoned Travis setup) and refreshed the bindings so downstream riscv64 builds stay green. ## v0.2.2 (2024-10-09) diff --git a/ebpf/aya-ebpf-cty/Cargo.toml b/ebpf/aya-ebpf-cty/Cargo.toml index a848b6aa..fc695096 100644 --- a/ebpf/aya-ebpf-cty/Cargo.toml +++ b/ebpf/aya-ebpf-cty/Cargo.toml @@ -3,7 +3,7 @@ categories = ["embedded", "external-ffi-bindings", "no-std"] description = "Type aliases to C types like c_int for use with bindgen" documentation = "https://docs.rs/aya-bpf-cty" name = "aya-ebpf-cty" -version = "0.2.2" +version = "0.2.3" authors.workspace = true edition.workspace = true @@ -16,4 +16,4 @@ rust-version.workspace = true workspace = true [build-dependencies] -aya-build = { version = "^0.1.2", path = "../../aya-build" } +aya-build = { version = "^0.1.3", path = "../../aya-build" } diff --git a/ebpf/aya-ebpf/CHANGELOG.md b/ebpf/aya-ebpf/CHANGELOG.md index fb00292b..d8c155a8 100644 --- a/ebpf/aya-ebpf/CHANGELOG.md +++ b/ebpf/aya-ebpf/CHANGELOG.md @@ -5,6 +5,35 @@ 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). +## [Unreleased] + +## v0.1.2 (2025-11-17) + +### Breaking Changes + + - Map helper functions now take `*mut c_void`, matching the kernel’s prototypes. Any out-of-tree helpers should update their signatures accordingly. + +### New Features + + - Added a `bpf_strncmp` helper binding. + - Raw tracepoints now expose their arguments so programs no longer need to guess register layouts. + - , Added mips/loongarch register helpers so those targets can implement `FromPtRegs`. + - `XdpContext` exposes the interface index, simplifying multi-interface programs. + - Added `Array::set()` to update array contents from eBPF code. + - Introduced Flow Dissector program support on the eBPF side. + - Added `RingBufBytes` so probes can emit raw byte slices efficiently. + - , Added BTF array definitions plus `Queue`/`Stack::peek()` helpers for safer data-structure inspection. + +### Bug Fixes + + - Fixed riscv64 builds by updating the generated bindings. + - Cleaned up ring-buffer code to avoid reliance on `as` casts, preventing UB on strict architectures. + - Guarded the libc `mem*` shims behind `cfg(target_arch = "bpf")`, ensuring CPU builds stay well-defined. + +### Maintenance + + - , Added configuration flags for `generic_const_exprs` and the loongarch target, plus the usual lint/documentation refresh. + ## v0.1.1 (2024-10-09) ### New Features diff --git a/ebpf/aya-ebpf/Cargo.toml b/ebpf/aya-ebpf/Cargo.toml index e2067982..b597f21f 100644 --- a/ebpf/aya-ebpf/Cargo.toml +++ b/ebpf/aya-ebpf/Cargo.toml @@ -1,7 +1,7 @@ [package] description = "A library for writing eBPF programs" name = "aya-ebpf" -version = "0.1.1" +version = "0.1.2" authors.workspace = true edition.workspace = true @@ -14,10 +14,10 @@ rust-version.workspace = true workspace = true [dependencies] -aya-ebpf-bindings = { version = "^0.1.1", path = "../aya-ebpf-bindings" } -aya-ebpf-cty = { version = "^0.2.2", path = "../aya-ebpf-cty" } -aya-ebpf-macros = { version = "^0.1.1", path = "../../aya-ebpf-macros" } +aya-ebpf-bindings = { version = "^0.1.2", path = "../aya-ebpf-bindings" } +aya-ebpf-cty = { version = "^0.2.3", path = "../aya-ebpf-cty" } +aya-ebpf-macros = { version = "^0.1.2", path = "../../aya-ebpf-macros" } [build-dependencies] -aya-build = { version = "^0.1.2", path = "../../aya-build" } +aya-build = { version = "^0.1.3", path = "../../aya-build" } rustversion = { workspace = true } diff --git a/ebpf/aya-log-ebpf/CHANGELOG.md b/ebpf/aya-log-ebpf/CHANGELOG.md index d25856d3..ac8b22e8 100644 --- a/ebpf/aya-log-ebpf/CHANGELOG.md +++ b/ebpf/aya-log-ebpf/CHANGELOG.md @@ -5,6 +5,24 @@ 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). +## [Unreleased] + +## 0.1.2 (2025-11-17) + +### Breaking Changes + + - Logging from eBPF programs now writes into a ring buffer to match the host transport, requiring Linux 5.8 or later. + +### New Features + + - , Added a load-time log level mask and improved verifier hints so disabled log levels are optimised out entirely. + - Logging paths now use zero-copy writes into the ring buffer, lowering instruction counts inside probes. + - Added raw-pointer formatting so eBPF logs can mirror the new host-side diagnostics. + +### Maintenance + + - , Kept the crate in sync with the workspace edition/lint settings and tidied the macro support helpers. + ## 0.1.1 (2024-10-09) Maintenance release. Update to latest aya-ebpf version v0.1.1. diff --git a/ebpf/aya-log-ebpf/Cargo.toml b/ebpf/aya-log-ebpf/Cargo.toml index 90c54198..89c1ac10 100644 --- a/ebpf/aya-log-ebpf/Cargo.toml +++ b/ebpf/aya-log-ebpf/Cargo.toml @@ -1,7 +1,7 @@ [package] description = "Logging for eBPF programs" name = "aya-log-ebpf" -version = "0.1.1" +version = "0.1.2" authors.workspace = true edition.workspace = true @@ -14,6 +14,6 @@ rust-version.workspace = true workspace = true [dependencies] -aya-ebpf = { version = "^0.1.1", path = "../aya-ebpf" } -aya-log-common = { version = "^0.1.15", path = "../../aya-log-common" } -aya-log-ebpf-macros = { version = "^0.1.0", path = "../../aya-log-ebpf-macros" } +aya-ebpf = { version = "^0.1.2", path = "../aya-ebpf" } +aya-log-common = { version = "^0.1.16", path = "../../aya-log-common" } +aya-log-ebpf-macros = { version = "^0.1.1", path = "../../aya-log-ebpf-macros" } diff --git a/test/integration-test/Cargo.toml b/test/integration-test/Cargo.toml index e443af2f..e81d705c 100644 --- a/test/integration-test/Cargo.toml +++ b/test/integration-test/Cargo.toml @@ -14,13 +14,13 @@ rust-version.workspace = true workspace = true [dependencies] -aya = { path = "../../aya", version = "^0.13.1", default-features = false } +aya = { path = "../../aya", version = "^0.13.2", default-features = false } [dev-dependencies] anyhow = { workspace = true, features = ["std"] } assert_matches = { workspace = true } -aya-log = { path = "../../aya-log", version = "^0.2.1", default-features = false } -aya-obj = { path = "../../aya-obj", version = "^0.2.1", default-features = false } +aya-log = { path = "../../aya-log", version = "^0.2.2", default-features = false } +aya-obj = { path = "../../aya-obj", version = "^0.2.2", default-features = false } epoll = { workspace = true } futures = { workspace = true, features = ["alloc"] } integration-common = { path = "../integration-common", features = ["user"] } From fc2320bb5df80a6187ca07d6004018ece41b960f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 Nov 2025 13:21:08 +0000 Subject: [PATCH 44/46] build(deps): bump actions/checkout in the github-actions group Bumps the github-actions group with 1 update: [actions/checkout](https://github.com/actions/checkout). Updates `actions/checkout` from 5 to 6 - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v5...v6) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions ... Signed-off-by: dependabot[bot] --- .github/workflows/ci.yml | 8 ++++---- .github/workflows/gen.yml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 15927855..55ed4e99 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - uses: dtolnay/rust-toolchain@nightly with: @@ -90,7 +90,7 @@ jobs: - x86_64-unknown-linux-gnu runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - uses: dtolnay/rust-toolchain@stable with: @@ -146,7 +146,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - uses: dtolnay/rust-toolchain@nightly with: @@ -250,7 +250,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 with: submodules: recursive diff --git a/.github/workflows/gen.yml b/.github/workflows/gen.yml index 03d5c43b..6919d8a1 100644 --- a/.github/workflows/gen.yml +++ b/.github/workflows/gen.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 with: submodules: recursive From a22ec3792a446e403ecd14891096e887ec32320b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 Nov 2025 13:45:50 +0000 Subject: [PATCH 45/46] build(deps): update object requirement in the cargo-crates group Updates the requirements on [object](https://github.com/gimli-rs/object) to permit the latest version. Updates `object` to 0.38.0 - [Changelog](https://github.com/gimli-rs/object/blob/master/CHANGELOG.md) - [Commits](https://github.com/gimli-rs/object/compare/0.37.0...0.38.0) --- updated-dependencies: - dependency-name: object dependency-version: 0.38.0 dependency-type: direct:production dependency-group: cargo-crates ... Signed-off-by: dependabot[bot] --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index e4d1111a..5c61670f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -86,7 +86,7 @@ log = { version = "0.4", default-features = false } network-types = { version = "0.1.0", default-features = false } nix = { version = "0.30.1", default-features = false } num_enum = { version = "0.7", default-features = false } -object = { version = "0.37", default-features = false } +object = { version = "0.38", default-features = false } once_cell = { version = "1.20.1", default-features = false } proc-macro2 = { version = "1", default-features = false } proc-macro2-diagnostics = { version = "0.10.1", default-features = false } From 7a3c03e178ced68f63cd1f6cfa3f8fa56459aee9 Mon Sep 17 00:00:00 2001 From: Daniel Mellado Date: Sun, 30 Nov 2025 19:06:24 +0100 Subject: [PATCH 46/46] Add licese for aya-obj This commit adds a link for the needed licenses in aya-obj for fedora packaging. Signed-off-by: Daniel Mellado --- aya-obj/LICENSE-APACHE | 1 + aya-obj/LICENSE-MIT | 1 + 2 files changed, 2 insertions(+) create mode 120000 aya-obj/LICENSE-APACHE create mode 120000 aya-obj/LICENSE-MIT diff --git a/aya-obj/LICENSE-APACHE b/aya-obj/LICENSE-APACHE new file mode 120000 index 00000000..965b606f --- /dev/null +++ b/aya-obj/LICENSE-APACHE @@ -0,0 +1 @@ +../LICENSE-APACHE \ No newline at end of file diff --git a/aya-obj/LICENSE-MIT b/aya-obj/LICENSE-MIT new file mode 120000 index 00000000..76219eb7 --- /dev/null +++ b/aya-obj/LICENSE-MIT @@ -0,0 +1 @@ +../LICENSE-MIT \ No newline at end of file