diff --git a/aya-ebpf-macros/src/map.rs b/aya-ebpf-macros/src/map.rs index a5a2f22e36..9e290bc89f 100644 --- a/aya-ebpf-macros/src/map.rs +++ b/aya-ebpf-macros/src/map.rs @@ -23,6 +23,7 @@ impl Map { let section_name: Cow<'_, _> = "maps".into(); let name = &self.name; let item = &self.item; + quote! { #[unsafe(link_section = #section_name)] #[unsafe(export_name = #name)] @@ -72,4 +73,18 @@ mod tests { ); assert_eq!(expected.to_string(), expanded.to_string()); } + + #[test] + fn test_map_unknown_arg() { + let result = Map::parse( + parse_quote!(unknown = "foo"), + parse_quote!( + static BAR: HashMap<&'static str, u32> = HashMap::new(); + ), + ); + let Err(err) = result else { + panic!("expected parse error for unknown argument") + }; + assert_eq!(err.to_string(), "invalid argument"); + } } diff --git a/aya-obj/src/btf/btf.rs b/aya-obj/src/btf/btf.rs index a7f423a73c..aaeff05c33 100644 --- a/aya-obj/src/btf/btf.rs +++ b/aya-obj/src/btf/btf.rs @@ -152,6 +152,27 @@ pub enum BtfError { /// unable to get symbol name #[error("Unable to get symbol name")] InvalidSymbolName, + + /// Inner map definition cannot be pinned. + #[error("BTF map `{name}`: inner map definition cannot be pinned")] + InnerMapCannotBePinned { + /// The name of the map with the invalid definition. + name: String, + }, + + /// Multi-level map-in-map is not supported. + #[error("BTF map `{name}`: multi-level map-in-map is not supported")] + MultiLevelMapInMapNotSupported { + /// The name of the map with the invalid definition. + name: String, + }, + + /// The `values` spec must be a zero-sized array. + #[error("BTF map `{name}`: `values` spec is not a zero-sized array")] + InvalidValuesSpec { + /// The name of the map with the invalid definition. + name: String, + }, } /// Available BTF features diff --git a/aya-obj/src/maps.rs b/aya-obj/src/maps.rs index 2e6887593e..b165120cfa 100644 --- a/aya-obj/src/maps.rs +++ b/aya-obj/src/maps.rs @@ -258,6 +258,61 @@ impl Map { Self::Btf(m) => Some(m.symbol_index), } } + + /// Returns the inner map definition, in case of a map of maps. + pub fn inner(&self) -> Option { + match self { + Self::Legacy(m) => m.inner_def.as_ref().map(|inner_def| { + Self::Legacy(LegacyMap { + def: *inner_def, + inner_def: None, + // The inner map is a synthetic object with no ELF presence + // of its own, so use neutral metadata values. + section_index: 0, + section_kind: EbpfSectionKind::Undefined, + symbol_index: None, + data: Vec::new(), + }) + }), + Self::Btf(m) => m.inner_def.as_ref().map(|inner_def| { + Self::Btf(BtfMap { + def: *inner_def, + inner_def: None, + // The inner map is a synthetic object with no ELF presence + // of its own, so use neutral metadata values. + section_index: 0, + symbol_index: 0, + data: Vec::new(), + }) + }), + } + } + + /// Creates a new map definition from raw parameters. + pub const fn new_from_params( + map_type: u32, + key_size: u32, + value_size: u32, + max_entries: u32, + flags: u32, + ) -> Self { + Self::Legacy(LegacyMap { + def: bpf_map_def { + map_type, + key_size, + value_size, + max_entries, + map_flags: flags, + id: 0, + pinning: PinningType::None, + }, + inner_def: None, + section_index: 0, + section_kind: EbpfSectionKind::Undefined, + symbol_index: None, + data: Vec::new(), + }) + } } /// A map declared with legacy BPF map declaration style, most likely from a `maps` section. @@ -268,6 +323,8 @@ impl Map { pub struct LegacyMap { /// The definition of the map pub def: bpf_map_def, + /// The definition of the inner map, in case of a map of maps. + pub inner_def: Option, /// The section index pub section_index: usize, /// The section kind @@ -287,6 +344,8 @@ pub struct LegacyMap { pub struct BtfMap { /// The definition of the map pub def: BtfMapDef, + /// The definition of the inner map, in case of a map of maps. + pub(crate) inner_def: Option, pub(crate) section_index: usize, pub(crate) symbol_index: usize, pub(crate) data: Vec, diff --git a/aya-obj/src/obj.rs b/aya-obj/src/obj.rs index 8d7defb819..c94ebb81aa 100644 --- a/aya-obj/src/obj.rs +++ b/aya-obj/src/obj.rs @@ -20,6 +20,7 @@ use object::{ use crate::{ btf::{ Array, Btf, BtfError, BtfExt, BtfFeatures, BtfType, DataSecEntry, FuncSecInfo, LineSecInfo, + Struct, }, generated::{ BPF_CALL, BPF_F_RDONLY_PROG, BPF_JMP, BPF_K, bpf_func_id, bpf_insn, bpf_map_info, @@ -785,7 +786,7 @@ impl Object { if type_name == section.name { // each btf_var_secinfo contains a map for info in &datasec.entries { - let (map_name, def) = parse_btf_map_def(btf, info)?; + let (map_name, def, inner_def) = parse_btf_map_def(btf, info)?; let symbol_index = maps.get(&map_name) .ok_or_else(|| ParseError::SymbolNotFound { @@ -795,6 +796,7 @@ impl Object { map_name, Map::Btf(BtfMap { def, + inner_def, section_index: section.index.0, symbol_index: *symbol_index, data: Vec::new(), @@ -840,6 +842,7 @@ impl Object { section_kind: section.kind, symbol_index: Some(sym.index), def, + inner_def: None, data: Vec::new(), }), ); @@ -1255,6 +1258,7 @@ fn parse_data_map_section(section: &Section<'_>) -> Map { // Data maps don't require symbols to be relocated symbol_index: None, def, + inner_def: None, data, }) } @@ -1278,7 +1282,10 @@ fn parse_map_def(name: &str, data: &[u8]) -> Result { } } -fn parse_btf_map_def(btf: &Btf, info: &DataSecEntry) -> Result<(String, BtfMapDef), BtfError> { +fn parse_btf_map_def( + btf: &Btf, + info: &DataSecEntry, +) -> Result<(String, BtfMapDef, Option), BtfError> { let ty = match btf.type_by_id(info.btf_type)? { BtfType::Var(var) => var, other => { @@ -1288,7 +1295,6 @@ fn parse_btf_map_def(btf: &Btf, info: &DataSecEntry) -> Result<(String, BtfMapDe } }; let map_name = btf.string_at(ty.name_offset)?; - let mut map_def = BtfMapDef::default(); let root_type = btf.resolve_type(ty.btf_type)?; let s = match btf.type_by_id(root_type)? { @@ -1300,6 +1306,23 @@ fn parse_btf_map_def(btf: &Btf, info: &DataSecEntry) -> Result<(String, BtfMapDe } }; + let (map_def, inner_def) = parse_btf_map_struct(btf, s, &map_name, false)?; + Ok((map_name.to_string(), map_def, inner_def)) +} + +/// Parses BTF struct members into a map definition. +/// +/// When `is_inner` is true, rejects `values` and `pinning` fields, matching +/// libbpf behavior for inner map definitions. +fn parse_btf_map_struct( + btf: &Btf, + s: &Struct, + map_name: &str, + is_inner: bool, +) -> Result<(BtfMapDef, Option), BtfError> { + let mut map_def = BtfMapDef::default(); + let mut inner_map_def = None; + for m in &s.members { match btf.string_at(m.name_offset)?.as_ref() { "type" => { @@ -1343,18 +1366,67 @@ fn parse_btf_map_def(btf: &Btf, info: &DataSecEntry) -> Result<(String, BtfMapDe map_def.map_extra = get_map_field(btf, m.btf_type)?.into(); } "pinning" => { + if is_inner { + return Err(BtfError::InnerMapCannotBePinned { + name: map_name.to_owned(), + }); + } let pinning = get_map_field(btf, m.btf_type)?; map_def.pinning = PinningType::try_from(pinning).unwrap_or_else(|_| { debug!("{pinning} is not a valid pin type. using PIN_NONE"); PinningType::None }); } + "values" => { + if is_inner { + return Err(BtfError::MultiLevelMapInMapNotSupported { + name: map_name.to_owned(), + }); + } + // The inner map type is encoded as a zero-length array of pointers + // to the inner struct, matching libbpf's parse_btf_map_def(). + let arr = match btf.type_by_id(m.btf_type)? { + BtfType::Array(Array { array, .. }) => array, + other => { + return Err(BtfError::UnexpectedBtfType { + type_id: other.btf_type().unwrap_or(0), + }); + } + }; + if arr.len != 0 { + return Err(BtfError::InvalidValuesSpec { + name: map_name.to_owned(), + }); + } + let elem_type_id = btf.resolve_type(arr.element_type)?; + let ptr = match btf.type_by_id(elem_type_id)? { + BtfType::Ptr(ptr) => ptr, + other => { + return Err(BtfError::UnexpectedBtfType { + type_id: other.btf_type().unwrap_or(0), + }); + } + }; + let inner_struct_id = btf.resolve_type(ptr.btf_type)?; + let inner_s = match btf.type_by_id(inner_struct_id)? { + BtfType::Struct(s) => s, + other => { + return Err(BtfError::UnexpectedBtfType { + type_id: other.btf_type().unwrap_or(0), + }); + } + }; + let (inner_def, _) = parse_btf_map_struct(btf, inner_s, map_name, true)?; + inner_map_def = Some(inner_def); + // Map-of-maps value is always an fd (u32). + map_def.value_size = size_of::() as u32; + } other => { debug!("skipping unknown map section: {other}"); } } } - Ok((map_name.to_string(), map_def)) + Ok((map_def, inner_map_def)) } /// Parses a [`bpf_map_info`] into a [`Map`]. @@ -1375,6 +1447,7 @@ pub const fn parse_map_info(info: bpf_map_info, pinned: PinningType) -> Map { btf_key_type_id: info.btf_key_type_id, btf_value_type_id: info.btf_value_type_id, }, + inner_def: None, section_index: 0, symbol_index: 0, data: Vec::new(), @@ -1390,6 +1463,7 @@ pub const fn parse_map_info(info: bpf_map_info, pinned: PinningType) -> Map { pinning: pinned, id: info.id, }, + inner_def: None, section_index: 0, symbol_index: None, section_kind: EbpfSectionKind::Undefined, @@ -1673,6 +1747,7 @@ mod tests { pinning: PinningType::None, }, data, + .. }) if data == map_data && value_size == map_data.len() as u32 ) } @@ -2728,6 +2803,7 @@ mod tests { id: 1, pinning: PinningType::None, }, + inner_def: None, section_index: 1, section_kind: EbpfSectionKind::Rodata, symbol_index: Some(1), diff --git a/aya-obj/src/relocation.rs b/aya-obj/src/relocation.rs index 1931b5fd21..a2ae5fda48 100644 --- a/aya-obj/src/relocation.rs +++ b/aya-obj/src/relocation.rs @@ -516,6 +516,7 @@ mod test { fn fake_legacy_map(symbol_index: usize) -> Map { Map::Legacy(LegacyMap { def: Default::default(), + inner_def: None, section_index: 0, section_kind: EbpfSectionKind::Undefined, symbol_index: Some(symbol_index), @@ -526,6 +527,7 @@ mod test { fn fake_btf_map(symbol_index: usize) -> Map { Map::Btf(BtfMap { def: Default::default(), + inner_def: None, section_index: 0, symbol_index, data: Vec::new(), diff --git a/aya/src/bpf.rs b/aya/src/bpf.rs index eeaccedd8a..6be0f2f516 100644 --- a/aya/src/bpf.rs +++ b/aya/src/bpf.rs @@ -1,7 +1,7 @@ use std::{ borrow::Cow, collections::{HashMap, HashSet}, - fs, io, + fs, io, iter, os::fd::{AsFd as _, AsRawFd as _}, path::{Path, PathBuf}, sync::{Arc, LazyLock}, @@ -495,38 +495,88 @@ impl<'a> EbpfLoader<'a> { if let Some(btf) = &btf { obj.relocate_btf(btf)?; } - let mut maps = HashMap::new(); - for (name, mut obj) in obj.maps.drain() { + + const fn is_map_of_maps(map_type: bpf_map_type) -> bool { + matches!( + map_type, + bpf_map_type::BPF_MAP_TYPE_ARRAY_OF_MAPS | bpf_map_type::BPF_MAP_TYPE_HASH_OF_MAPS + ) + } + + // The kernel requires inner_map_fd when creating map-of-maps, so inner + // maps must be created first. Partition into regular maps and map-of-maps. + let mut regular_maps: Vec<(String, aya_obj::Map)> = Vec::new(); + let mut maps_of_maps: Vec<(String, aya_obj::Map)> = Vec::new(); + + for (name, map_obj) in obj.maps.drain() { if let (false, EbpfSectionKind::Bss | EbpfSectionKind::Data | EbpfSectionKind::Rodata) = - (FEATURES.bpf_global_data(), obj.section_kind()) + (FEATURES.bpf_global_data(), map_obj.section_kind()) { continue; } + let map_type: bpf_map_type = map_obj.map_type().try_into().map_err(MapError::from)?; + if is_map_of_maps(map_type) { + maps_of_maps.push((name, map_obj)); + } else { + regular_maps.push((name, map_obj)); + } + } + + let mut maps: HashMap = HashMap::new(); + + // Regular maps first, so they're available as inner maps below. + for ((name, mut map_obj), is_map_of_maps) in regular_maps + .into_iter() + .zip(iter::repeat(false)) + .chain(maps_of_maps.into_iter().zip(iter::repeat(true))) + { let num_cpus = || { Ok(nr_cpus().map_err(|(path, error)| EbpfError::FileError { path: PathBuf::from(path), error, })? as u32) }; - let map_type: bpf_map_type = obj.map_type().try_into().map_err(MapError::from)?; - if let Some(max_entries) = max_entries_override( + let map_type: bpf_map_type = map_obj.map_type().try_into().map_err(MapError::from)?; + if let Some(max_entries_val) = max_entries_override( map_type, max_entries.get(name.as_str()).copied(), - || obj.max_entries(), + || map_obj.max_entries(), num_cpus, || page_size() as u32, )? { - obj.set_max_entries(max_entries) + map_obj.set_max_entries(max_entries_val) } if let Some(value_size) = value_size_override(map_type) { - obj.set_value_size(value_size) + map_obj.set_value_size(value_size) } + let btf_fd = btf_fd.as_deref().map(|fd| fd.as_fd()); + + // Defer inner map creation to avoid a BPF_MAP_CREATE when the outer map is already pinned. + let inner_map_obj = is_map_of_maps + .then(|| { + map_obj.inner().ok_or_else(|| { + EbpfError::MapError(MapError::MissingInnerMapDefinition { + outer_name: name.clone(), + }) + }) + }) + .transpose()?; let mut map = if let Some(pin_path) = map_pin_path_by_name.get(name.as_str()) { - MapData::create_pinned_by_name(pin_path, obj, &name, btf_fd)? + MapData::create_pinned_by_name(pin_path, map_obj, &name, btf_fd, inner_map_obj)? } else { - match obj.pinning() { - PinningType::None => MapData::create(obj, &name, btf_fd)?, + match map_obj.pinning() { + PinningType::None => { + let btf_inner_map; + let inner_map_fd = if let Some(inner) = inner_map_obj { + btf_inner_map = + MapData::create(inner, &format!("{name}.inner"), btf_fd)?; + Some(btf_inner_map.fd().as_fd()) + } else { + None + }; + MapData::create_with_inner_map_fd(map_obj, &name, btf_fd, inner_map_fd)? + } PinningType::ByName => { // pin maps in /sys/fs/bpf by default to align with libbpf // behavior https://github.com/libbpf/libbpf/blob/v1.2.2/src/libbpf.c#L2161. @@ -535,7 +585,7 @@ impl<'a> EbpfLoader<'a> { .unwrap_or_else(|| Path::new("/sys/fs/bpf")); let path = path.join(&name); - MapData::create_pinned_by_name(path, obj, &name, btf_fd)? + MapData::create_pinned_by_name(path, map_obj, &name, btf_fd, inner_map_obj)? } } }; @@ -773,6 +823,8 @@ fn parse_map( bpf_map_type::BPF_MAP_TYPE_DEVMAP_HASH => Map::DevMapHash(map), bpf_map_type::BPF_MAP_TYPE_XSKMAP => Map::XskMap(map), bpf_map_type::BPF_MAP_TYPE_SK_STORAGE => Map::SkStorage(map), + bpf_map_type::BPF_MAP_TYPE_ARRAY_OF_MAPS => Map::ArrayOfMaps(map), + bpf_map_type::BPF_MAP_TYPE_HASH_OF_MAPS => Map::HashOfMaps(map), m_type => { if allow_unsupported_maps { Map::Unsupported(map) diff --git a/aya/src/maps/mod.rs b/aya/src/maps/mod.rs index 9185ec7aea..4232727eeb 100644 --- a/aya/src/maps/mod.rs +++ b/aya/src/maps/mod.rs @@ -76,6 +76,7 @@ pub mod bloom_filter; pub mod hash_map; mod info; pub mod lpm_trie; +pub mod of_maps; pub mod perf; pub mod queue; pub mod ring_buf; @@ -90,6 +91,7 @@ pub use bloom_filter::BloomFilter; pub use hash_map::{HashMap, PerCpuHashMap}; pub use info::{MapInfo, MapType, loaded_maps}; pub use lpm_trie::LpmTrie; +pub use of_maps::{ArrayOfMaps, HashOfMaps}; pub use perf::PerfEventArray; pub use queue::Queue; pub use ring_buf::RingBuf; @@ -99,9 +101,68 @@ pub use stack::Stack; pub use stack_trace::StackTraceMap; pub use xdp::{CpuMap, DevMap, DevMapHash, XskMap}; +/// Trait for constructing a typed map from [`MapData`]. +/// +/// This trait is sealed and cannot be implemented outside of this crate. +pub trait FromMapData: Sized + sealed::FromMapData {} + +impl FromMapData for T {} + +/// Marker for map types that the kernel supports as inner maps. +/// +/// This trait is sealed and cannot be implemented outside of this crate. +pub trait InnerMap: sealed::InnerMap {} + +impl InnerMap for T {} + +/// Trait for map types that can be created standalone from userspace. +/// +/// This is used to create inner maps for map-of-maps types. +/// +/// This trait is sealed and cannot be implemented outside of this crate. +pub trait CreatableMap: sealed::CreatableMap { + /// Creates a standalone map with the given `max_entries` capacity and `flags`. + fn create(max_entries: u32, flags: u32) -> Result { + ::create(max_entries, flags) + } +} + +impl CreatableMap for T {} + +mod sealed { + use super::{MapData, MapError, MapFd}; + + #[expect(unnameable_types, reason = "intentionally unnameable sealed trait")] + pub trait FromMapData: Sized { + /// Constructs a typed map from raw [`MapData`]. + fn from_map_data(map_data: MapData) -> Result; + } + + #[expect(unnameable_types, reason = "intentionally unnameable sealed trait")] + pub trait InnerMap { + /// Returns the map file descriptor. + fn fd(&self) -> &MapFd; + } + + #[expect(unnameable_types, reason = "intentionally unnameable sealed trait")] + pub trait CreatableMap: Sized { + fn create(max_entries: u32, flags: u32) -> Result; + } +} + #[derive(Error, Debug)] /// Errors occuring from working with Maps pub enum MapError { + /// Missing inner map BTF definition for a map-of-maps. + #[error( + "map `{outer_name}` is a map-of-maps but has no inner map definition; \ + use #[btf_map] with a BTF-typed map-of-maps that includes an inner map type" + )] + MissingInnerMapDefinition { + /// The outer map name. + outer_name: String, + }, + /// Invalid map type encontered #[error("invalid map type {map_type}")] InvalidMapType { @@ -235,7 +296,8 @@ impl MapFd { Self { fd } } - fn try_clone(&self) -> io::Result { + /// Creates a new instance that shares the same underlying file description as `self`. + pub fn try_clone(&self) -> io::Result { let Self { fd } = self; let fd = fd.try_clone()?; Ok(Self { fd }) @@ -254,6 +316,8 @@ impl AsFd for MapFd { pub enum Map { /// An [`Array`] map. Array(MapData), + /// An [`ArrayOfMaps`] map. + ArrayOfMaps(MapData), /// A [`BloomFilter`] map. BloomFilter(MapData), /// A [`CpuMap`] map. @@ -264,6 +328,8 @@ pub enum Map { DevMapHash(MapData), /// A [`HashMap`] map. HashMap(MapData), + /// A [`HashOfMaps`] map. + HashOfMaps(MapData), /// A [`LpmTrie`] map. LpmTrie(MapData), /// A [`HashMap`] map that uses a LRU eviction policy. @@ -305,11 +371,13 @@ impl Map { const fn map_type(&self) -> u32 { match self { Self::Array(map) => map.obj.map_type(), + Self::ArrayOfMaps(map) => map.obj.map_type(), Self::BloomFilter(map) => map.obj.map_type(), Self::CpuMap(map) => map.obj.map_type(), Self::DevMap(map) => map.obj.map_type(), Self::DevMapHash(map) => map.obj.map_type(), Self::HashMap(map) => map.obj.map_type(), + Self::HashOfMaps(map) => map.obj.map_type(), Self::LpmTrie(map) => map.obj.map_type(), Self::LruHashMap(map) => map.obj.map_type(), Self::PerCpuArray(map) => map.obj.map_type(), @@ -337,11 +405,13 @@ impl Map { pub fn pin>(&self, path: P) -> Result<(), PinError> { match self { Self::Array(map) => map.pin(path), + Self::ArrayOfMaps(map) => map.pin(path), Self::BloomFilter(map) => map.pin(path), Self::CpuMap(map) => map.pin(path), Self::DevMap(map) => map.pin(path), Self::DevMapHash(map) => map.pin(path), Self::HashMap(map) => map.pin(path), + Self::HashOfMaps(map) => map.pin(path), Self::LpmTrie(map) => map.pin(path), Self::LruHashMap(map) => map.pin(path), Self::PerCpuArray(map) => map.pin(path), @@ -396,8 +466,8 @@ impl Map { bpf_map_type::BPF_MAP_TYPE_RINGBUF => Self::RingBuf(map_data), bpf_map_type::BPF_MAP_TYPE_BLOOM_FILTER => Self::BloomFilter(map_data), bpf_map_type::BPF_MAP_TYPE_CGROUP_ARRAY => Self::Unsupported(map_data), - bpf_map_type::BPF_MAP_TYPE_ARRAY_OF_MAPS => Self::Unsupported(map_data), - bpf_map_type::BPF_MAP_TYPE_HASH_OF_MAPS => Self::Unsupported(map_data), + bpf_map_type::BPF_MAP_TYPE_ARRAY_OF_MAPS => Self::ArrayOfMaps(map_data), + bpf_map_type::BPF_MAP_TYPE_HASH_OF_MAPS => Self::HashOfMaps(map_data), bpf_map_type::BPF_MAP_TYPE_CGROUP_STORAGE_DEPRECATED => Self::Unsupported(map_data), bpf_map_type::BPF_MAP_TYPE_REUSEPORT_SOCKARRAY => Self::ReusePortSockArray(map_data), bpf_map_type::BPF_MAP_TYPE_SK_STORAGE => Self::SkStorage(map_data), @@ -415,6 +485,37 @@ impl Map { }; Ok(map) } + + /// Returns the file descriptor of the map. + pub const fn fd(&self) -> &MapFd { + match self { + Self::Array(map) => map.fd(), + Self::ArrayOfMaps(map) => map.fd(), + Self::BloomFilter(map) => map.fd(), + Self::CpuMap(map) => map.fd(), + Self::DevMap(map) => map.fd(), + Self::DevMapHash(map) => map.fd(), + Self::HashMap(map) => map.fd(), + Self::HashOfMaps(map) => map.fd(), + Self::LpmTrie(map) => map.fd(), + Self::LruHashMap(map) => map.fd(), + Self::PerCpuArray(map) => map.fd(), + Self::PerCpuHashMap(map) => map.fd(), + Self::PerCpuLruHashMap(map) => map.fd(), + Self::PerfEventArray(map) => map.fd(), + Self::ProgramArray(map) => map.fd(), + Self::Queue(map) => map.fd(), + Self::RingBuf(map) => map.fd(), + Self::SockHash(map) => map.fd(), + Self::SockMap(map) => map.fd(), + Self::SkStorage(map) => map.fd(), + Self::Stack(map) => map.fd(), + Self::StackTraceMap(map) => map.fd(), + Self::Unsupported(map) => map.fd(), + Self::XskMap(map) => map.fd(), + Self::ReusePortSockArray(map) => map.fd(), + } + } } // Implements map pinning for different map implementations @@ -472,7 +573,8 @@ impl_map_pin!((K, V) { // Implements TryFrom for different map implementations. Different map implementations can be // constructed from different variants of the map enum. Also, the implementation may have type -// parameters (which we assume all have the bound `Pod` and nothing else). +// parameters. The dispatch arm adds `Pod` bounds explicitly before forwarding to the @impl arm, +// which accepts arbitrary bounds and is also used by impl_try_from_map_of_maps. macro_rules! impl_try_from_map { // At the root the type parameters are marked as a single token tree which will be pasted into // the invocation for each type. Note that the later patterns require that the token tree be @@ -488,23 +590,24 @@ macro_rules! impl_try_from_map { ($(#[$meta:meta])* <$ty_param:tt> $ty:ident) => { impl_try_from_map!($(#[$meta])* <$ty_param> $ty from $ty); }; - // Dispatch for each of the lifetimes. + // Dispatch for each of the lifetimes, adding Pod bounds explicitly. ( $(#[$meta:meta])* <($($ty_param:ident),*)> $ty:ident from $($variant:ident)|+ ) => { - impl_try_from_map!($(#[$meta])* <'a> ($($ty_param),*) $ty from $($variant)|+); - impl_try_from_map!($(#[$meta])* <'a mut> ($($ty_param),*) $ty from $($variant)|+); - impl_try_from_map!($(#[$meta])* <> ($($ty_param),*) $ty from $($variant)|+); + impl_try_from_map!(@impl $(#[$meta])* <'a> ($($ty_param: Pod),*) $ty from $($variant)|+); + impl_try_from_map!(@impl $(#[$meta])* <'a mut> ($($ty_param: Pod),*) $ty from $($variant)|+); + impl_try_from_map!(@impl $(#[$meta])* <> ($($ty_param: Pod),*) $ty from $($variant)|+); }; - // An individual impl. - ( + // An individual impl with explicit bounds. Used by both impl_try_from_map + // and impl_try_from_map_of_maps via the @impl internal rule. + (@impl $(#[$meta:meta])* <$($l:lifetime $($m:ident)?)?> - ($($ty_param:ident),*) + ($($ty_param:ident $(: $bound:path)?),*) $ty:ident from $($variant:ident)|+ ) => { $(#[$meta])* - impl<$($l,)? $($ty_param: Pod),*> TryFrom<$(&$l $($m)?)? Map> + impl<$($l,)? $($ty_param $(: $bound)?),*> TryFrom<$(&$l $($m)?)? Map> for $ty<$(&$l $($m)?)? MapData, $($ty_param),*> { type Error = MapError; @@ -550,6 +653,125 @@ impl_try_from_map!((K, V) { PerCpuHashMap from PerCpuHashMap|PerCpuLruHashMap, }); +// ArrayOfMaps and HashOfMaps require V: InnerMap in TryFrom conversions. +// Delegates to the @impl arm of impl_try_from_map to avoid duplicating the +// match body. +macro_rules! impl_try_from_map_of_maps { + ($ty:ident) => { + impl_try_from_map_of_maps!($ty <>); + }; + ($ty:ident <$($pre:ident : $pre_bound:path),*>) => { + impl_try_from_map!(@impl <'a> ($($pre: $pre_bound,)* V: InnerMap) $ty from $ty); + impl_try_from_map!(@impl <'a mut> ($($pre: $pre_bound,)* V: InnerMap) $ty from $ty); + impl_try_from_map!(@impl <> ($($pre: $pre_bound,)* V: InnerMap) $ty from $ty); + }; +} + +impl_try_from_map_of_maps!(ArrayOfMaps); +impl_try_from_map_of_maps!(HashOfMaps); + +// Implements `sealed::FromMapData` and `sealed::InnerMap` for a map type. +// Types with `inner: T` use the default arm; PerfEventArray and RingBuf +// pass `via map_data` to use their existing accessor method. +macro_rules! impl_from_map_data { + ($ty_param:tt { $($ty:ident),+ $(,)? }) => { + $(impl_from_map_data!(<$ty_param> $ty);)+ + }; + (<($($ty_param:ident),*)> $ty:ident via $accessor:ident) => { + impl<$($ty_param: Pod),*> sealed::FromMapData for $ty { + fn from_map_data(map_data: MapData) -> Result { + Self::new(map_data) + } + } + impl<$($ty_param: Pod),*> sealed::InnerMap for $ty { + fn fd(&self) -> &MapFd { + self.$accessor().fd() + } + } + }; + (<($($ty_param:ident),*)> $ty:ident) => { + impl<$($ty_param: Pod),*> sealed::FromMapData for $ty { + fn from_map_data(map_data: MapData) -> Result { + Self::new(map_data) + } + } + impl<$($ty_param: Pod),*> sealed::InnerMap for $ty { + fn fd(&self) -> &MapFd { + self.inner.fd() + } + } + }; +} + +// Map types that the kernel supports as inner maps. +// Excluded: ProgramArray (no map_meta_equal), ArrayOfMaps/HashOfMaps (multi-level nesting +// forbidden). +impl_from_map_data!(() { + CpuMap, DevMap, DevMapHash, + SockMap, StackTraceMap, XskMap, +}); + +// PerfEventArray and RingBuf use map_data() instead of inner field. +impl_from_map_data!(<()> PerfEventArray via map_data); +impl_from_map_data!(<()> RingBuf via map_data); + +impl_from_map_data!((V) { + Array, BloomFilter, PerCpuArray, + Queue, SockHash, SkStorage, Stack, +}); + +impl_from_map_data!((K, V) { + HashMap, LpmTrie, PerCpuHashMap, +}); + +impl sealed::FromMapData for MapData { + fn from_map_data(map_data: MapData) -> Result { + Ok(map_data) + } +} + +impl sealed::InnerMap for MapData { + fn fd(&self) -> &MapFd { + self.fd() + } +} + +impl sealed::InnerMap for MapFd { + fn fd(&self) -> &MapFd { + self + } +} + +macro_rules! impl_creatable_map { + ($ty:ident, $map_type:expr, $key_size:expr, $value_size:expr, $name:expr) => { + impl<$($p: Pod),*> sealed::CreatableMap for $ty { + fn create(max_entries: u32, flags: u32) -> Result { + let obj = aya_obj::Map::new_from_params( + $map_type as u32, $key_size, $value_size, max_entries, flags, + ); + Self::new(MapData::create(obj, $name, None)?) + } + } + }; +} + +impl_creatable_map!(Array, + bpf_map_type::BPF_MAP_TYPE_ARRAY, size_of::() as u32, size_of::() as u32, "standalone_array"); +impl_creatable_map!(PerCpuArray, + bpf_map_type::BPF_MAP_TYPE_PERCPU_ARRAY, size_of::() as u32, size_of::() as u32, "standalone_percpu_array"); +impl_creatable_map!(BloomFilter, + bpf_map_type::BPF_MAP_TYPE_BLOOM_FILTER, 0, size_of::() as u32, "standalone_bloom_filter"); +impl_creatable_map!(Queue, + bpf_map_type::BPF_MAP_TYPE_QUEUE, 0, size_of::() as u32, "standalone_queue"); +impl_creatable_map!(Stack, + bpf_map_type::BPF_MAP_TYPE_STACK, 0, size_of::() as u32, "standalone_stack"); +impl_creatable_map!(HashMap, + bpf_map_type::BPF_MAP_TYPE_HASH, size_of::() as u32, size_of::() as u32, "standalone_hash"); +impl_creatable_map!(PerCpuHashMap, + bpf_map_type::BPF_MAP_TYPE_PERCPU_HASH, size_of::() as u32, size_of::() as u32, "standalone_percpu_hash"); +impl_creatable_map!(LpmTrie, + bpf_map_type::BPF_MAP_TYPE_LPM_TRIE, size_of::>() as u32, size_of::() as u32, "standalone_lpm_trie"); + pub(crate) const fn check_bounds(map: &MapData, index: u32) -> Result<(), MapError> { let max_entries = map.obj.max_entries(); if index >= max_entries { @@ -594,9 +816,19 @@ pub struct MapData { impl MapData { /// Creates a new map with the provided `name` pub fn create( + obj: aya_obj::Map, + name: &str, + btf_fd: Option>, + ) -> Result { + Self::create_with_inner_map_fd(obj, name, btf_fd, None) + } + + /// Creates a new map with the provided `name` and optional `inner_map_fd` for map-of-maps types. + pub(crate) fn create_with_inner_map_fd( mut obj: aya_obj::Map, name: &str, btf_fd: Option>, + inner_map_fd: Option>, ) -> Result { let c_name = CString::new(name) .map_err(|std::ffi::NulError { .. }| MapError::InvalidName { name: name.into() })?; @@ -619,11 +851,12 @@ impl MapData { } } - let fd = - bpf_create_map(&c_name, &obj, btf_fd).map_err(|io_error| MapError::CreateError { + let fd = bpf_create_map(&c_name, &obj, btf_fd, inner_map_fd).map_err(|io_error| { + MapError::CreateError { name: name.into(), io_error, - })?; + } + })?; Ok(Self { obj, fd: MapFd::from_fd(fd), @@ -635,6 +868,7 @@ impl MapData { obj: aya_obj::Map, name: &str, btf_fd: Option>, + inner_map_obj: Option, ) -> Result { use std::os::unix::ffi::OsStrExt as _; @@ -658,7 +892,14 @@ impl MapData { fd: MapFd::from_fd(fd), }) } else { - let map = Self::create(obj, name, btf_fd)?; + let inner_map; + let inner_map_fd = if let Some(inner) = inner_map_obj { + inner_map = Self::create(inner, &format!("{name}.inner"), btf_fd)?; + Some(inner_map.fd().as_fd()) + } else { + None + }; + let map = Self::create_with_inner_map_fd(obj, name, btf_fd, inner_map_fd)?; map.pin(path).map_err(|error| MapError::PinError { name: Some(name.into()), error, @@ -1013,6 +1254,7 @@ mod test_utils { max_entries: 1024, ..Default::default() }, + inner_def: None, section_index: 0, section_kind: EbpfSectionKind::Maps, data: Vec::new(), @@ -1032,6 +1274,7 @@ mod test_utils { max_entries, ..Default::default() }, + inner_def: None, section_index: 0, section_kind: EbpfSectionKind::Maps, data: Vec::new(), diff --git a/aya/src/maps/of_maps/array.rs b/aya/src/maps/of_maps/array.rs new file mode 100644 index 0000000000..165c72e9a2 --- /dev/null +++ b/aya/src/maps/of_maps/array.rs @@ -0,0 +1,271 @@ +//! An array of eBPF maps. + +use std::{ + borrow::{Borrow, BorrowMut}, + fmt, + marker::PhantomData, + os::fd::{AsFd as _, AsRawFd as _}, + path::Path, +}; + +use crate::{ + maps::{FromMapData, InnerMap, MapData, MapError, PinError, check_bounds, check_kv_size}, + sys::{SyscallError, bpf_map_lookup_elem, bpf_map_update_elem}, +}; + +/// An array of eBPF maps. +/// +/// An `ArrayOfMaps` stores references to other eBPF maps. +/// +/// # Minimum kernel version +/// +/// The minimum kernel version required to use this feature is 4.12. +#[doc(alias = "BPF_MAP_TYPE_ARRAY_OF_MAPS")] +pub struct ArrayOfMaps { + pub(crate) inner: T, + _v: PhantomData, +} + +impl fmt::Debug for ArrayOfMaps { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("ArrayOfMaps") + .field("inner", &self.inner) + .finish() + } +} + +impl, V> ArrayOfMaps { + pub(crate) fn new(map: T) -> Result { + let data = map.borrow(); + check_kv_size::(data)?; + Ok(Self { + inner: map, + _v: PhantomData, + }) + } + + /// Returns the number of elements in the array. + /// + /// This corresponds to the value of `bpf_map_def::max_entries` on the eBPF side. + pub fn len(&self) -> u32 { + self.inner.borrow().obj.max_entries() + } + + /// Returns true if the array is empty. + pub fn is_empty(&self) -> bool { + self.len() == 0 + } +} + +impl, V: FromMapData> ArrayOfMaps { + /// Returns the inner map stored at the given index. + /// + /// The inner map type `V` is determined by the type parameter on the + /// `ArrayOfMaps` itself. + /// + /// # File descriptor cost + /// + /// Each call opens a **new file descriptor** to the inner map. The caller + /// owns the returned map and its FD is closed on drop. Avoid calling this + /// in a tight loop without dropping previous results. + /// + /// # Errors + /// + /// Returns [`MapError::OutOfBounds`] if `index` is out of bounds, [`MapError::SyscallError`] + /// if `bpf_map_lookup_elem` fails. + pub fn get(&self, index: &u32, flags: u64) -> Result { + let data = self.inner.borrow(); + check_bounds(data, *index)?; + let fd = data.fd().as_fd(); + + let value: Option = + bpf_map_lookup_elem(fd, index, flags).map_err(|io_error| SyscallError { + call: "bpf_map_lookup_elem", + io_error, + })?; + match value { + Some(id) => super::map_from_id(id), + None => Err(MapError::KeyNotFound), + } + } +} + +impl, V: InnerMap> ArrayOfMaps { + /// Sets the value of the element at the given index. + /// + /// # Errors + /// + /// Returns [`MapError::OutOfBounds`] if `index` is out of bounds, [`MapError::SyscallError`] + /// if `bpf_map_update_elem` fails. + pub fn set(&mut self, index: u32, value: &V, flags: u64) -> Result<(), MapError> { + let data = self.inner.borrow_mut(); + check_bounds(data, index)?; + let fd = data.fd().as_fd(); + bpf_map_update_elem(fd, Some(&index), &value.fd().as_fd().as_raw_fd(), flags).map_err( + |io_error| SyscallError { + call: "bpf_map_update_elem", + io_error, + }, + )?; + Ok(()) + } +} + +impl ArrayOfMaps { + /// Pins the map to a BPF filesystem. + /// + /// When a map is pinned it will remain loaded until the corresponding file + /// is deleted. All parent directories in the given `path` must already exist. + pub fn pin>(self, path: P) -> Result<(), PinError> { + self.inner.pin(path) + } +} + +#[cfg(test)] +mod tests { + use std::io; + + use assert_matches::assert_matches; + use aya_obj::generated::{bpf_cmd, bpf_map_type::BPF_MAP_TYPE_ARRAY_OF_MAPS}; + use libc::{EFAULT, ENOENT}; + + use super::*; + use crate::{ + maps::{Map, test_utils}, + sys::{SysResult, Syscall, override_syscall}, + }; + + fn new_obj_map() -> aya_obj::Map { + test_utils::new_obj_map::(BPF_MAP_TYPE_ARRAY_OF_MAPS) + } + + fn new_map(obj: aya_obj::Map) -> MapData { + test_utils::new_map(obj) + } + + fn sys_error(value: i32) -> SysResult { + Err((-1, io::Error::from_raw_os_error(value))) + } + + #[test] + fn test_wrong_key_size() { + let map = new_map(test_utils::new_obj_map::(BPF_MAP_TYPE_ARRAY_OF_MAPS)); + assert_matches!( + ArrayOfMaps::<_>::new(&map), + Err(MapError::InvalidKeySize { + size: 4, + expected: 1 + }) + ); + } + + #[test] + fn test_try_from_wrong_map() { + let map = new_map(test_utils::new_obj_map::( + aya_obj::generated::bpf_map_type::BPF_MAP_TYPE_HASH, + )); + let map = Map::HashMap(map); + assert_matches!( + ArrayOfMaps::<_>::try_from(&map), + Err(MapError::InvalidMapType { .. }) + ); + } + + #[test] + fn test_new_ok() { + let map = new_map(new_obj_map()); + let _: ArrayOfMaps<_> = ArrayOfMaps::new(&map).unwrap(); + } + + #[test] + fn test_set_syscall_error() { + let mut map = new_map(new_obj_map()); + let inner_map = new_map(test_utils::new_obj_map::( + aya_obj::generated::bpf_map_type::BPF_MAP_TYPE_ARRAY, + )); + let mut arr = ArrayOfMaps::new(&mut map).unwrap(); + + override_syscall(|_| sys_error(EFAULT)); + + assert_matches!( + arr.set(0, &inner_map, 0), + Err(MapError::SyscallError(SyscallError { + call: "bpf_map_update_elem", + .. + })) + ); + } + + #[test] + fn test_set_ok() { + let mut map = new_map(new_obj_map()); + let inner_map = new_map(test_utils::new_obj_map::( + aya_obj::generated::bpf_map_type::BPF_MAP_TYPE_ARRAY, + )); + let mut arr = ArrayOfMaps::new(&mut map).unwrap(); + + override_syscall(|call| match call { + Syscall::Ebpf { + cmd: bpf_cmd::BPF_MAP_UPDATE_ELEM, + .. + } => Ok(0), + _ => sys_error(EFAULT), + }); + + arr.set(0, &inner_map, 0).unwrap(); + } + + #[test] + fn test_set_out_of_bounds() { + let mut map = new_map(new_obj_map()); + let inner_map = new_map(test_utils::new_obj_map::( + aya_obj::generated::bpf_map_type::BPF_MAP_TYPE_ARRAY, + )); + let mut arr = ArrayOfMaps::new(&mut map).unwrap(); + + assert_matches!( + arr.set(1024, &inner_map, 0), + Err(MapError::OutOfBounds { .. }) + ); + } + + #[test] + fn test_get_syscall_error() { + let map = new_map(new_obj_map()); + let arr: ArrayOfMaps<_> = ArrayOfMaps::new(&map).unwrap(); + + override_syscall(|_| sys_error(EFAULT)); + + assert_matches!( + arr.get(&0, 0), + Err(MapError::SyscallError(SyscallError { + call: "bpf_map_lookup_elem", + .. + })) + ); + } + + #[test] + fn test_get_not_found() { + let map = new_map(new_obj_map()); + let arr: ArrayOfMaps<_> = ArrayOfMaps::new(&map).unwrap(); + + override_syscall(|call| match call { + Syscall::Ebpf { + cmd: bpf_cmd::BPF_MAP_LOOKUP_ELEM, + .. + } => sys_error(ENOENT), + _ => sys_error(EFAULT), + }); + + assert_matches!(arr.get(&0, 0), Err(MapError::KeyNotFound)); + } + + #[test] + fn test_get_out_of_bounds() { + let map = new_map(new_obj_map()); + let arr: ArrayOfMaps<_> = ArrayOfMaps::new(&map).unwrap(); + + assert_matches!(arr.get(&1024, 0), Err(MapError::OutOfBounds { .. })); + } +} diff --git a/aya/src/maps/of_maps/hash_map.rs b/aya/src/maps/of_maps/hash_map.rs new file mode 100644 index 0000000000..15fb2d8dc0 --- /dev/null +++ b/aya/src/maps/of_maps/hash_map.rs @@ -0,0 +1,284 @@ +//! A hash map of eBPF maps. + +use std::{ + borrow::{Borrow, BorrowMut}, + fmt, + marker::PhantomData, + os::fd::{AsFd as _, AsRawFd as _}, + path::Path, +}; + +use crate::{ + Pod, + maps::{FromMapData, InnerMap, MapData, MapError, MapKeys, PinError, check_kv_size, hash_map}, + sys::{SyscallError, bpf_map_lookup_elem}, +}; + +/// A hashmap of eBPF maps. +/// +/// A `HashOfMaps` stores references to other eBPF maps, keyed by an arbitrary key type. +/// +/// # Minimum kernel version +/// +/// The minimum kernel version required to use this feature is 4.12. +#[doc(alias = "BPF_MAP_TYPE_HASH_OF_MAPS")] +pub struct HashOfMaps { + pub(crate) inner: T, + _kv: PhantomData<(K, V)>, +} + +impl fmt::Debug for HashOfMaps { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("HashOfMaps") + .field("inner", &self.inner) + .finish() + } +} + +impl, K: Pod, V> HashOfMaps { + pub(crate) fn new(map: T) -> Result { + let data = map.borrow(); + check_kv_size::(data)?; + + Ok(Self { + inner: map, + _kv: PhantomData, + }) + } + + /// An iterator visiting all keys in arbitrary order. The iterator element + /// type is `Result`. + pub fn keys(&self) -> MapKeys<'_, K> { + MapKeys::new(self.inner.borrow()) + } +} + +impl, K: Pod, V: FromMapData> HashOfMaps { + /// Returns the inner map associated with the key. + /// + /// The inner map type `V` is determined by the type parameter on the + /// `HashOfMaps` itself. + /// + /// # File descriptor cost + /// + /// Each call opens a **new file descriptor** to the inner map. The caller + /// owns the returned map and its FD is closed on drop. Avoid calling this + /// in a tight loop without dropping previous results. + pub fn get(&self, key: &K, flags: u64) -> Result { + let fd = self.inner.borrow().fd().as_fd(); + let value: Option = + bpf_map_lookup_elem(fd, key, flags).map_err(|io_error| SyscallError { + call: "bpf_map_lookup_elem", + io_error, + })?; + match value { + Some(id) => super::map_from_id(id), + None => Err(MapError::KeyNotFound), + } + } +} + +impl, K: Pod, V: InnerMap> HashOfMaps { + /// Inserts a key-value pair into the map. + pub fn insert(&mut self, key: impl Borrow, value: &V, flags: u64) -> Result<(), MapError> { + hash_map::insert( + self.inner.borrow_mut(), + key.borrow(), + &value.fd().as_fd().as_raw_fd(), + flags, + ) + } +} + +impl, K: Pod, V> HashOfMaps { + /// Removes a key from the map. + pub fn remove(&mut self, key: &K) -> Result<(), MapError> { + hash_map::remove(self.inner.borrow_mut(), key) + } +} + +impl HashOfMaps { + /// Pins the map to a BPF filesystem. + /// + /// When a map is pinned it will remain loaded until the corresponding file + /// is deleted. All parent directories in the given `path` must already exist. + pub fn pin>(self, path: P) -> Result<(), PinError> { + self.inner.pin(path) + } +} + +#[cfg(test)] +mod tests { + use std::io; + + use assert_matches::assert_matches; + use aya_obj::generated::{bpf_cmd, bpf_map_type::BPF_MAP_TYPE_HASH_OF_MAPS}; + use libc::{EFAULT, ENOENT}; + + use super::*; + use crate::{ + maps::{Map, test_utils}, + sys::{SysResult, Syscall, override_syscall}, + }; + + fn new_obj_map() -> aya_obj::Map { + test_utils::new_obj_map::(BPF_MAP_TYPE_HASH_OF_MAPS) + } + + fn new_map(obj: aya_obj::Map) -> MapData { + test_utils::new_map(obj) + } + + fn sys_error(value: i32) -> SysResult { + Err((-1, io::Error::from_raw_os_error(value))) + } + + #[test] + fn test_wrong_key_size() { + let map = new_map(new_obj_map()); + assert_matches!( + HashOfMaps::<_, u8>::new(&map), + Err(MapError::InvalidKeySize { + size: 1, + expected: 4 + }) + ); + } + + #[test] + fn test_try_from_wrong_map() { + let map = new_map(test_utils::new_obj_map::( + aya_obj::generated::bpf_map_type::BPF_MAP_TYPE_HASH, + )); + let map = Map::HashMap(map); + assert_matches!( + HashOfMaps::<_, u32>::try_from(&map), + Err(MapError::InvalidMapType { .. }) + ); + } + + #[test] + fn test_new_ok() { + let map = new_map(new_obj_map()); + HashOfMaps::<_, u32>::new(&map).unwrap(); + } + + #[test] + fn test_insert_syscall_error() { + let mut map = new_map(new_obj_map()); + let inner_map = new_map(test_utils::new_obj_map::( + aya_obj::generated::bpf_map_type::BPF_MAP_TYPE_HASH, + )); + let mut hm = HashOfMaps::new(&mut map).unwrap(); + + override_syscall(|_| sys_error(EFAULT)); + + assert_matches!( + hm.insert(1u32, &inner_map, 0), + Err(MapError::SyscallError(SyscallError { + call: "bpf_map_update_elem", + .. + })) + ); + } + + #[test] + fn test_insert_ok() { + let mut map = new_map(new_obj_map()); + let inner_map = new_map(test_utils::new_obj_map::( + aya_obj::generated::bpf_map_type::BPF_MAP_TYPE_HASH, + )); + let mut hm = HashOfMaps::new(&mut map).unwrap(); + + override_syscall(|call| match call { + Syscall::Ebpf { + cmd: bpf_cmd::BPF_MAP_UPDATE_ELEM, + .. + } => Ok(0), + _ => sys_error(EFAULT), + }); + + hm.insert(1u32, &inner_map, 0).unwrap(); + } + + #[test] + fn test_remove_syscall_error() { + let mut map = new_map(new_obj_map()); + let mut hm = HashOfMaps::<_, u32>::new(&mut map).unwrap(); + + override_syscall(|_| sys_error(EFAULT)); + + assert_matches!( + hm.remove(&1u32), + Err(MapError::SyscallError(SyscallError { + call: "bpf_map_delete_elem", + .. + })) + ); + } + + #[test] + fn test_remove_ok() { + let mut map = new_map(new_obj_map()); + let mut hm = HashOfMaps::<_, u32>::new(&mut map).unwrap(); + + override_syscall(|call| match call { + Syscall::Ebpf { + cmd: bpf_cmd::BPF_MAP_DELETE_ELEM, + .. + } => Ok(0), + _ => sys_error(EFAULT), + }); + + hm.remove(&1u32).unwrap(); + } + + #[test] + fn test_get_syscall_error() { + let map = new_map(new_obj_map()); + let hm = HashOfMaps::<_, u32>::new(&map).unwrap(); + + override_syscall(|_| sys_error(EFAULT)); + + assert_matches!( + hm.get(&1u32, 0), + Err(MapError::SyscallError(SyscallError { + call: "bpf_map_lookup_elem", + .. + })) + ); + } + + #[test] + fn test_get_not_found() { + let map = new_map(new_obj_map()); + let hm = HashOfMaps::<_, u32>::new(&map).unwrap(); + + override_syscall(|call| match call { + Syscall::Ebpf { + cmd: bpf_cmd::BPF_MAP_LOOKUP_ELEM, + .. + } => sys_error(ENOENT), + _ => sys_error(EFAULT), + }); + + assert_matches!(hm.get(&1u32, 0), Err(MapError::KeyNotFound)); + } + + #[test] + fn test_keys_empty() { + let map = new_map(new_obj_map()); + let hm = HashOfMaps::<_, u32>::new(&map).unwrap(); + + override_syscall(|call| match call { + Syscall::Ebpf { + cmd: bpf_cmd::BPF_MAP_GET_NEXT_KEY, + .. + } => sys_error(ENOENT), + _ => sys_error(EFAULT), + }); + + let keys: Result, _> = hm.keys().collect(); + assert_matches!(keys, Ok(ks) if ks.is_empty()); + } +} diff --git a/aya/src/maps/of_maps/mod.rs b/aya/src/maps/of_maps/mod.rs new file mode 100644 index 0000000000..3da78763ba --- /dev/null +++ b/aya/src/maps/of_maps/mod.rs @@ -0,0 +1,18 @@ +//! Support for BPF maps that contain references to other maps. +mod array; +mod hash_map; + +pub use array::ArrayOfMaps; +pub use hash_map::HashOfMaps; + +use super::{FromMapData, MapData, MapError}; + +/// Converts a map ID returned by the kernel into a typed map. +/// +/// The kernel's map-of-maps API is asymmetric: update takes the FD of the inner map, +/// but lookup returns the ID. This helper converts the ID back to an FD and constructs +/// the typed map via [`FromMapData`]. +fn map_from_id(id: u32) -> Result { + let map_data = MapData::from_id(id)?; + M::from_map_data(map_data) +} diff --git a/aya/src/maps/perf/perf_event_array.rs b/aya/src/maps/perf/perf_event_array.rs index 03dc483a3b..ba6d104008 100644 --- a/aya/src/maps/perf/perf_event_array.rs +++ b/aya/src/maps/perf/perf_event_array.rs @@ -209,6 +209,10 @@ impl> PerfEventArray { let data: &MapData = self.map.deref().borrow(); data.pin(path) } + + pub(crate) fn map_data(&self) -> &MapData { + self.map.deref().borrow() + } } impl> PerfEventArray { diff --git a/aya/src/maps/ring_buf.rs b/aya/src/maps/ring_buf.rs index 94c8eda8ca..c3d8775550 100644 --- a/aya/src/maps/ring_buf.rs +++ b/aya/src/maps/ring_buf.rs @@ -109,6 +109,10 @@ impl> RingBuf { producer, }) } + + pub(crate) fn map_data(&self) -> &MapData { + self.map.borrow() + } } impl RingBuf { diff --git a/aya/src/sys/bpf.rs b/aya/src/sys/bpf.rs index 91e2d751c4..4679438c69 100644 --- a/aya/src/sys/bpf.rs +++ b/aya/src/sys/bpf.rs @@ -51,6 +51,7 @@ pub(crate) fn bpf_create_map( name: &CStr, def: &aya_obj::Map, btf_fd: Option>, + inner_map_fd: Option>, ) -> io::Result { let mut attr = unsafe { mem::zeroed::() }; @@ -62,6 +63,11 @@ pub(crate) fn bpf_create_map( u.map_flags = def.map_flags(); u.map_extra = def.map_extra(); + // For map-of-maps types, set the inner_map_fd. + if let Some(inner_fd) = inner_map_fd { + u.inner_map_fd = inner_fd.as_raw_fd() as u32; + } + if let aya_obj::Map::Btf(m) = def { // Mimic https://github.com/libbpf/libbpf/issues/355 // Currently a bunch of (usually pretty specialized) BPF maps do not support @@ -974,6 +980,7 @@ pub(crate) fn is_bpf_global_data_supported() -> bool { max_entries: 1, ..Default::default() }, + inner_def: None, section_index: 0, section_kind: EbpfSectionKind::Maps, symbol_index: None, @@ -1475,7 +1482,7 @@ bpf_map_type::BPF_MAP_TYPE_DEVMAP_HASH`"] let name = CString::new("FILTER").unwrap(); let btf_fd = unsafe { BorrowedFd::borrow_raw(BTF_FD) }; - bpf_create_map(&name, &map, Some(btf_fd)).unwrap(); + bpf_create_map(&name, &map, Some(btf_fd), None).unwrap(); } #[test_case(bpf_map_type::BPF_MAP_TYPE_PERF_EVENT_ARRAY ; "perf_event_array")] @@ -1520,6 +1527,6 @@ bpf_map_type::BPF_MAP_TYPE_DEVMAP_HASH`"] let name = CString::new("TEST").unwrap(); let btf_fd = unsafe { BorrowedFd::borrow_raw(BTF_FD) }; - bpf_create_map(&name, &map, Some(btf_fd)).unwrap(); + bpf_create_map(&name, &map, Some(btf_fd), None).unwrap(); } } diff --git a/ebpf/aya-ebpf/src/btf_maps/array.rs b/ebpf/aya-ebpf/src/btf_maps/array.rs index 75d0c43b0a..b86196d351 100644 --- a/ebpf/aya-ebpf/src/btf_maps/array.rs +++ b/ebpf/aya-ebpf/src/btf_maps/array.rs @@ -23,6 +23,13 @@ btf_map_def!( value_type: T, ); +impl crate::btf_maps::private::MapDef + for Array +{ + type Key = u32; + type Value = T; +} + impl Array { #[inline(always)] pub fn get(&self, index: u32) -> Option<&T> { diff --git a/ebpf/aya-ebpf/src/btf_maps/array_of_maps.rs b/ebpf/aya-ebpf/src/btf_maps/array_of_maps.rs new file mode 100644 index 0000000000..6d758ef948 --- /dev/null +++ b/ebpf/aya-ebpf/src/btf_maps/array_of_maps.rs @@ -0,0 +1,72 @@ +use core::ptr::NonNull; + +use crate::{btf_maps::btf_map_def, lookup}; + +btf_map_def!( + /// A BTF-compatible BPF map that stores references to other maps (array of maps). + /// + /// This map type allows you to store file descriptors of other BPF maps, + /// enabling dynamic map selection at runtime. + /// + /// # Minimum kernel version + /// + /// The minimum kernel version required to use this feature is 5.7. + /// + /// # Example + /// + /// ```rust,no_run + /// use aya_ebpf::{btf_maps::{Array, ArrayOfMaps}, macros::btf_map}; + /// + /// // The inner map definition is parsed from BTF at load time. + /// #[btf_map] + /// static OUTER: ArrayOfMaps, 4> = ArrayOfMaps::new(); + /// ``` + pub struct ArrayOfMaps, + map_type: BPF_MAP_TYPE_ARRAY_OF_MAPS, + max_entries: MAX_ENTRIES, + map_flags: FLAGS, + key_type: u32, + value_type: u32, + inner_map: V, +); + +impl ArrayOfMaps { + /// Retrieves a reference to the inner map at the given index. + /// + /// Returns `None` if the index is out of bounds or if no map is stored + /// at that index. + #[inline(always)] + pub fn get(&self, index: u32) -> Option<&V> { + // SAFETY: We only read from the map through BPF helpers. + // The struct fields are never accessed - only the address is used. + unsafe { self.lookup(index).map(|p| p.as_ref()) } + } + + #[inline(always)] + unsafe fn lookup(&self, index: u32) -> Option> { + lookup(self.as_ptr(), &index) + } +} + +impl + ArrayOfMaps +{ + /// Looks up a value directly in the inner map at `outer_index`. + /// + /// Performs both the outer and inner `bpf_map_lookup_elem` calls in a + /// single method, producing fewer BPF instructions between the two + /// helpers. This reduces verifier state explosion in tight loops. + #[inline(always)] + pub fn get_value(&self, outer_index: u32, inner_key: &V::Key) -> Option<&V::Value> { + let inner: NonNull = lookup(self.as_ptr(), &outer_index)?; + // SAFETY: Array lookups are safe (no BPF_F_NO_PREALLOC aliasing concern). + unsafe { crate::btf_maps::lookup_inner(inner, inner_key) } + } + + /// Same as [`get_value`](Self::get_value) but returns a mutable pointer. + #[inline(always)] + pub fn get_value_ptr_mut(&self, outer_index: u32, inner_key: &V::Key) -> Option<*mut V::Value> { + let inner: NonNull = lookup(self.as_ptr(), &outer_index)?; + crate::btf_maps::lookup_inner_ptr_mut(inner, inner_key) + } +} diff --git a/ebpf/aya-ebpf/src/btf_maps/bloom_filter.rs b/ebpf/aya-ebpf/src/btf_maps/bloom_filter.rs index f11a743415..d8d4be2fd9 100644 --- a/ebpf/aya-ebpf/src/btf_maps/bloom_filter.rs +++ b/ebpf/aya-ebpf/src/btf_maps/bloom_filter.rs @@ -26,7 +26,7 @@ btf_map_def!( map_flags: FLAGS, key_type: (), value_type: T, - map_extra: *const [i32; HASH_FUNCS], + map_extra: *const [i32; HASH_FUNCS] = ::core::ptr::null(), ); impl diff --git a/ebpf/aya-ebpf/src/btf_maps/hash_of_maps.rs b/ebpf/aya-ebpf/src/btf_maps/hash_of_maps.rs new file mode 100644 index 0000000000..0beac2778c --- /dev/null +++ b/ebpf/aya-ebpf/src/btf_maps/hash_of_maps.rs @@ -0,0 +1,88 @@ +use core::ptr::NonNull; + +use crate::{btf_maps::btf_map_def, lookup}; + +btf_map_def!( + /// A BTF-compatible BPF hash map that stores references to other maps (hash of maps). + /// + /// This map type allows you to store file descriptors of other BPF maps + /// indexed by arbitrary keys, enabling dynamic map selection at runtime. + /// + /// # Minimum kernel version + /// + /// The minimum kernel version required to use this feature is 5.7. + /// + /// # Example + /// + /// ```rust,no_run + /// use aya_ebpf::{btf_maps::{Array, HashOfMaps}, macros::btf_map}; + /// + /// // The inner map definition is parsed from BTF at load time. + /// #[btf_map] + /// static OUTER: HashOfMaps, 4> = HashOfMaps::new(); + /// ``` + pub struct HashOfMaps, + map_type: BPF_MAP_TYPE_HASH_OF_MAPS, + max_entries: MAX_ENTRIES, + map_flags: FLAGS, + key_type: K, + value_type: u32, + inner_map: V, +); + +impl HashOfMaps { + /// Retrieve the inner map associated with `key` from the map. + /// + /// # Safety + /// + /// This function is unsafe. Unless the map flag `BPF_F_NO_PREALLOC` is used, the kernel does not + /// make guarantee on the atomicity of `insert` or `remove`, and any element removed from the + /// map might get aliased by another element in the map, causing garbage to be read, or + /// corruption in case of writes. + #[inline(always)] + pub unsafe fn get(&self, key: &K) -> Option<&V> { + // SAFETY: We only read from the map through BPF helpers. + // The struct fields are never accessed - only the address is used. + unsafe { self.lookup(key).map(|p| p.as_ref()) } + } + + #[inline(always)] + unsafe fn lookup(&self, key: &K) -> Option> { + lookup(self.as_ptr(), key) + } +} + +impl + HashOfMaps +{ + /// Looks up a value directly in the inner map associated with `outer_key`. + /// + /// Performs both the outer and inner `bpf_map_lookup_elem` calls in a + /// single method, producing fewer BPF instructions between the two + /// helpers. This reduces verifier state explosion in tight loops. + /// + /// # Safety + /// + /// This function is unsafe for the same reasons as [`get`](Self::get). + #[inline(always)] + pub unsafe fn get_value(&self, outer_key: &K, inner_key: &V::Key) -> Option<&V::Value> { + let inner: NonNull = lookup(self.as_ptr(), outer_key)?; + // SAFETY: The caller upholds the aliasing invariants (see `get`). + unsafe { crate::btf_maps::lookup_inner(inner, inner_key) } + } + + /// Same as [`get_value`](Self::get_value) but returns a mutable pointer. + /// + /// # Safety + /// + /// See [`get_value`](Self::get_value). + #[inline(always)] + pub unsafe fn get_value_ptr_mut( + &self, + outer_key: &K, + inner_key: &V::Key, + ) -> Option<*mut V::Value> { + let inner: NonNull = lookup(self.as_ptr(), outer_key)?; + crate::btf_maps::lookup_inner_ptr_mut(inner, inner_key) + } +} diff --git a/ebpf/aya-ebpf/src/btf_maps/mod.rs b/ebpf/aya-ebpf/src/btf_maps/mod.rs index 394223df1c..8d0073bc09 100644 --- a/ebpf/aya-ebpf/src/btf_maps/mod.rs +++ b/ebpf/aya-ebpf/src/btf_maps/mod.rs @@ -1,5 +1,7 @@ pub mod array; +pub mod array_of_maps; pub mod bloom_filter; +pub mod hash_of_maps; pub mod lpm_trie; pub mod per_cpu_array; pub mod perf_event_array; @@ -13,7 +15,9 @@ pub mod sock_map; pub mod stack_trace; pub use array::Array; +pub use array_of_maps::ArrayOfMaps; pub use bloom_filter::BloomFilter; +pub use hash_of_maps::HashOfMaps; pub use lpm_trie::LpmTrie; pub use per_cpu_array::PerCpuArray; pub use perf_event_array::PerfEventArray; @@ -26,6 +30,56 @@ pub use sock_hash::SockHash; pub use sock_map::SockMap; pub use stack_trace::StackTrace; +mod private { + /// Sealed trait exposing the key and value types of a BTF map definition. + #[expect( + unnameable_types, + reason = "sealed trait pattern requires pub trait in private mod" + )] + pub trait MapDef { + /// The key type of this map. + type Key; + /// The value type of this map. + type Value; + } +} + +/// Key and value types of a BTF map definition. +/// +/// Used by map-of-maps types to perform fused lookups that combine the outer +/// and inner `bpf_map_lookup_elem` calls in a single method. +/// +/// This trait is sealed and cannot be implemented outside this crate. +pub trait MapDef: private::MapDef {} + +impl MapDef for T {} + +/// Performs the inner half of a fused map-of-maps lookup, returning a shared reference. +/// +/// # Safety +/// +/// The caller must ensure the returned reference does not alias a mutable +/// pointer obtained from the same map element. +#[inline(always)] +pub(crate) unsafe fn lookup_inner<'a, M: private::MapDef>( + inner_map: core::ptr::NonNull, + key: &M::Key, +) -> Option<&'a M::Value> { + // SAFETY: Both pointers are returned by BPF helpers and are valid for + // the duration of the program. We only produce a shared reference. + unsafe { crate::lookup::(inner_map.as_ptr().cast(), key).map(|p| p.as_ref()) } +} + +/// Same as [`lookup_inner`] but returns a mutable pointer. +#[inline(always)] +pub(crate) fn lookup_inner_ptr_mut( + inner_map: core::ptr::NonNull, + key: &M::Key, +) -> Option<*mut M::Value> { + crate::lookup::(inner_map.as_ptr().cast(), key) + .map(core::ptr::NonNull::as_ptr) +} + /// Defines a BTF-compatible map struct with flat `#[repr(C)]` layout. /// /// This macro generates a map definition struct that produces BTF metadata @@ -38,7 +92,60 @@ pub use stack_trace::StackTrace; /// Generics are an optional list of type parameters (with optional defaults) /// optionally followed by a semicolon and const parameters (with optional /// defaults). Lifetimes and bounds are not supported. +/// +/// # Map-of-maps support +/// +/// For map-of-maps types (`ArrayOfMaps`, `HashOfMaps`), add an `inner_map` clause: +/// +/// ```ignore +/// btf_map_def!( +/// pub struct HashOfMaps, +/// map_type: BPF_MAP_TYPE_HASH_OF_MAPS, +/// max_entries: MAX_ENTRIES, +/// map_flags: FLAGS, +/// key_type: K, +/// value_type: u32, +/// inner_map: V, +/// ); +/// ``` +/// +/// This generates a `values: [*const V; 0]` field for BTF relocation. The inner +/// map type `V` is encoded in BTF so that loaders can resolve the inner map +/// template. macro_rules! btf_map_def { + // Map-of-maps (with inner_map) - rewrites into the regular arm with a + // `values` extra field whose initializer is `[]` (a zero-length array). + ( + $(#[$attr:meta])* + $vis:vis struct $name:ident< + $($ty_gen:ident $(= $ty_default:ty)?),+ + $(; $(const $const_gen:ident : $const_ty:ty $(= $const_default:tt)?),+)? + $(,)? + >, + map_type: $map_type:ident, + max_entries: $max_entries:expr, + map_flags: $map_flags:expr, + key_type: $key_ty:ty, + value_type: $value_ty:ty, + inner_map: $inner_ty:ty + $(,)? + ) => { + $crate::btf_maps::btf_map_def!( + $(#[$attr])* + $vis struct $name< + $($ty_gen $(= $ty_default)?),+ + $(; $(const $const_gen : $const_ty $(= $const_default)?),+)? + >, + map_type: $map_type, + max_entries: $max_entries, + map_flags: $map_flags, + key_type: $key_ty, + value_type: $value_ty, + values: [*const $inner_ty; 0] = [] + ); + }; + + // Regular map (with optional extra fields and initializers) ( $(#[$attr:meta])* $vis:vis struct $name:ident< @@ -51,7 +158,7 @@ macro_rules! btf_map_def { map_flags: $map_flags:expr, key_type: $key_ty:ty, value_type: $value_ty:ty - $(, $extra_field:ident : $extra_ty:ty)* + $(, $extra_field:ident : $extra_ty:ty = $extra_init:expr)* $(,)? ) => { $(#[$attr])* @@ -108,7 +215,7 @@ macro_rules! btf_map_def { max_entries: ::core::ptr::null(), map_flags: ::core::ptr::null(), - $($extra_field: ::core::ptr::null(),)* + $($extra_field: $extra_init,)* } } diff --git a/ebpf/aya-ebpf/src/btf_maps/ring_buf.rs b/ebpf/aya-ebpf/src/btf_maps/ring_buf.rs index 512b7797ea..1443e97366 100644 --- a/ebpf/aya-ebpf/src/btf_maps/ring_buf.rs +++ b/ebpf/aya-ebpf/src/btf_maps/ring_buf.rs @@ -18,7 +18,7 @@ btf_map_def!( map_flags: FLAGS, key_type: (), value_type: T, - value_size: *const [i32; 0], + value_size: *const [i32; 0] = ::core::ptr::null(), ); impl RingBuf { diff --git a/ebpf/aya-ebpf/src/maps/array.rs b/ebpf/aya-ebpf/src/maps/array.rs index 05fc608e54..26b9990615 100644 --- a/ebpf/aya-ebpf/src/maps/array.rs +++ b/ebpf/aya-ebpf/src/maps/array.rs @@ -12,6 +12,11 @@ pub struct Array { _t: PhantomData, } +impl super::private::Map for Array { + type Key = u32; + type Value = T; +} + impl Array { map_constructors!(u32, T, BPF_MAP_TYPE_ARRAY, phantom _t); diff --git a/ebpf/aya-ebpf/src/maps/bloom_filter.rs b/ebpf/aya-ebpf/src/maps/bloom_filter.rs index 30ed357c7a..d7460b85b4 100644 --- a/ebpf/aya-ebpf/src/maps/bloom_filter.rs +++ b/ebpf/aya-ebpf/src/maps/bloom_filter.rs @@ -12,6 +12,11 @@ pub struct BloomFilter { _t: PhantomData, } +impl super::private::Map for BloomFilter { + type Key = (); + type Value = T; +} + impl BloomFilter { map_constructors!((), T, BPF_MAP_TYPE_BLOOM_FILTER, phantom _t); diff --git a/ebpf/aya-ebpf/src/maps/hash_map.rs b/ebpf/aya-ebpf/src/maps/hash_map.rs index 705edee580..07fd751c47 100644 --- a/ebpf/aya-ebpf/src/maps/hash_map.rs +++ b/ebpf/aya-ebpf/src/maps/hash_map.rs @@ -16,6 +16,11 @@ macro_rules! define_hash_map { _kv: PhantomData<(K, V)>, } + impl $crate::maps::private::Map for $name { + type Key = K; + type Value = V; + } + impl $name { pub const fn with_max_entries(max_entries: u32, flags: u32) -> Self { Self::new(max_entries, flags, PinningType::None) diff --git a/ebpf/aya-ebpf/src/maps/lpm_trie.rs b/ebpf/aya-ebpf/src/maps/lpm_trie.rs index d76a2bbee4..6b61afdeed 100644 --- a/ebpf/aya-ebpf/src/maps/lpm_trie.rs +++ b/ebpf/aya-ebpf/src/maps/lpm_trie.rs @@ -15,6 +15,11 @@ pub struct LpmTrie { _kv: PhantomData<(K, V)>, } +impl super::private::Map for LpmTrie { + type Key = Key; + type Value = V; +} + #[repr(C, packed)] pub struct Key { /// Represents the number of bits matched against. diff --git a/ebpf/aya-ebpf/src/maps/mod.rs b/ebpf/aya-ebpf/src/maps/mod.rs index b71af653f8..6b6ab329ec 100644 --- a/ebpf/aya-ebpf/src/maps/mod.rs +++ b/ebpf/aya-ebpf/src/maps/mod.rs @@ -17,6 +17,7 @@ pub(crate) mod def { unsafe impl Sync for MapDef {} impl MapDef { + /// Creates a new map definition with key type `K` and value type `V`. pub(crate) const fn new( type_: u32, max_entries: u32, @@ -106,3 +107,24 @@ pub use sock_map::SockMap; pub use stack::Stack; pub use stack_trace::StackTrace; pub use xdp::{CpuMap, DevMap, DevMapHash, XskMap}; + +mod private { + /// Sealed trait to prevent external implementations of [`super::Map`]. + #[expect( + unnameable_types, + reason = "sealed trait pattern requires pub trait in private mod" + )] + pub trait Map { + /// The key type declared in this map's definition. + type Key; + /// The value type declared in this map's definition. + type Value; + } +} + +/// Marker trait for all eBPF maps that can be used in a map of maps. +/// +/// This trait is sealed and cannot be implemented outside this crate. +pub trait Map: private::Map {} + +impl Map for T {} diff --git a/ebpf/aya-ebpf/src/maps/per_cpu_array.rs b/ebpf/aya-ebpf/src/maps/per_cpu_array.rs index 8283203dc2..8cc93d762e 100644 --- a/ebpf/aya-ebpf/src/maps/per_cpu_array.rs +++ b/ebpf/aya-ebpf/src/maps/per_cpu_array.rs @@ -12,6 +12,11 @@ pub struct PerCpuArray { _t: PhantomData, } +impl super::private::Map for PerCpuArray { + type Key = u32; + type Value = T; +} + impl PerCpuArray { map_constructors!(u32, T, BPF_MAP_TYPE_PERCPU_ARRAY, phantom _t); diff --git a/ebpf/aya-ebpf/src/maps/queue.rs b/ebpf/aya-ebpf/src/maps/queue.rs index 4854f459d1..595e9e3588 100644 --- a/ebpf/aya-ebpf/src/maps/queue.rs +++ b/ebpf/aya-ebpf/src/maps/queue.rs @@ -12,6 +12,11 @@ pub struct Queue { _t: PhantomData, } +impl super::private::Map for Queue { + type Key = (); + type Value = T; +} + impl Queue { map_constructors!((), T, BPF_MAP_TYPE_QUEUE, phantom _t); diff --git a/ebpf/aya-ebpf/src/maps/ring_buf.rs b/ebpf/aya-ebpf/src/maps/ring_buf.rs index f0bf8dc08c..dd66cdbbbb 100644 --- a/ebpf/aya-ebpf/src/maps/ring_buf.rs +++ b/ebpf/aya-ebpf/src/maps/ring_buf.rs @@ -21,6 +21,11 @@ pub struct RingBuf { def: MapDef, } +impl super::private::Map for RingBuf { + type Key = (); + type Value = (); +} + /// A ring buffer entry, returned from [`RingBuf::reserve_bytes`]. /// /// You must [`submit`] or [`discard`] this entry before it gets dropped. diff --git a/ebpf/aya-ebpf/src/maps/sock_hash.rs b/ebpf/aya-ebpf/src/maps/sock_hash.rs index 3ce23c991d..e7f2290d37 100644 --- a/ebpf/aya-ebpf/src/maps/sock_hash.rs +++ b/ebpf/aya-ebpf/src/maps/sock_hash.rs @@ -23,6 +23,11 @@ pub struct SockHash { _k: PhantomData, } +impl super::private::Map for SockHash { + type Key = K; + type Value = u32; +} + impl SockHash { map_constructors!(K, u32, BPF_MAP_TYPE_SOCKHASH, phantom _k); diff --git a/ebpf/aya-ebpf/src/maps/sock_map.rs b/ebpf/aya-ebpf/src/maps/sock_map.rs index 486e51a0e6..fee7b65719 100644 --- a/ebpf/aya-ebpf/src/maps/sock_map.rs +++ b/ebpf/aya-ebpf/src/maps/sock_map.rs @@ -16,6 +16,11 @@ pub struct SockMap { def: MapDef, } +impl super::private::Map for SockMap { + type Key = u32; + type Value = u32; +} + impl SockMap { map_constructors!(u32, u32, BPF_MAP_TYPE_SOCKMAP); diff --git a/ebpf/aya-ebpf/src/maps/stack.rs b/ebpf/aya-ebpf/src/maps/stack.rs index 28d4e781e4..ab9b74f241 100644 --- a/ebpf/aya-ebpf/src/maps/stack.rs +++ b/ebpf/aya-ebpf/src/maps/stack.rs @@ -12,6 +12,11 @@ pub struct Stack { _t: PhantomData, } +impl super::private::Map for Stack { + type Key = (); + type Value = T; +} + impl Stack { map_constructors!((), T, BPF_MAP_TYPE_STACK, phantom _t); diff --git a/ebpf/aya-ebpf/src/maps/stack_trace.rs b/ebpf/aya-ebpf/src/maps/stack_trace.rs index 9604a756dc..6afe3b7322 100644 --- a/ebpf/aya-ebpf/src/maps/stack_trace.rs +++ b/ebpf/aya-ebpf/src/maps/stack_trace.rs @@ -10,6 +10,11 @@ pub struct StackTrace { def: MapDef, } +impl super::private::Map for StackTrace { + type Key = u32; + type Value = [u64; PERF_MAX_STACK_DEPTH as usize]; +} + impl StackTrace { map_constructors!( u32, diff --git a/ebpf/aya-ebpf/src/maps/xdp/cpu_map.rs b/ebpf/aya-ebpf/src/maps/xdp/cpu_map.rs index df85c42e70..bccf12d6ed 100644 --- a/ebpf/aya-ebpf/src/maps/xdp/cpu_map.rs +++ b/ebpf/aya-ebpf/src/maps/xdp/cpu_map.rs @@ -33,6 +33,11 @@ pub struct CpuMap { def: MapDef, } +impl super::super::private::Map for CpuMap { + type Key = u32; + type Value = bpf_cpumap_val; +} + impl CpuMap { map_constructors!( u32, diff --git a/ebpf/aya-ebpf/src/maps/xdp/dev_map.rs b/ebpf/aya-ebpf/src/maps/xdp/dev_map.rs index 68b38fa649..c05920a11d 100644 --- a/ebpf/aya-ebpf/src/maps/xdp/dev_map.rs +++ b/ebpf/aya-ebpf/src/maps/xdp/dev_map.rs @@ -35,6 +35,11 @@ pub struct DevMap { def: MapDef, } +impl super::super::private::Map for DevMap { + type Key = u32; + type Value = bpf_devmap_val; +} + impl DevMap { map_constructors!( u32, diff --git a/ebpf/aya-ebpf/src/maps/xdp/dev_map_hash.rs b/ebpf/aya-ebpf/src/maps/xdp/dev_map_hash.rs index 1ab835388f..2f9a7845f5 100644 --- a/ebpf/aya-ebpf/src/maps/xdp/dev_map_hash.rs +++ b/ebpf/aya-ebpf/src/maps/xdp/dev_map_hash.rs @@ -37,6 +37,11 @@ pub struct DevMapHash { def: MapDef, } +impl super::super::private::Map for DevMapHash { + type Key = u32; + type Value = bpf_devmap_val; +} + impl DevMapHash { map_constructors!( u32, diff --git a/ebpf/aya-ebpf/src/maps/xdp/xsk_map.rs b/ebpf/aya-ebpf/src/maps/xdp/xsk_map.rs index 8909d7e394..67b8ddcc51 100644 --- a/ebpf/aya-ebpf/src/maps/xdp/xsk_map.rs +++ b/ebpf/aya-ebpf/src/maps/xdp/xsk_map.rs @@ -54,6 +54,11 @@ pub struct XskMap { def: MapDef, } +impl super::super::private::Map for XskMap { + type Key = u32; + type Value = u32; +} + impl XskMap { map_constructors!( u32, diff --git a/test/integration-common/src/lib.rs b/test/integration-common/src/lib.rs index b0ad3aceb0..62e7a6eb3d 100644 --- a/test/integration-common/src/lib.rs +++ b/test/integration-common/src/lib.rs @@ -119,6 +119,18 @@ pub mod printk { pub const TEST_ISIZE: isize = isize::MIN; } +pub mod btf_map_of_maps { + #[derive(Copy, Clone, Debug, Eq, PartialEq)] + #[repr(C)] + pub struct TestResult { + pub value: u32, + pub ran: u32, + } + + #[cfg(feature = "user")] + unsafe impl aya::Pod for TestResult {} +} + pub mod sk_storage { #[derive(Clone, Copy, Debug, Eq, PartialEq)] #[repr(C)] diff --git a/test/integration-ebpf/Cargo.toml b/test/integration-ebpf/Cargo.toml index d58ae7003c..467b513ba3 100644 --- a/test/integration-ebpf/Cargo.toml +++ b/test/integration-ebpf/Cargo.toml @@ -163,3 +163,7 @@ path = "src/stack_trace.rs" [[bin]] name = "stack_trace_lsm" path = "src/stack_trace_lsm.rs" + +[[bin]] +name = "btf_map_of_maps" +path = "src/btf_map_of_maps.rs" diff --git a/test/integration-ebpf/src/btf_map_of_maps.rs b/test/integration-ebpf/src/btf_map_of_maps.rs new file mode 100644 index 0000000000..0b0bf7a37a --- /dev/null +++ b/test/integration-ebpf/src/btf_map_of_maps.rs @@ -0,0 +1,132 @@ +#![no_std] +#![no_main] +#![expect(unused_crate_dependencies, reason = "used in other bins")] + +//! BTF-compatible map-of-maps tests. +//! +//! Uses BTF map definitions compatible with both aya and libbpf loaders. + +use aya_ebpf::{ + btf_maps::{Array, ArrayOfMaps, HashOfMaps}, + macros::{btf_map, uprobe}, + programs::ProbeContext, +}; +use integration_common::btf_map_of_maps::TestResult; + +#[cfg(not(test))] +extern crate ebpf_panic; + +#[btf_map] +static ARRAY_OF_MAPS: ArrayOfMaps, 4> = ArrayOfMaps::new(); + +#[btf_map] +static HASH_OF_MAPS: HashOfMaps, 4> = HashOfMaps::new(); + +#[btf_map] +static RESULTS: Array = Array::new(); + +#[unsafe(no_mangle)] +#[inline(never)] +pub const extern "C" fn trigger_btf_array_of_maps() { + core::hint::black_box(()); +} + +#[unsafe(no_mangle)] +#[inline(never)] +pub const extern "C" fn trigger_btf_hash_of_maps() { + core::hint::black_box(()); +} + +#[unsafe(no_mangle)] +#[inline(never)] +pub const extern "C" fn trigger_btf_array_of_maps_get_value() { + core::hint::black_box(()); +} + +#[unsafe(no_mangle)] +#[inline(never)] +pub const extern "C" fn trigger_btf_hash_of_maps_get_value() { + core::hint::black_box(()); +} + +/// Test `ArrayOfMaps`: read a value from an inner array via the outer map. +#[uprobe] +pub(crate) fn test_btf_array_of_maps(_ctx: ProbeContext) -> u32 { + if let Some(ptr) = RESULTS.get_ptr_mut(0) { + if let Some(inner) = ARRAY_OF_MAPS.get(0) { + if let Some(val) = inner.get(0) { + unsafe { + (*ptr).value = *val; + } + } + } + unsafe { + (*ptr).ran = 1; + } + } + 0 +} + +/// Test `HashOfMaps`: read a value from an inner array via the outer hash map. +#[uprobe] +pub(crate) fn test_btf_hash_of_maps(_ctx: ProbeContext) -> u32 { + if let Some(ptr) = RESULTS.get_ptr_mut(1) { + if let Some(inner) = unsafe { HASH_OF_MAPS.get(&0u32) } { + if let Some(val) = inner.get(0) { + unsafe { + (*ptr).value = *val; + } + } + } + unsafe { + (*ptr).ran = 1; + } + } + 0 +} + +/// Test `ArrayOfMaps::get_value` and `get_value_ptr_mut`. +#[uprobe] +pub(crate) fn test_btf_array_of_maps_get_value(_ctx: ProbeContext) -> u32 { + if let Some(ptr) = RESULTS.get_ptr_mut(2) { + if let Some(val) = ARRAY_OF_MAPS.get_value(0, &0u32) { + unsafe { + (*ptr).value = *val; + } + } + unsafe { + (*ptr).ran = 1; + } + } + + if let Some(ptr) = ARRAY_OF_MAPS.get_value_ptr_mut(1, &0u32) { + unsafe { + *ptr = 99; + } + } + + 0 +} + +/// Test `HashOfMaps::get_value` and `get_value_ptr_mut`. +#[uprobe] +pub(crate) fn test_btf_hash_of_maps_get_value(_ctx: ProbeContext) -> u32 { + if let Some(ptr) = RESULTS.get_ptr_mut(3) { + if let Some(val) = unsafe { HASH_OF_MAPS.get_value(&0u32, &0u32) } { + unsafe { + (*ptr).value = *val; + } + } + unsafe { + (*ptr).ran = 1; + } + } + + if let Some(ptr) = unsafe { HASH_OF_MAPS.get_value_ptr_mut(&1u32, &0u32) } { + unsafe { + *ptr = 88; + } + } + + 0 +} diff --git a/test/integration-test/src/lib.rs b/test/integration-test/src/lib.rs index 499e5a5025..a94fb7af63 100644 --- a/test/integration-test/src/lib.rs +++ b/test/integration-test/src/lib.rs @@ -74,6 +74,7 @@ bpf_file!( PROG_ARRAY => "prog_array", STACK_TRACE => "stack_trace", STACK_TRACE_LSM => "stack_trace_lsm", + BTF_MAP_OF_MAPS => "btf_map_of_maps", ); #[cfg(test)] diff --git a/test/integration-test/src/tests.rs b/test/integration-test/src/tests.rs index 844cf660ce..9fe08ad630 100644 --- a/test/integration-test/src/tests.rs +++ b/test/integration-test/src/tests.rs @@ -11,6 +11,7 @@ mod array; mod bloom_filter; mod bpf_probe_read; +mod btf_map_of_maps; mod btf_maps; mod btf_relocations; mod elf; diff --git a/test/integration-test/src/tests/btf_map_of_maps.rs b/test/integration-test/src/tests/btf_map_of_maps.rs new file mode 100644 index 0000000000..7f08b65d2f --- /dev/null +++ b/test/integration-test/src/tests/btf_map_of_maps.rs @@ -0,0 +1,178 @@ +use aya::{ + Ebpf, + maps::{Array, ArrayOfMaps, CreatableMap as _, HashOfMaps, MapData}, + programs::{UProbe, uprobe::UProbeScope}, +}; + +/// Loads and attaches a uprobe from the BTF map-of-maps test binary. +/// +/// The program name is `test_{name}` and the trigger symbol is `trigger_{name}`. +fn load_and_attach(ebpf: &mut Ebpf, name: &str) { + let prog: &mut UProbe = ebpf + .program_mut(&format!("test_{name}")) + .unwrap() + .try_into() + .unwrap(); + prog.load().unwrap(); + prog.attach( + format!("trigger_{name}").as_str(), + "/proc/self/exe", + UProbeScope::AllProcesses, + ) + .unwrap(); +} + +/// Reads `RESULTS[index]` and asserts `value` and `ran == 1`. +fn assert_result(ebpf: &Ebpf, index: u32, expected_value: u32) { + let results: Array<&MapData, integration_common::btf_map_of_maps::TestResult> = + ebpf.map("RESULTS").unwrap().try_into().unwrap(); + let result = results.get(&index, 0).unwrap(); + assert_eq!(result.value, expected_value, "RESULTS[{index}].value"); + assert_eq!(result.ran, 1, "RESULTS[{index}].ran"); +} + +#[unsafe(no_mangle)] +#[inline(never)] +extern "C" fn trigger_btf_array_of_maps() { + std::hint::black_box(()); +} + +#[unsafe(no_mangle)] +#[inline(never)] +extern "C" fn trigger_btf_hash_of_maps() { + std::hint::black_box(()); +} + +#[unsafe(no_mangle)] +#[inline(never)] +extern "C" fn trigger_btf_array_of_maps_get_value() { + std::hint::black_box(()); +} + +#[unsafe(no_mangle)] +#[inline(never)] +extern "C" fn trigger_btf_hash_of_maps_get_value() { + std::hint::black_box(()); +} + +/// Test BTF `ArrayOfMaps`: insert inner maps and verify eBPF can read them. +#[test_log::test] +fn btf_array_of_maps() { + let mut ebpf = Ebpf::load(crate::BTF_MAP_OF_MAPS).unwrap(); + + let mut inner_array: Array = Array::create(10, 0).unwrap(); + inner_array.set(0, 42u32, 0).unwrap(); + + { + let mut outer: ArrayOfMaps<&mut MapData, Array> = + ebpf.map_mut("ARRAY_OF_MAPS").unwrap().try_into().unwrap(); + outer.set(0, &inner_array, 0).unwrap(); + } + + load_and_attach(&mut ebpf, "btf_array_of_maps"); + trigger_btf_array_of_maps(); + assert_result(&ebpf, 0, 42); +} + +/// Test BTF `HashOfMaps`: insert inner maps and verify eBPF can read them. +#[test_log::test] +fn btf_hash_of_maps() { + let mut ebpf = Ebpf::load(crate::BTF_MAP_OF_MAPS).unwrap(); + + let mut inner_array: Array = Array::create(10, 0).unwrap(); + inner_array.set(0, 55u32, 0).unwrap(); + + { + let mut outer: HashOfMaps<&mut MapData, u32, Array> = + ebpf.map_mut("HASH_OF_MAPS").unwrap().try_into().unwrap(); + outer.insert(0u32, &inner_array, 0).unwrap(); + } + + load_and_attach(&mut ebpf, "btf_hash_of_maps"); + trigger_btf_hash_of_maps(); + assert_result(&ebpf, 1, 55); +} + +/// Test BTF `ArrayOfMaps::get_value` and `get_value_ptr_mut`. +#[test_log::test] +fn btf_array_of_maps_get_value() { + let mut ebpf = Ebpf::load(crate::BTF_MAP_OF_MAPS).unwrap(); + + let mut inner_1: Array = Array::create(10, 0).unwrap(); + inner_1.set(0, 77u32, 0).unwrap(); + + let mut inner_2: Array = Array::create(10, 0).unwrap(); + inner_2.set(0, 0u32, 0).unwrap(); + + { + let mut outer: ArrayOfMaps<&mut MapData, Array> = + ebpf.map_mut("ARRAY_OF_MAPS").unwrap().try_into().unwrap(); + outer.set(0, &inner_1, 0).unwrap(); + outer.set(1, &inner_2, 0).unwrap(); + } + + load_and_attach(&mut ebpf, "btf_array_of_maps_get_value"); + trigger_btf_array_of_maps_get_value(); + + // get_value should have read inner_1[0] == 77. + assert_result(&ebpf, 2, 77); + + // get_value_ptr_mut should have written 99 to inner_2[0]. + assert_eq!(inner_2.get(&0, 0).unwrap(), 99); +} + +/// Test BTF `HashOfMaps::get_value` and `get_value_ptr_mut`. +#[test_log::test] +fn btf_hash_of_maps_get_value() { + let mut ebpf = Ebpf::load(crate::BTF_MAP_OF_MAPS).unwrap(); + + let mut inner_1: Array = Array::create(10, 0).unwrap(); + inner_1.set(0, 55u32, 0).unwrap(); + + let mut inner_2: Array = Array::create(10, 0).unwrap(); + inner_2.set(0, 0u32, 0).unwrap(); + + { + let mut outer: HashOfMaps<&mut MapData, u32, Array> = + ebpf.map_mut("HASH_OF_MAPS").unwrap().try_into().unwrap(); + outer.insert(0u32, &inner_1, 0).unwrap(); + outer.insert(1u32, &inner_2, 0).unwrap(); + } + + load_and_attach(&mut ebpf, "btf_hash_of_maps_get_value"); + trigger_btf_hash_of_maps_get_value(); + + // get_value should have read inner_1[0] == 55. + assert_result(&ebpf, 3, 55); + + // get_value_ptr_mut should have written 88 to inner_2[0]. + assert_eq!(inner_2.get(&0, 0).unwrap(), 88); +} + +/// Test dynamic inner map creation with `HashOfMaps`. +#[test_log::test] +fn btf_hash_of_maps_dynamic() { + let mut ebpf = Ebpf::load(crate::BTF_MAP_OF_MAPS).unwrap(); + + // Create inner maps dynamically matching the BTF inner definition (Array). + let mut inner_1: Array = Array::create(10, 0).unwrap(); + let mut inner_2: Array = Array::create(10, 0).unwrap(); + + inner_1.set(0, 1000u32, 0).unwrap(); + inner_2.set(0, 2000u32, 0).unwrap(); + + { + let mut outer: HashOfMaps<&mut MapData, u32, Array> = + ebpf.map_mut("HASH_OF_MAPS").unwrap().try_into().unwrap(); + outer.insert(10u32, &inner_1, 0).unwrap(); + outer.insert(11u32, &inner_2, 0).unwrap(); + } + + // Verify data persists after insertion into the outer map. + assert_eq!(inner_1.get(&0, 0).unwrap(), 1000); + assert_eq!(inner_2.get(&0, 0).unwrap(), 2000); + + // Modify and verify changes persist. + inner_1.set(1, 3000u32, 0).unwrap(); + assert_eq!(inner_1.get(&1, 0).unwrap(), 3000); +} diff --git a/xtask/public-api/aya-ebpf-bindings.txt b/xtask/public-api/aya-ebpf-bindings.txt index ad42903ef2..ba7db155d2 100644 --- a/xtask/public-api/aya-ebpf-bindings.txt +++ b/xtask/public-api/aya-ebpf-bindings.txt @@ -3340,27 +3340,6 @@ impl core::marker::UnsafeUnpin for aya_ebpf_bindings::bindings::path impl core::panic::unwind_safe::RefUnwindSafe for aya_ebpf_bindings::bindings::path impl core::panic::unwind_safe::UnwindSafe for aya_ebpf_bindings::bindings::path #[repr(C)] pub struct aya_ebpf_bindings::bindings::pt_regs -pub aya_ebpf_bindings::bindings::pt_regs::cs: aya_ebpf_cty::od::c_ulong -pub aya_ebpf_bindings::bindings::pt_regs::eflags: aya_ebpf_cty::od::c_ulong -pub aya_ebpf_bindings::bindings::pt_regs::orig_rax: aya_ebpf_cty::od::c_ulong -pub aya_ebpf_bindings::bindings::pt_regs::r10: aya_ebpf_cty::od::c_ulong -pub aya_ebpf_bindings::bindings::pt_regs::r11: aya_ebpf_cty::od::c_ulong -pub aya_ebpf_bindings::bindings::pt_regs::r12: aya_ebpf_cty::od::c_ulong -pub aya_ebpf_bindings::bindings::pt_regs::r13: aya_ebpf_cty::od::c_ulong -pub aya_ebpf_bindings::bindings::pt_regs::r14: aya_ebpf_cty::od::c_ulong -pub aya_ebpf_bindings::bindings::pt_regs::r15: aya_ebpf_cty::od::c_ulong -pub aya_ebpf_bindings::bindings::pt_regs::r8: aya_ebpf_cty::od::c_ulong -pub aya_ebpf_bindings::bindings::pt_regs::r9: aya_ebpf_cty::od::c_ulong -pub aya_ebpf_bindings::bindings::pt_regs::rax: aya_ebpf_cty::od::c_ulong -pub aya_ebpf_bindings::bindings::pt_regs::rbp: aya_ebpf_cty::od::c_ulong -pub aya_ebpf_bindings::bindings::pt_regs::rbx: aya_ebpf_cty::od::c_ulong -pub aya_ebpf_bindings::bindings::pt_regs::rcx: aya_ebpf_cty::od::c_ulong -pub aya_ebpf_bindings::bindings::pt_regs::rdi: aya_ebpf_cty::od::c_ulong -pub aya_ebpf_bindings::bindings::pt_regs::rdx: aya_ebpf_cty::od::c_ulong -pub aya_ebpf_bindings::bindings::pt_regs::rip: aya_ebpf_cty::od::c_ulong -pub aya_ebpf_bindings::bindings::pt_regs::rsi: aya_ebpf_cty::od::c_ulong -pub aya_ebpf_bindings::bindings::pt_regs::rsp: aya_ebpf_cty::od::c_ulong -pub aya_ebpf_bindings::bindings::pt_regs::ss: aya_ebpf_cty::od::c_ulong impl core::clone::Clone for aya_ebpf_bindings::bindings::pt_regs pub fn aya_ebpf_bindings::bindings::pt_regs::clone(&self) -> aya_ebpf_bindings::bindings::pt_regs impl core::fmt::Debug for aya_ebpf_bindings::bindings::pt_regs @@ -3560,6 +3539,23 @@ impl core::marker::Unpin for aya_ebpf_bindings::bindings::unix_sock impl core::marker::UnsafeUnpin for aya_ebpf_bindings::bindings::unix_sock impl core::panic::unwind_safe::RefUnwindSafe for aya_ebpf_bindings::bindings::unix_sock impl core::panic::unwind_safe::UnwindSafe for aya_ebpf_bindings::bindings::unix_sock +#[repr(C)] pub struct aya_ebpf_bindings::bindings::user_pt_regs +pub aya_ebpf_bindings::bindings::user_pt_regs::pc: aya_ebpf_bindings::bindings::__u64 +pub aya_ebpf_bindings::bindings::user_pt_regs::pstate: aya_ebpf_bindings::bindings::__u64 +pub aya_ebpf_bindings::bindings::user_pt_regs::regs: [aya_ebpf_bindings::bindings::__u64; 31] +pub aya_ebpf_bindings::bindings::user_pt_regs::sp: aya_ebpf_bindings::bindings::__u64 +impl core::clone::Clone for aya_ebpf_bindings::bindings::user_pt_regs +pub fn aya_ebpf_bindings::bindings::user_pt_regs::clone(&self) -> aya_ebpf_bindings::bindings::user_pt_regs +impl core::fmt::Debug for aya_ebpf_bindings::bindings::user_pt_regs +pub fn aya_ebpf_bindings::bindings::user_pt_regs::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result +impl core::marker::Copy for aya_ebpf_bindings::bindings::user_pt_regs +impl core::marker::Freeze for aya_ebpf_bindings::bindings::user_pt_regs +impl core::marker::Send for aya_ebpf_bindings::bindings::user_pt_regs +impl core::marker::Sync for aya_ebpf_bindings::bindings::user_pt_regs +impl core::marker::Unpin for aya_ebpf_bindings::bindings::user_pt_regs +impl core::marker::UnsafeUnpin for aya_ebpf_bindings::bindings::user_pt_regs +impl core::panic::unwind_safe::RefUnwindSafe for aya_ebpf_bindings::bindings::user_pt_regs +impl core::panic::unwind_safe::UnwindSafe for aya_ebpf_bindings::bindings::user_pt_regs #[repr(C)] pub struct aya_ebpf_bindings::bindings::xdp_md pub aya_ebpf_bindings::bindings::xdp_md::data: aya_ebpf_bindings::bindings::__u32 pub aya_ebpf_bindings::bindings::xdp_md::data_end: aya_ebpf_bindings::bindings::__u32 @@ -3970,7 +3966,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::bpf_user_pt_regs_t = aya_ebpf_bindings::bindings::user_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-cty.txt b/xtask/public-api/aya-ebpf-cty.txt index fa53f659fd..c0722f1844 100644 --- a/xtask/public-api/aya-ebpf-cty.txt +++ b/xtask/public-api/aya-ebpf-cty.txt @@ -1,5 +1,5 @@ pub mod aya_ebpf_cty -pub type aya_ebpf_cty::c_char = aya_ebpf_cty::c_schar +pub type aya_ebpf_cty::c_char = aya_ebpf_cty::c_uchar pub type aya_ebpf_cty::c_double = f64 pub type aya_ebpf_cty::c_float = f32 pub type aya_ebpf_cty::c_int = i32 diff --git a/xtask/public-api/aya-ebpf.txt b/xtask/public-api/aya-ebpf.txt index 45d81af55d..4898035445 100644 --- a/xtask/public-api/aya-ebpf.txt +++ b/xtask/public-api/aya-ebpf.txt @@ -23,6 +23,24 @@ impl core::marker::Unpin for ay impl core::marker::UnsafeUnpin for aya_ebpf::btf_maps::array::Array impl core::panic::unwind_safe::RefUnwindSafe for aya_ebpf::btf_maps::array::Array where T: core::panic::unwind_safe::RefUnwindSafe impl core::panic::unwind_safe::UnwindSafe for aya_ebpf::btf_maps::array::Array where T: core::panic::unwind_safe::RefUnwindSafe +pub mod aya_ebpf::btf_maps::array_of_maps +#[repr(C)] pub struct aya_ebpf::btf_maps::array_of_maps::ArrayOfMaps +impl aya_ebpf::btf_maps::array_of_maps::ArrayOfMaps +pub fn aya_ebpf::btf_maps::array_of_maps::ArrayOfMaps::get(&self, index: u32) -> core::option::Option<&V> +impl aya_ebpf::btf_maps::array_of_maps::ArrayOfMaps +pub const fn aya_ebpf::btf_maps::array_of_maps::ArrayOfMaps::new() -> Self +impl aya_ebpf::btf_maps::array_of_maps::ArrayOfMaps +pub fn aya_ebpf::btf_maps::array_of_maps::ArrayOfMaps::get_value(&self, outer_index: u32, inner_key: &::Key) -> core::option::Option<&::Value> +pub fn aya_ebpf::btf_maps::array_of_maps::ArrayOfMaps::get_value_ptr_mut(&self, outer_index: u32, inner_key: &::Key) -> core::option::Option<*mut ::Value> +impl core::default::Default for aya_ebpf::btf_maps::array_of_maps::ArrayOfMaps +pub fn aya_ebpf::btf_maps::array_of_maps::ArrayOfMaps::default() -> Self +impl core::marker::Sync for aya_ebpf::btf_maps::array_of_maps::ArrayOfMaps +impl core::marker::Freeze for aya_ebpf::btf_maps::array_of_maps::ArrayOfMaps +impl !core::marker::Send for aya_ebpf::btf_maps::array_of_maps::ArrayOfMaps +impl core::marker::Unpin for aya_ebpf::btf_maps::array_of_maps::ArrayOfMaps +impl core::marker::UnsafeUnpin for aya_ebpf::btf_maps::array_of_maps::ArrayOfMaps +impl core::panic::unwind_safe::RefUnwindSafe for aya_ebpf::btf_maps::array_of_maps::ArrayOfMaps where V: core::panic::unwind_safe::RefUnwindSafe +impl core::panic::unwind_safe::UnwindSafe for aya_ebpf::btf_maps::array_of_maps::ArrayOfMaps where V: core::panic::unwind_safe::RefUnwindSafe pub mod aya_ebpf::btf_maps::bloom_filter #[repr(C)] pub struct aya_ebpf::btf_maps::bloom_filter::BloomFilter impl aya_ebpf::btf_maps::bloom_filter::BloomFilter @@ -39,6 +57,24 @@ impl c impl core::marker::UnsafeUnpin for aya_ebpf::btf_maps::bloom_filter::BloomFilter impl core::panic::unwind_safe::RefUnwindSafe for aya_ebpf::btf_maps::bloom_filter::BloomFilter where T: core::panic::unwind_safe::RefUnwindSafe impl core::panic::unwind_safe::UnwindSafe for aya_ebpf::btf_maps::bloom_filter::BloomFilter where T: core::panic::unwind_safe::RefUnwindSafe +pub mod aya_ebpf::btf_maps::hash_of_maps +#[repr(C)] pub struct aya_ebpf::btf_maps::hash_of_maps::HashOfMaps +impl aya_ebpf::btf_maps::hash_of_maps::HashOfMaps +pub unsafe fn aya_ebpf::btf_maps::hash_of_maps::HashOfMaps::get(&self, key: &K) -> core::option::Option<&V> +impl aya_ebpf::btf_maps::hash_of_maps::HashOfMaps +pub const fn aya_ebpf::btf_maps::hash_of_maps::HashOfMaps::new() -> Self +impl aya_ebpf::btf_maps::hash_of_maps::HashOfMaps +pub unsafe fn aya_ebpf::btf_maps::hash_of_maps::HashOfMaps::get_value(&self, outer_key: &K, inner_key: &::Key) -> core::option::Option<&::Value> +pub unsafe fn aya_ebpf::btf_maps::hash_of_maps::HashOfMaps::get_value_ptr_mut(&self, outer_key: &K, inner_key: &::Key) -> core::option::Option<*mut ::Value> +impl core::default::Default for aya_ebpf::btf_maps::hash_of_maps::HashOfMaps +pub fn aya_ebpf::btf_maps::hash_of_maps::HashOfMaps::default() -> Self +impl core::marker::Sync for aya_ebpf::btf_maps::hash_of_maps::HashOfMaps +impl core::marker::Freeze for aya_ebpf::btf_maps::hash_of_maps::HashOfMaps +impl !core::marker::Send for aya_ebpf::btf_maps::hash_of_maps::HashOfMaps +impl core::marker::Unpin for aya_ebpf::btf_maps::hash_of_maps::HashOfMaps +impl core::marker::UnsafeUnpin for aya_ebpf::btf_maps::hash_of_maps::HashOfMaps +impl core::panic::unwind_safe::RefUnwindSafe for aya_ebpf::btf_maps::hash_of_maps::HashOfMaps where K: core::panic::unwind_safe::RefUnwindSafe, V: core::panic::unwind_safe::RefUnwindSafe +impl core::panic::unwind_safe::UnwindSafe for aya_ebpf::btf_maps::hash_of_maps::HashOfMaps where K: core::panic::unwind_safe::RefUnwindSafe, V: core::panic::unwind_safe::RefUnwindSafe pub mod aya_ebpf::btf_maps::lpm_trie #[repr(C, packed(1))] pub struct aya_ebpf::btf_maps::lpm_trie::Key pub aya_ebpf::btf_maps::lpm_trie::Key::data: K @@ -171,7 +207,7 @@ impl core::panic::unwind_safe:: pub mod aya_ebpf::btf_maps::sk_storage #[repr(C)] pub struct aya_ebpf::btf_maps::sk_storage::SkStorage impl aya_ebpf::btf_maps::sk_storage::SkStorage -pub unsafe fn aya_ebpf::btf_maps::sk_storage::SkStorage::delete(&self, sk: *mut aya_ebpf_bindings::x86_64::bindings::bpf_sock) -> core::result::Result<(), i32> +pub unsafe fn aya_ebpf::btf_maps::sk_storage::SkStorage::delete(&self, sk: *mut aya_ebpf_bindings::aarch64::bindings::bpf_sock) -> core::result::Result<(), i32> pub unsafe fn aya_ebpf::btf_maps::sk_storage::SkStorage::get_or_insert_ptr_mut(&self, ctx: &aya_ebpf::programs::sock_addr::SockAddrContext, value: core::option::Option<&mut T>) -> *mut T pub unsafe fn aya_ebpf::btf_maps::sk_storage::SkStorage::get_ptr_mut(&self, ctx: &aya_ebpf::programs::sock_addr::SockAddrContext) -> *mut T impl aya_ebpf::btf_maps::sk_storage::SkStorage @@ -193,7 +229,7 @@ impl aya_ebpf::btf_maps::sock_h pub fn aya_ebpf::btf_maps::sock_hash::SockHash::redirect_msg(&self, ctx: impl core::borrow::Borrow, key: impl core::borrow::BorrowMut, flags: u64) -> aya_ebpf_cty::od::c_long pub fn aya_ebpf::btf_maps::sock_hash::SockHash::redirect_sk_lookup(&self, ctx: impl core::borrow::Borrow, key: impl core::borrow::Borrow, flags: u64) -> core::result::Result<(), i32> pub fn aya_ebpf::btf_maps::sock_hash::SockHash::redirect_skb(&self, ctx: impl core::borrow::Borrow, key: impl core::borrow::BorrowMut, flags: u64) -> aya_ebpf_cty::od::c_long -pub fn aya_ebpf::btf_maps::sock_hash::SockHash::update(&self, key: impl core::borrow::BorrowMut, sk_ops: impl core::borrow::BorrowMut, flags: u64) -> core::result::Result<(), i32> +pub fn aya_ebpf::btf_maps::sock_hash::SockHash::update(&self, key: impl core::borrow::BorrowMut, sk_ops: impl core::borrow::BorrowMut, flags: u64) -> core::result::Result<(), i32> impl core::default::Default for aya_ebpf::btf_maps::sock_hash::SockHash pub fn aya_ebpf::btf_maps::sock_hash::SockHash::default() -> Self impl core::marker::Sync for aya_ebpf::btf_maps::sock_hash::SockHash @@ -211,7 +247,7 @@ impl aya_ebpf::btf_maps::sock_map: pub fn aya_ebpf::btf_maps::sock_map::SockMap::redirect_msg(&self, ctx: &aya_ebpf::programs::sk_msg::SkMsgContext, index: u32, flags: u64) -> aya_ebpf_cty::od::c_long pub fn aya_ebpf::btf_maps::sock_map::SockMap::redirect_sk_lookup(&self, ctx: &aya_ebpf::programs::sk_lookup::SkLookupContext, index: u32, flags: u64) -> core::result::Result<(), i32> pub fn aya_ebpf::btf_maps::sock_map::SockMap::redirect_skb(&self, ctx: &aya_ebpf::programs::sk_buff::SkBuffContext, index: u32, flags: u64) -> aya_ebpf_cty::od::c_long -pub unsafe fn aya_ebpf::btf_maps::sock_map::SockMap::update(&self, index: u32, sk_ops: *mut aya_ebpf_bindings::x86_64::bindings::bpf_sock_ops, flags: u64) -> core::result::Result<(), i32> +pub unsafe fn aya_ebpf::btf_maps::sock_map::SockMap::update(&self, index: u32, sk_ops: *mut aya_ebpf_bindings::aarch64::bindings::bpf_sock_ops, flags: u64) -> core::result::Result<(), i32> impl core::default::Default for aya_ebpf::btf_maps::sock_map::SockMap pub fn aya_ebpf::btf_maps::sock_map::SockMap::default() -> Self impl core::marker::Sync for aya_ebpf::btf_maps::sock_map::SockMap @@ -251,6 +287,23 @@ impl core::marker::Unpin for ay impl core::marker::UnsafeUnpin for aya_ebpf::btf_maps::array::Array impl core::panic::unwind_safe::RefUnwindSafe for aya_ebpf::btf_maps::array::Array where T: core::panic::unwind_safe::RefUnwindSafe impl core::panic::unwind_safe::UnwindSafe for aya_ebpf::btf_maps::array::Array where T: core::panic::unwind_safe::RefUnwindSafe +#[repr(C)] pub struct aya_ebpf::btf_maps::ArrayOfMaps +impl aya_ebpf::btf_maps::array_of_maps::ArrayOfMaps +pub fn aya_ebpf::btf_maps::array_of_maps::ArrayOfMaps::get(&self, index: u32) -> core::option::Option<&V> +impl aya_ebpf::btf_maps::array_of_maps::ArrayOfMaps +pub const fn aya_ebpf::btf_maps::array_of_maps::ArrayOfMaps::new() -> Self +impl aya_ebpf::btf_maps::array_of_maps::ArrayOfMaps +pub fn aya_ebpf::btf_maps::array_of_maps::ArrayOfMaps::get_value(&self, outer_index: u32, inner_key: &::Key) -> core::option::Option<&::Value> +pub fn aya_ebpf::btf_maps::array_of_maps::ArrayOfMaps::get_value_ptr_mut(&self, outer_index: u32, inner_key: &::Key) -> core::option::Option<*mut ::Value> +impl core::default::Default for aya_ebpf::btf_maps::array_of_maps::ArrayOfMaps +pub fn aya_ebpf::btf_maps::array_of_maps::ArrayOfMaps::default() -> Self +impl core::marker::Sync for aya_ebpf::btf_maps::array_of_maps::ArrayOfMaps +impl core::marker::Freeze for aya_ebpf::btf_maps::array_of_maps::ArrayOfMaps +impl !core::marker::Send for aya_ebpf::btf_maps::array_of_maps::ArrayOfMaps +impl core::marker::Unpin for aya_ebpf::btf_maps::array_of_maps::ArrayOfMaps +impl core::marker::UnsafeUnpin for aya_ebpf::btf_maps::array_of_maps::ArrayOfMaps +impl core::panic::unwind_safe::RefUnwindSafe for aya_ebpf::btf_maps::array_of_maps::ArrayOfMaps where V: core::panic::unwind_safe::RefUnwindSafe +impl core::panic::unwind_safe::UnwindSafe for aya_ebpf::btf_maps::array_of_maps::ArrayOfMaps where V: core::panic::unwind_safe::RefUnwindSafe #[repr(C)] pub struct aya_ebpf::btf_maps::BloomFilter impl aya_ebpf::btf_maps::bloom_filter::BloomFilter pub fn aya_ebpf::btf_maps::bloom_filter::BloomFilter::contains(&self, value: impl core::borrow::Borrow) -> core::result::Result<(), i32> @@ -266,6 +319,23 @@ impl c impl core::marker::UnsafeUnpin for aya_ebpf::btf_maps::bloom_filter::BloomFilter impl core::panic::unwind_safe::RefUnwindSafe for aya_ebpf::btf_maps::bloom_filter::BloomFilter where T: core::panic::unwind_safe::RefUnwindSafe impl core::panic::unwind_safe::UnwindSafe for aya_ebpf::btf_maps::bloom_filter::BloomFilter where T: core::panic::unwind_safe::RefUnwindSafe +#[repr(C)] pub struct aya_ebpf::btf_maps::HashOfMaps +impl aya_ebpf::btf_maps::hash_of_maps::HashOfMaps +pub unsafe fn aya_ebpf::btf_maps::hash_of_maps::HashOfMaps::get(&self, key: &K) -> core::option::Option<&V> +impl aya_ebpf::btf_maps::hash_of_maps::HashOfMaps +pub const fn aya_ebpf::btf_maps::hash_of_maps::HashOfMaps::new() -> Self +impl aya_ebpf::btf_maps::hash_of_maps::HashOfMaps +pub unsafe fn aya_ebpf::btf_maps::hash_of_maps::HashOfMaps::get_value(&self, outer_key: &K, inner_key: &::Key) -> core::option::Option<&::Value> +pub unsafe fn aya_ebpf::btf_maps::hash_of_maps::HashOfMaps::get_value_ptr_mut(&self, outer_key: &K, inner_key: &::Key) -> core::option::Option<*mut ::Value> +impl core::default::Default for aya_ebpf::btf_maps::hash_of_maps::HashOfMaps +pub fn aya_ebpf::btf_maps::hash_of_maps::HashOfMaps::default() -> Self +impl core::marker::Sync for aya_ebpf::btf_maps::hash_of_maps::HashOfMaps +impl core::marker::Freeze for aya_ebpf::btf_maps::hash_of_maps::HashOfMaps +impl !core::marker::Send for aya_ebpf::btf_maps::hash_of_maps::HashOfMaps +impl core::marker::Unpin for aya_ebpf::btf_maps::hash_of_maps::HashOfMaps +impl core::marker::UnsafeUnpin for aya_ebpf::btf_maps::hash_of_maps::HashOfMaps +impl core::panic::unwind_safe::RefUnwindSafe for aya_ebpf::btf_maps::hash_of_maps::HashOfMaps where K: core::panic::unwind_safe::RefUnwindSafe, V: core::panic::unwind_safe::RefUnwindSafe +impl core::panic::unwind_safe::UnwindSafe for aya_ebpf::btf_maps::hash_of_maps::HashOfMaps where K: core::panic::unwind_safe::RefUnwindSafe, V: core::panic::unwind_safe::RefUnwindSafe #[repr(C)] pub struct aya_ebpf::btf_maps::LpmTrie impl aya_ebpf::btf_maps::lpm_trie::LpmTrie pub fn aya_ebpf::btf_maps::lpm_trie::LpmTrie::get(&self, key: &aya_ebpf::maps::lpm_trie::Key) -> core::option::Option<&V> @@ -363,7 +433,7 @@ impl core::panic::unwind_safe:: impl core::panic::unwind_safe::UnwindSafe for aya_ebpf::btf_maps::ring_buf::RingBuf where T: core::panic::unwind_safe::RefUnwindSafe #[repr(C)] pub struct aya_ebpf::btf_maps::SkStorage impl aya_ebpf::btf_maps::sk_storage::SkStorage -pub unsafe fn aya_ebpf::btf_maps::sk_storage::SkStorage::delete(&self, sk: *mut aya_ebpf_bindings::x86_64::bindings::bpf_sock) -> core::result::Result<(), i32> +pub unsafe fn aya_ebpf::btf_maps::sk_storage::SkStorage::delete(&self, sk: *mut aya_ebpf_bindings::aarch64::bindings::bpf_sock) -> core::result::Result<(), i32> pub unsafe fn aya_ebpf::btf_maps::sk_storage::SkStorage::get_or_insert_ptr_mut(&self, ctx: &aya_ebpf::programs::sock_addr::SockAddrContext, value: core::option::Option<&mut T>) -> *mut T pub unsafe fn aya_ebpf::btf_maps::sk_storage::SkStorage::get_ptr_mut(&self, ctx: &aya_ebpf::programs::sock_addr::SockAddrContext) -> *mut T impl aya_ebpf::btf_maps::sk_storage::SkStorage @@ -384,7 +454,7 @@ impl aya_ebpf::btf_maps::sock_h pub fn aya_ebpf::btf_maps::sock_hash::SockHash::redirect_msg(&self, ctx: impl core::borrow::Borrow, key: impl core::borrow::BorrowMut, flags: u64) -> aya_ebpf_cty::od::c_long pub fn aya_ebpf::btf_maps::sock_hash::SockHash::redirect_sk_lookup(&self, ctx: impl core::borrow::Borrow, key: impl core::borrow::Borrow, flags: u64) -> core::result::Result<(), i32> pub fn aya_ebpf::btf_maps::sock_hash::SockHash::redirect_skb(&self, ctx: impl core::borrow::Borrow, key: impl core::borrow::BorrowMut, flags: u64) -> aya_ebpf_cty::od::c_long -pub fn aya_ebpf::btf_maps::sock_hash::SockHash::update(&self, key: impl core::borrow::BorrowMut, sk_ops: impl core::borrow::BorrowMut, flags: u64) -> core::result::Result<(), i32> +pub fn aya_ebpf::btf_maps::sock_hash::SockHash::update(&self, key: impl core::borrow::BorrowMut, sk_ops: impl core::borrow::BorrowMut, flags: u64) -> core::result::Result<(), i32> impl core::default::Default for aya_ebpf::btf_maps::sock_hash::SockHash pub fn aya_ebpf::btf_maps::sock_hash::SockHash::default() -> Self impl core::marker::Sync for aya_ebpf::btf_maps::sock_hash::SockHash @@ -401,7 +471,7 @@ impl aya_ebpf::btf_maps::sock_map: pub fn aya_ebpf::btf_maps::sock_map::SockMap::redirect_msg(&self, ctx: &aya_ebpf::programs::sk_msg::SkMsgContext, index: u32, flags: u64) -> aya_ebpf_cty::od::c_long pub fn aya_ebpf::btf_maps::sock_map::SockMap::redirect_sk_lookup(&self, ctx: &aya_ebpf::programs::sk_lookup::SkLookupContext, index: u32, flags: u64) -> core::result::Result<(), i32> pub fn aya_ebpf::btf_maps::sock_map::SockMap::redirect_skb(&self, ctx: &aya_ebpf::programs::sk_buff::SkBuffContext, index: u32, flags: u64) -> aya_ebpf_cty::od::c_long -pub unsafe fn aya_ebpf::btf_maps::sock_map::SockMap::update(&self, index: u32, sk_ops: *mut aya_ebpf_bindings::x86_64::bindings::bpf_sock_ops, flags: u64) -> core::result::Result<(), i32> +pub unsafe fn aya_ebpf::btf_maps::sock_map::SockMap::update(&self, index: u32, sk_ops: *mut aya_ebpf_bindings::aarch64::bindings::bpf_sock_ops, flags: u64) -> core::result::Result<(), i32> impl core::default::Default for aya_ebpf::btf_maps::sock_map::SockMap pub fn aya_ebpf::btf_maps::sock_map::SockMap::default() -> Self impl core::marker::Sync for aya_ebpf::btf_maps::sock_map::SockMap @@ -423,6 +493,8 @@ impl core::mar impl core::marker::UnsafeUnpin for aya_ebpf::btf_maps::stack_trace::StackTrace impl core::panic::unwind_safe::RefUnwindSafe for aya_ebpf::btf_maps::stack_trace::StackTrace impl core::panic::unwind_safe::UnwindSafe for aya_ebpf::btf_maps::stack_trace::StackTrace +pub trait aya_ebpf::btf_maps::MapDef: aya_ebpf::btf_maps::private::MapDef +impl aya_ebpf::btf_maps::MapDef for T pub type aya_ebpf::btf_maps::ReusePortSockArray = aya_ebpf::btf_maps::reuseport_sock_array::ReusePortSockArrayImpl pub mod aya_ebpf::helpers pub use aya_ebpf::helpers::generated @@ -706,7 +778,7 @@ pub const fn aya_ebpf::maps::sock_hash::SockHash::pinned(max_entries: u32, fl pub fn aya_ebpf::maps::sock_hash::SockHash::redirect_msg(&self, ctx: impl core::borrow::Borrow, key: impl core::borrow::BorrowMut, flags: u64) -> aya_ebpf_cty::od::c_long pub fn aya_ebpf::maps::sock_hash::SockHash::redirect_sk_lookup(&self, ctx: impl core::borrow::Borrow, key: impl core::borrow::Borrow, flags: u64) -> core::result::Result<(), i32> pub fn aya_ebpf::maps::sock_hash::SockHash::redirect_skb(&self, ctx: impl core::borrow::Borrow, key: impl core::borrow::BorrowMut, flags: u64) -> aya_ebpf_cty::od::c_long -pub fn aya_ebpf::maps::sock_hash::SockHash::update(&self, key: impl core::borrow::BorrowMut, sk_ops: impl core::borrow::BorrowMut, flags: u64) -> core::result::Result<(), i32> +pub fn aya_ebpf::maps::sock_hash::SockHash::update(&self, key: impl core::borrow::BorrowMut, sk_ops: impl core::borrow::BorrowMut, flags: u64) -> core::result::Result<(), i32> pub const fn aya_ebpf::maps::sock_hash::SockHash::with_max_entries(max_entries: u32, flags: u32) -> Self impl !core::marker::Freeze for aya_ebpf::maps::sock_hash::SockHash impl core::marker::Send for aya_ebpf::maps::sock_hash::SockHash where K: core::marker::Send @@ -722,7 +794,7 @@ pub const fn aya_ebpf::maps::sock_map::SockMap::pinned(max_entries: u32, flags: pub unsafe fn aya_ebpf::maps::sock_map::SockMap::redirect_msg(&self, ctx: &aya_ebpf::programs::sk_msg::SkMsgContext, index: u32, flags: u64) -> aya_ebpf_cty::od::c_long pub fn aya_ebpf::maps::sock_map::SockMap::redirect_sk_lookup(&self, ctx: &aya_ebpf::programs::sk_lookup::SkLookupContext, index: u32, flags: u64) -> core::result::Result<(), i32> pub unsafe fn aya_ebpf::maps::sock_map::SockMap::redirect_skb(&self, ctx: &aya_ebpf::programs::sk_buff::SkBuffContext, index: u32, flags: u64) -> aya_ebpf_cty::od::c_long -pub unsafe fn aya_ebpf::maps::sock_map::SockMap::update(&self, index: u32, sk_ops: *mut aya_ebpf_bindings::x86_64::bindings::bpf_sock_ops, flags: u64) -> core::result::Result<(), i32> +pub unsafe fn aya_ebpf::maps::sock_map::SockMap::update(&self, index: u32, sk_ops: *mut aya_ebpf_bindings::aarch64::bindings::bpf_sock_ops, flags: u64) -> core::result::Result<(), i32> pub const fn aya_ebpf::maps::sock_map::SockMap::with_max_entries(max_entries: u32, flags: u32) -> Self impl !core::marker::Freeze for aya_ebpf::maps::sock_map::SockMap impl core::marker::Send for aya_ebpf::maps::sock_map::SockMap @@ -1054,7 +1126,7 @@ pub const fn aya_ebpf::maps::sock_hash::SockHash::pinned(max_entries: u32, fl pub fn aya_ebpf::maps::sock_hash::SockHash::redirect_msg(&self, ctx: impl core::borrow::Borrow, key: impl core::borrow::BorrowMut, flags: u64) -> aya_ebpf_cty::od::c_long pub fn aya_ebpf::maps::sock_hash::SockHash::redirect_sk_lookup(&self, ctx: impl core::borrow::Borrow, key: impl core::borrow::Borrow, flags: u64) -> core::result::Result<(), i32> pub fn aya_ebpf::maps::sock_hash::SockHash::redirect_skb(&self, ctx: impl core::borrow::Borrow, key: impl core::borrow::BorrowMut, flags: u64) -> aya_ebpf_cty::od::c_long -pub fn aya_ebpf::maps::sock_hash::SockHash::update(&self, key: impl core::borrow::BorrowMut, sk_ops: impl core::borrow::BorrowMut, flags: u64) -> core::result::Result<(), i32> +pub fn aya_ebpf::maps::sock_hash::SockHash::update(&self, key: impl core::borrow::BorrowMut, sk_ops: impl core::borrow::BorrowMut, flags: u64) -> core::result::Result<(), i32> pub const fn aya_ebpf::maps::sock_hash::SockHash::with_max_entries(max_entries: u32, flags: u32) -> Self impl !core::marker::Freeze for aya_ebpf::maps::sock_hash::SockHash impl core::marker::Send for aya_ebpf::maps::sock_hash::SockHash where K: core::marker::Send @@ -1069,7 +1141,7 @@ pub const fn aya_ebpf::maps::sock_map::SockMap::pinned(max_entries: u32, flags: pub unsafe fn aya_ebpf::maps::sock_map::SockMap::redirect_msg(&self, ctx: &aya_ebpf::programs::sk_msg::SkMsgContext, index: u32, flags: u64) -> aya_ebpf_cty::od::c_long pub fn aya_ebpf::maps::sock_map::SockMap::redirect_sk_lookup(&self, ctx: &aya_ebpf::programs::sk_lookup::SkLookupContext, index: u32, flags: u64) -> core::result::Result<(), i32> pub unsafe fn aya_ebpf::maps::sock_map::SockMap::redirect_skb(&self, ctx: &aya_ebpf::programs::sk_buff::SkBuffContext, index: u32, flags: u64) -> aya_ebpf_cty::od::c_long -pub unsafe fn aya_ebpf::maps::sock_map::SockMap::update(&self, index: u32, sk_ops: *mut aya_ebpf_bindings::x86_64::bindings::bpf_sock_ops, flags: u64) -> core::result::Result<(), i32> +pub unsafe fn aya_ebpf::maps::sock_map::SockMap::update(&self, index: u32, sk_ops: *mut aya_ebpf_bindings::aarch64::bindings::bpf_sock_ops, flags: u64) -> core::result::Result<(), i32> pub const fn aya_ebpf::maps::sock_map::SockMap::with_max_entries(max_entries: u32, flags: u32) -> Self impl !core::marker::Freeze for aya_ebpf::maps::sock_map::SockMap impl core::marker::Send for aya_ebpf::maps::sock_map::SockMap @@ -1116,12 +1188,14 @@ impl core::marker::Unpin for aya_ebpf::maps::XskMap impl core::marker::UnsafeUnpin for aya_ebpf::maps::XskMap impl !core::panic::unwind_safe::RefUnwindSafe for aya_ebpf::maps::XskMap impl core::panic::unwind_safe::UnwindSafe for aya_ebpf::maps::XskMap +pub trait aya_ebpf::maps::Map: aya_ebpf::maps::private::Map +impl aya_ebpf::maps::Map for T pub mod aya_ebpf::programs pub mod aya_ebpf::programs::device pub struct aya_ebpf::programs::device::DeviceContext -pub aya_ebpf::programs::device::DeviceContext::device: *mut aya_ebpf_bindings::x86_64::bindings::bpf_cgroup_dev_ctx +pub aya_ebpf::programs::device::DeviceContext::device: *mut aya_ebpf_bindings::aarch64::bindings::bpf_cgroup_dev_ctx impl aya_ebpf::programs::device::DeviceContext -pub const fn aya_ebpf::programs::device::DeviceContext::new(device: *mut aya_ebpf_bindings::x86_64::bindings::bpf_cgroup_dev_ctx) -> Self +pub const fn aya_ebpf::programs::device::DeviceContext::new(device: *mut aya_ebpf_bindings::aarch64::bindings::bpf_cgroup_dev_ctx) -> Self impl aya_ebpf::EbpfContext for aya_ebpf::programs::device::DeviceContext pub fn aya_ebpf::programs::device::DeviceContext::as_ptr(&self) -> *mut core::ffi::c_void pub fn aya_ebpf::programs::device::DeviceContext::command(&self) -> core::result::Result<[u8; 16], i32> @@ -1179,9 +1253,9 @@ pub struct aya_ebpf::programs::flow_dissector::FlowDissectorContext impl aya_ebpf::programs::flow_dissector::FlowDissectorContext pub fn aya_ebpf::programs::flow_dissector::FlowDissectorContext::data(&self) -> usize pub fn aya_ebpf::programs::flow_dissector::FlowDissectorContext::data_end(&self) -> usize -pub fn aya_ebpf::programs::flow_dissector::FlowDissectorContext::flow_keys(&mut self) -> &mut aya_ebpf_bindings::x86_64::bindings::bpf_flow_keys +pub fn aya_ebpf::programs::flow_dissector::FlowDissectorContext::flow_keys(&mut self) -> &mut aya_ebpf_bindings::aarch64::bindings::bpf_flow_keys pub fn aya_ebpf::programs::flow_dissector::FlowDissectorContext::load_bytes(&self, offset: usize, dst: &mut [u8]) -> core::result::Result -pub const fn aya_ebpf::programs::flow_dissector::FlowDissectorContext::new(skb: *mut aya_ebpf_bindings::x86_64::bindings::__sk_buff) -> Self +pub const fn aya_ebpf::programs::flow_dissector::FlowDissectorContext::new(skb: *mut aya_ebpf_bindings::aarch64::bindings::__sk_buff) -> Self impl aya_ebpf::EbpfContext for aya_ebpf::programs::flow_dissector::FlowDissectorContext pub fn aya_ebpf::programs::flow_dissector::FlowDissectorContext::as_ptr(&self) -> *mut aya_ebpf_cty::c_void pub fn aya_ebpf::programs::flow_dissector::FlowDissectorContext::command(&self) -> core::result::Result<[u8; 16], i32> @@ -1217,9 +1291,9 @@ impl core::panic::unwind_safe::RefUnwindSafe for aya_ebpf::programs::lsm::LsmCon impl core::panic::unwind_safe::UnwindSafe for aya_ebpf::programs::lsm::LsmContext 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 +pub aya_ebpf::programs::perf_event::PerfEventContext::ctx: *mut aya_ebpf_bindings::aarch64::bindings::bpf_perf_event_data impl aya_ebpf::programs::perf_event::PerfEventContext -pub const fn aya_ebpf::programs::perf_event::PerfEventContext::new(ctx: *mut aya_ebpf_bindings::x86_64::bindings::bpf_perf_event_data) -> Self +pub const fn aya_ebpf::programs::perf_event::PerfEventContext::new(ctx: *mut aya_ebpf_bindings::aarch64::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 pub fn aya_ebpf::programs::perf_event::PerfEventContext::command(&self) -> core::result::Result<[u8; 16], i32> @@ -1236,7 +1310,7 @@ impl core::panic::unwind_safe::RefUnwindSafe for aya_ebpf::programs::perf_event: impl core::panic::unwind_safe::UnwindSafe for aya_ebpf::programs::perf_event::PerfEventContext pub mod aya_ebpf::programs::probe pub struct aya_ebpf::programs::probe::ProbeContext -pub aya_ebpf::programs::probe::ProbeContext::regs: *mut aya_ebpf_bindings::x86_64::bindings::pt_regs +pub aya_ebpf::programs::probe::ProbeContext::regs: *mut aya_ebpf_bindings::aarch64::bindings::user_pt_regs impl aya_ebpf::programs::probe::ProbeContext pub fn aya_ebpf::programs::probe::ProbeContext::arg(&self, n: usize) -> core::option::Option pub const fn aya_ebpf::programs::probe::ProbeContext::new(ctx: *mut core::ffi::c_void) -> Self @@ -1275,7 +1349,7 @@ impl core::panic::unwind_safe::RefUnwindSafe for aya_ebpf::programs::raw_tracepo impl core::panic::unwind_safe::UnwindSafe for aya_ebpf::programs::raw_tracepoint::RawTracePointContext pub mod aya_ebpf::programs::retprobe pub struct aya_ebpf::programs::retprobe::RetProbeContext -pub aya_ebpf::programs::retprobe::RetProbeContext::regs: *mut aya_ebpf_bindings::x86_64::bindings::pt_regs +pub aya_ebpf::programs::retprobe::RetProbeContext::regs: *mut aya_ebpf_bindings::aarch64::bindings::user_pt_regs impl aya_ebpf::programs::retprobe::RetProbeContext pub const fn aya_ebpf::programs::retprobe::RetProbeContext::new(ctx: *mut core::ffi::c_void) -> Self pub fn aya_ebpf::programs::retprobe::RetProbeContext::ret(&self) -> T @@ -1295,7 +1369,7 @@ impl core::panic::unwind_safe::RefUnwindSafe for aya_ebpf::programs::retprobe::R impl core::panic::unwind_safe::UnwindSafe for aya_ebpf::programs::retprobe::RetProbeContext pub mod aya_ebpf::programs::sk_buff pub struct aya_ebpf::programs::sk_buff::SkBuff -pub aya_ebpf::programs::sk_buff::SkBuff::skb: *mut aya_ebpf_bindings::x86_64::bindings::__sk_buff +pub aya_ebpf::programs::sk_buff::SkBuff::skb: *mut aya_ebpf_bindings::aarch64::bindings::__sk_buff impl aya_ebpf::programs::sk_buff::SkBuff pub fn aya_ebpf::programs::sk_buff::SkBuff::adjust_room(&self, len_diff: i32, mode: u32, flags: u64) -> core::result::Result<(), aya_ebpf_cty::od::c_long> pub fn aya_ebpf::programs::sk_buff::SkBuff::cb(&self) -> &[u32] @@ -1313,7 +1387,7 @@ pub fn aya_ebpf::programs::sk_buff::SkBuff::load_bytes(&self, offset: usize, dst pub fn aya_ebpf::programs::sk_buff::SkBuff::local_ipv4(&self) -> u32 pub fn aya_ebpf::programs::sk_buff::SkBuff::local_ipv6(&self) -> &[u32; 4] pub fn aya_ebpf::programs::sk_buff::SkBuff::local_port(&self) -> u32 -pub const fn aya_ebpf::programs::sk_buff::SkBuff::new(skb: *mut aya_ebpf_bindings::x86_64::bindings::__sk_buff) -> Self +pub const fn aya_ebpf::programs::sk_buff::SkBuff::new(skb: *mut aya_ebpf_bindings::aarch64::bindings::__sk_buff) -> Self pub fn aya_ebpf::programs::sk_buff::SkBuff::protocol(&self) -> u32 pub fn aya_ebpf::programs::sk_buff::SkBuff::pull_data(&self, len: u32) -> core::result::Result<(), aya_ebpf_cty::od::c_long> pub fn aya_ebpf::programs::sk_buff::SkBuff::remote_ipv4(&self) -> u32 @@ -1342,7 +1416,7 @@ pub fn aya_ebpf::programs::sk_buff::SkBuffContext::l4_csum_replace(&self, offset pub fn aya_ebpf::programs::sk_buff::SkBuffContext::len(&self) -> u32 pub fn aya_ebpf::programs::sk_buff::SkBuffContext::load(&self, offset: usize) -> core::result::Result pub fn aya_ebpf::programs::sk_buff::SkBuffContext::load_bytes(&self, offset: usize, dst: &mut [u8]) -> core::result::Result -pub const fn aya_ebpf::programs::sk_buff::SkBuffContext::new(skb: *mut aya_ebpf_bindings::x86_64::bindings::__sk_buff) -> Self +pub const fn aya_ebpf::programs::sk_buff::SkBuffContext::new(skb: *mut aya_ebpf_bindings::aarch64::bindings::__sk_buff) -> Self pub fn aya_ebpf::programs::sk_buff::SkBuffContext::pull_data(&self, len: u32) -> core::result::Result<(), aya_ebpf_cty::od::c_long> pub fn aya_ebpf::programs::sk_buff::SkBuffContext::set_mark(&self, mark: u32) pub fn aya_ebpf::programs::sk_buff::SkBuffContext::store(&self, offset: usize, v: &T, flags: u64) -> core::result::Result<(), aya_ebpf_cty::od::c_long> @@ -1362,9 +1436,9 @@ impl core::panic::unwind_safe::RefUnwindSafe for aya_ebpf::programs::sk_buff::Sk impl core::panic::unwind_safe::UnwindSafe for aya_ebpf::programs::sk_buff::SkBuffContext pub mod aya_ebpf::programs::sk_lookup pub struct aya_ebpf::programs::sk_lookup::SkLookupContext -pub aya_ebpf::programs::sk_lookup::SkLookupContext::lookup: *mut aya_ebpf_bindings::x86_64::bindings::bpf_sk_lookup +pub aya_ebpf::programs::sk_lookup::SkLookupContext::lookup: *mut aya_ebpf_bindings::aarch64::bindings::bpf_sk_lookup impl aya_ebpf::programs::sk_lookup::SkLookupContext -pub const fn aya_ebpf::programs::sk_lookup::SkLookupContext::new(lookup: *mut aya_ebpf_bindings::x86_64::bindings::bpf_sk_lookup) -> Self +pub const fn aya_ebpf::programs::sk_lookup::SkLookupContext::new(lookup: *mut aya_ebpf_bindings::aarch64::bindings::bpf_sk_lookup) -> Self impl aya_ebpf::EbpfContext for aya_ebpf::programs::sk_lookup::SkLookupContext pub fn aya_ebpf::programs::sk_lookup::SkLookupContext::as_ptr(&self) -> *mut core::ffi::c_void pub fn aya_ebpf::programs::sk_lookup::SkLookupContext::command(&self) -> core::result::Result<[u8; 16], i32> @@ -1381,11 +1455,11 @@ impl core::panic::unwind_safe::RefUnwindSafe for aya_ebpf::programs::sk_lookup:: impl core::panic::unwind_safe::UnwindSafe for aya_ebpf::programs::sk_lookup::SkLookupContext pub mod aya_ebpf::programs::sk_msg pub struct aya_ebpf::programs::sk_msg::SkMsgContext -pub aya_ebpf::programs::sk_msg::SkMsgContext::msg: *mut aya_ebpf_bindings::x86_64::bindings::sk_msg_md +pub aya_ebpf::programs::sk_msg::SkMsgContext::msg: *mut aya_ebpf_bindings::aarch64::bindings::sk_msg_md impl aya_ebpf::programs::sk_msg::SkMsgContext pub fn aya_ebpf::programs::sk_msg::SkMsgContext::data(&self) -> usize pub fn aya_ebpf::programs::sk_msg::SkMsgContext::data_end(&self) -> usize -pub const fn aya_ebpf::programs::sk_msg::SkMsgContext::new(msg: *mut aya_ebpf_bindings::x86_64::bindings::sk_msg_md) -> Self +pub const fn aya_ebpf::programs::sk_msg::SkMsgContext::new(msg: *mut aya_ebpf_bindings::aarch64::bindings::sk_msg_md) -> Self pub fn aya_ebpf::programs::sk_msg::SkMsgContext::pop_data(&self, start: u32, len: u32, flags: u64) -> core::result::Result<(), i32> pub fn aya_ebpf::programs::sk_msg::SkMsgContext::push_data(&self, start: u32, len: u32, flags: u64) -> core::result::Result<(), i32> pub fn aya_ebpf::programs::sk_msg::SkMsgContext::size(&self) -> u32 @@ -1405,7 +1479,7 @@ impl core::panic::unwind_safe::RefUnwindSafe for aya_ebpf::programs::sk_msg::SkM impl core::panic::unwind_safe::UnwindSafe for aya_ebpf::programs::sk_msg::SkMsgContext pub mod aya_ebpf::programs::sk_reuseport pub struct aya_ebpf::programs::sk_reuseport::SkReuseportContext -pub aya_ebpf::programs::sk_reuseport::SkReuseportContext::md: *mut aya_ebpf_bindings::x86_64::bindings::sk_reuseport_md +pub aya_ebpf::programs::sk_reuseport::SkReuseportContext::md: *mut aya_ebpf_bindings::aarch64::bindings::sk_reuseport_md impl aya_ebpf::programs::sk_reuseport::SkReuseportContext pub fn aya_ebpf::programs::sk_reuseport::SkReuseportContext::bind_inany(&self) -> u32 pub fn aya_ebpf::programs::sk_reuseport::SkReuseportContext::data(&self) -> usize @@ -1416,7 +1490,7 @@ pub fn aya_ebpf::programs::sk_reuseport::SkReuseportContext::ip_protocol(&self) pub fn aya_ebpf::programs::sk_reuseport::SkReuseportContext::is_empty(&self) -> bool pub fn aya_ebpf::programs::sk_reuseport::SkReuseportContext::len(&self) -> usize pub fn aya_ebpf::programs::sk_reuseport::SkReuseportContext::migrating_sk(&self) -> core::option::Option -pub const fn aya_ebpf::programs::sk_reuseport::SkReuseportContext::new(md: *mut aya_ebpf_bindings::x86_64::bindings::sk_reuseport_md) -> Self +pub const fn aya_ebpf::programs::sk_reuseport::SkReuseportContext::new(md: *mut aya_ebpf_bindings::aarch64::bindings::sk_reuseport_md) -> Self pub fn aya_ebpf::programs::sk_reuseport::SkReuseportContext::sk(&self) -> aya_ebpf::programs::sock::SockContext impl aya_ebpf::EbpfContext for aya_ebpf::programs::sk_reuseport::SkReuseportContext pub fn aya_ebpf::programs::sk_reuseport::SkReuseportContext::as_ptr(&self) -> *mut aya_ebpf_cty::c_void @@ -1434,9 +1508,9 @@ impl core::panic::unwind_safe::RefUnwindSafe for aya_ebpf::programs::sk_reusepor impl core::panic::unwind_safe::UnwindSafe for aya_ebpf::programs::sk_reuseport::SkReuseportContext pub mod aya_ebpf::programs::sock pub struct aya_ebpf::programs::sock::SockContext -pub aya_ebpf::programs::sock::SockContext::sock: *mut aya_ebpf_bindings::x86_64::bindings::bpf_sock +pub aya_ebpf::programs::sock::SockContext::sock: *mut aya_ebpf_bindings::aarch64::bindings::bpf_sock impl aya_ebpf::programs::sock::SockContext -pub const fn aya_ebpf::programs::sock::SockContext::new(sock: *mut aya_ebpf_bindings::x86_64::bindings::bpf_sock) -> Self +pub const fn aya_ebpf::programs::sock::SockContext::new(sock: *mut aya_ebpf_bindings::aarch64::bindings::bpf_sock) -> Self impl aya_ebpf::EbpfContext for aya_ebpf::programs::sock::SockContext pub fn aya_ebpf::programs::sock::SockContext::as_ptr(&self) -> *mut core::ffi::c_void pub fn aya_ebpf::programs::sock::SockContext::command(&self) -> core::result::Result<[u8; 16], i32> @@ -1453,9 +1527,9 @@ impl core::panic::unwind_safe::RefUnwindSafe for aya_ebpf::programs::sock::SockC impl core::panic::unwind_safe::UnwindSafe for aya_ebpf::programs::sock::SockContext pub mod aya_ebpf::programs::sock_addr pub struct aya_ebpf::programs::sock_addr::SockAddrContext -pub aya_ebpf::programs::sock_addr::SockAddrContext::sock_addr: *mut aya_ebpf_bindings::x86_64::bindings::bpf_sock_addr +pub aya_ebpf::programs::sock_addr::SockAddrContext::sock_addr: *mut aya_ebpf_bindings::aarch64::bindings::bpf_sock_addr impl aya_ebpf::programs::sock_addr::SockAddrContext -pub const fn aya_ebpf::programs::sock_addr::SockAddrContext::new(sock_addr: *mut aya_ebpf_bindings::x86_64::bindings::bpf_sock_addr) -> Self +pub const fn aya_ebpf::programs::sock_addr::SockAddrContext::new(sock_addr: *mut aya_ebpf_bindings::aarch64::bindings::bpf_sock_addr) -> Self impl aya_ebpf::EbpfContext for aya_ebpf::programs::sock_addr::SockAddrContext pub fn aya_ebpf::programs::sock_addr::SockAddrContext::as_ptr(&self) -> *mut core::ffi::c_void pub fn aya_ebpf::programs::sock_addr::SockAddrContext::command(&self) -> core::result::Result<[u8; 16], i32> @@ -1472,7 +1546,7 @@ impl core::panic::unwind_safe::RefUnwindSafe for aya_ebpf::programs::sock_addr:: impl core::panic::unwind_safe::UnwindSafe for aya_ebpf::programs::sock_addr::SockAddrContext pub mod aya_ebpf::programs::sock_ops pub struct aya_ebpf::programs::sock_ops::SockOpsContext -pub aya_ebpf::programs::sock_ops::SockOpsContext::ops: *mut aya_ebpf_bindings::x86_64::bindings::bpf_sock_ops +pub aya_ebpf::programs::sock_ops::SockOpsContext::ops: *mut aya_ebpf_bindings::aarch64::bindings::bpf_sock_ops impl aya_ebpf::programs::sock_ops::SockOpsContext pub fn aya_ebpf::programs::sock_ops::SockOpsContext::arg(&self, n: usize) -> u32 pub fn aya_ebpf::programs::sock_ops::SockOpsContext::cb_flags(&self) -> u32 @@ -1480,7 +1554,7 @@ pub fn aya_ebpf::programs::sock_ops::SockOpsContext::family(&self) -> u32 pub fn aya_ebpf::programs::sock_ops::SockOpsContext::local_ip4(&self) -> u32 pub fn aya_ebpf::programs::sock_ops::SockOpsContext::local_ip6(&self) -> [u32; 4] pub fn aya_ebpf::programs::sock_ops::SockOpsContext::local_port(&self) -> u32 -pub const fn aya_ebpf::programs::sock_ops::SockOpsContext::new(ops: *mut aya_ebpf_bindings::x86_64::bindings::bpf_sock_ops) -> Self +pub const fn aya_ebpf::programs::sock_ops::SockOpsContext::new(ops: *mut aya_ebpf_bindings::aarch64::bindings::bpf_sock_ops) -> Self pub fn aya_ebpf::programs::sock_ops::SockOpsContext::op(&self) -> u32 pub fn aya_ebpf::programs::sock_ops::SockOpsContext::remote_ip4(&self) -> u32 pub fn aya_ebpf::programs::sock_ops::SockOpsContext::remote_ip6(&self) -> [u32; 4] @@ -1503,9 +1577,9 @@ impl core::panic::unwind_safe::RefUnwindSafe for aya_ebpf::programs::sock_ops::S impl core::panic::unwind_safe::UnwindSafe for aya_ebpf::programs::sock_ops::SockOpsContext pub mod aya_ebpf::programs::sockopt pub struct aya_ebpf::programs::sockopt::SockoptContext -pub aya_ebpf::programs::sockopt::SockoptContext::sockopt: *mut aya_ebpf_bindings::x86_64::bindings::bpf_sockopt +pub aya_ebpf::programs::sockopt::SockoptContext::sockopt: *mut aya_ebpf_bindings::aarch64::bindings::bpf_sockopt impl aya_ebpf::programs::sockopt::SockoptContext -pub const fn aya_ebpf::programs::sockopt::SockoptContext::new(sockopt: *mut aya_ebpf_bindings::x86_64::bindings::bpf_sockopt) -> Self +pub const fn aya_ebpf::programs::sockopt::SockoptContext::new(sockopt: *mut aya_ebpf_bindings::aarch64::bindings::bpf_sockopt) -> Self impl aya_ebpf::EbpfContext for aya_ebpf::programs::sockopt::SockoptContext pub fn aya_ebpf::programs::sockopt::SockoptContext::as_ptr(&self) -> *mut core::ffi::c_void pub fn aya_ebpf::programs::sockopt::SockoptContext::command(&self) -> core::result::Result<[u8; 16], i32> @@ -1522,9 +1596,9 @@ impl core::panic::unwind_safe::RefUnwindSafe for aya_ebpf::programs::sockopt::So impl core::panic::unwind_safe::UnwindSafe for aya_ebpf::programs::sockopt::SockoptContext pub mod aya_ebpf::programs::sysctl pub struct aya_ebpf::programs::sysctl::SysctlContext -pub aya_ebpf::programs::sysctl::SysctlContext::sysctl: *mut aya_ebpf_bindings::x86_64::bindings::bpf_sysctl +pub aya_ebpf::programs::sysctl::SysctlContext::sysctl: *mut aya_ebpf_bindings::aarch64::bindings::bpf_sysctl impl aya_ebpf::programs::sysctl::SysctlContext -pub const fn aya_ebpf::programs::sysctl::SysctlContext::new(sysctl: *mut aya_ebpf_bindings::x86_64::bindings::bpf_sysctl) -> Self +pub const fn aya_ebpf::programs::sysctl::SysctlContext::new(sysctl: *mut aya_ebpf_bindings::aarch64::bindings::bpf_sysctl) -> Self impl aya_ebpf::EbpfContext for aya_ebpf::programs::sysctl::SysctlContext pub fn aya_ebpf::programs::sysctl::SysctlContext::as_ptr(&self) -> *mut core::ffi::c_void pub fn aya_ebpf::programs::sysctl::SysctlContext::command(&self) -> core::result::Result<[u8; 16], i32> @@ -1557,7 +1631,7 @@ pub fn aya_ebpf::programs::tc::TcContext::l4_csum_replace(&self, offset: usize, pub fn aya_ebpf::programs::tc::TcContext::len(&self) -> u32 pub fn aya_ebpf::programs::tc::TcContext::load(&self, offset: usize) -> core::result::Result pub fn aya_ebpf::programs::tc::TcContext::load_bytes(&self, offset: usize, dst: &mut [u8]) -> core::result::Result -pub const fn aya_ebpf::programs::tc::TcContext::new(skb: *mut aya_ebpf_bindings::x86_64::bindings::__sk_buff) -> Self +pub const fn aya_ebpf::programs::tc::TcContext::new(skb: *mut aya_ebpf_bindings::aarch64::bindings::__sk_buff) -> Self pub fn aya_ebpf::programs::tc::TcContext::pull_data(&self, len: u32) -> core::result::Result<(), aya_ebpf_cty::od::c_long> pub fn aya_ebpf::programs::tc::TcContext::set_mark(&self, mark: u32) pub fn aya_ebpf::programs::tc::TcContext::store(&self, offset: usize, v: &T, flags: u64) -> core::result::Result<(), aya_ebpf_cty::od::c_long> @@ -1622,14 +1696,14 @@ pub trait aya_ebpf::programs::tracing::StackTraceMap: aya_ebpf::programs::tracin impl aya_ebpf::programs::tracing::StackTraceMap for T pub mod aya_ebpf::programs::xdp pub struct aya_ebpf::programs::xdp::XdpContext -pub aya_ebpf::programs::xdp::XdpContext::ctx: *mut aya_ebpf_bindings::x86_64::bindings::xdp_md +pub aya_ebpf::programs::xdp::XdpContext::ctx: *mut aya_ebpf_bindings::aarch64::bindings::xdp_md impl aya_ebpf::programs::xdp::XdpContext pub fn aya_ebpf::programs::xdp::XdpContext::data(&self) -> usize pub fn aya_ebpf::programs::xdp::XdpContext::data_end(&self) -> usize pub fn aya_ebpf::programs::xdp::XdpContext::ingress_ifindex(&self) -> usize pub fn aya_ebpf::programs::xdp::XdpContext::metadata(&self) -> usize pub fn aya_ebpf::programs::xdp::XdpContext::metadata_end(&self) -> usize -pub const fn aya_ebpf::programs::xdp::XdpContext::new(ctx: *mut aya_ebpf_bindings::x86_64::bindings::xdp_md) -> Self +pub const fn aya_ebpf::programs::xdp::XdpContext::new(ctx: *mut aya_ebpf_bindings::aarch64::bindings::xdp_md) -> Self pub fn aya_ebpf::programs::xdp::XdpContext::rx_queue_index(&self) -> u32 impl aya_ebpf::EbpfContext for aya_ebpf::programs::xdp::XdpContext pub fn aya_ebpf::programs::xdp::XdpContext::as_ptr(&self) -> *mut core::ffi::c_void @@ -1664,9 +1738,9 @@ impl core::marker::UnsafeUnpin for aya_ebpf::programs::tp_btf::BtfTracePointCont impl core::panic::unwind_safe::RefUnwindSafe for aya_ebpf::programs::tp_btf::BtfTracePointContext impl core::panic::unwind_safe::UnwindSafe for aya_ebpf::programs::tp_btf::BtfTracePointContext pub struct aya_ebpf::programs::DeviceContext -pub aya_ebpf::programs::DeviceContext::device: *mut aya_ebpf_bindings::x86_64::bindings::bpf_cgroup_dev_ctx +pub aya_ebpf::programs::DeviceContext::device: *mut aya_ebpf_bindings::aarch64::bindings::bpf_cgroup_dev_ctx impl aya_ebpf::programs::device::DeviceContext -pub const fn aya_ebpf::programs::device::DeviceContext::new(device: *mut aya_ebpf_bindings::x86_64::bindings::bpf_cgroup_dev_ctx) -> Self +pub const fn aya_ebpf::programs::device::DeviceContext::new(device: *mut aya_ebpf_bindings::aarch64::bindings::bpf_cgroup_dev_ctx) -> Self impl aya_ebpf::EbpfContext for aya_ebpf::programs::device::DeviceContext pub fn aya_ebpf::programs::device::DeviceContext::as_ptr(&self) -> *mut core::ffi::c_void pub fn aya_ebpf::programs::device::DeviceContext::command(&self) -> core::result::Result<[u8; 16], i32> @@ -1721,9 +1795,9 @@ pub struct aya_ebpf::programs::FlowDissectorContext impl aya_ebpf::programs::flow_dissector::FlowDissectorContext pub fn aya_ebpf::programs::flow_dissector::FlowDissectorContext::data(&self) -> usize pub fn aya_ebpf::programs::flow_dissector::FlowDissectorContext::data_end(&self) -> usize -pub fn aya_ebpf::programs::flow_dissector::FlowDissectorContext::flow_keys(&mut self) -> &mut aya_ebpf_bindings::x86_64::bindings::bpf_flow_keys +pub fn aya_ebpf::programs::flow_dissector::FlowDissectorContext::flow_keys(&mut self) -> &mut aya_ebpf_bindings::aarch64::bindings::bpf_flow_keys pub fn aya_ebpf::programs::flow_dissector::FlowDissectorContext::load_bytes(&self, offset: usize, dst: &mut [u8]) -> core::result::Result -pub const fn aya_ebpf::programs::flow_dissector::FlowDissectorContext::new(skb: *mut aya_ebpf_bindings::x86_64::bindings::__sk_buff) -> Self +pub const fn aya_ebpf::programs::flow_dissector::FlowDissectorContext::new(skb: *mut aya_ebpf_bindings::aarch64::bindings::__sk_buff) -> Self impl aya_ebpf::EbpfContext for aya_ebpf::programs::flow_dissector::FlowDissectorContext pub fn aya_ebpf::programs::flow_dissector::FlowDissectorContext::as_ptr(&self) -> *mut aya_ebpf_cty::c_void pub fn aya_ebpf::programs::flow_dissector::FlowDissectorContext::command(&self) -> core::result::Result<[u8; 16], i32> @@ -1757,9 +1831,9 @@ impl core::marker::UnsafeUnpin for aya_ebpf::programs::lsm::LsmContext impl core::panic::unwind_safe::RefUnwindSafe for aya_ebpf::programs::lsm::LsmContext impl core::panic::unwind_safe::UnwindSafe for aya_ebpf::programs::lsm::LsmContext pub struct aya_ebpf::programs::PerfEventContext -pub aya_ebpf::programs::PerfEventContext::ctx: *mut aya_ebpf_bindings::x86_64::bindings::bpf_perf_event_data +pub aya_ebpf::programs::PerfEventContext::ctx: *mut aya_ebpf_bindings::aarch64::bindings::bpf_perf_event_data impl aya_ebpf::programs::perf_event::PerfEventContext -pub const fn aya_ebpf::programs::perf_event::PerfEventContext::new(ctx: *mut aya_ebpf_bindings::x86_64::bindings::bpf_perf_event_data) -> Self +pub const fn aya_ebpf::programs::perf_event::PerfEventContext::new(ctx: *mut aya_ebpf_bindings::aarch64::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 pub fn aya_ebpf::programs::perf_event::PerfEventContext::command(&self) -> core::result::Result<[u8; 16], i32> @@ -1775,7 +1849,7 @@ impl core::marker::UnsafeUnpin for aya_ebpf::programs::perf_event::PerfEventCont impl core::panic::unwind_safe::RefUnwindSafe for aya_ebpf::programs::perf_event::PerfEventContext impl core::panic::unwind_safe::UnwindSafe for aya_ebpf::programs::perf_event::PerfEventContext pub struct aya_ebpf::programs::ProbeContext -pub aya_ebpf::programs::ProbeContext::regs: *mut aya_ebpf_bindings::x86_64::bindings::pt_regs +pub aya_ebpf::programs::ProbeContext::regs: *mut aya_ebpf_bindings::aarch64::bindings::user_pt_regs impl aya_ebpf::programs::probe::ProbeContext pub fn aya_ebpf::programs::probe::ProbeContext::arg(&self, n: usize) -> core::option::Option pub const fn aya_ebpf::programs::probe::ProbeContext::new(ctx: *mut core::ffi::c_void) -> Self @@ -1812,7 +1886,7 @@ impl core::marker::UnsafeUnpin for aya_ebpf::programs::raw_tracepoint::RawTraceP impl core::panic::unwind_safe::RefUnwindSafe for aya_ebpf::programs::raw_tracepoint::RawTracePointContext impl core::panic::unwind_safe::UnwindSafe for aya_ebpf::programs::raw_tracepoint::RawTracePointContext pub struct aya_ebpf::programs::RetProbeContext -pub aya_ebpf::programs::RetProbeContext::regs: *mut aya_ebpf_bindings::x86_64::bindings::pt_regs +pub aya_ebpf::programs::RetProbeContext::regs: *mut aya_ebpf_bindings::aarch64::bindings::user_pt_regs impl aya_ebpf::programs::retprobe::RetProbeContext pub const fn aya_ebpf::programs::retprobe::RetProbeContext::new(ctx: *mut core::ffi::c_void) -> Self pub fn aya_ebpf::programs::retprobe::RetProbeContext::ret(&self) -> T @@ -1844,7 +1918,7 @@ pub fn aya_ebpf::programs::sk_buff::SkBuffContext::l4_csum_replace(&self, offset pub fn aya_ebpf::programs::sk_buff::SkBuffContext::len(&self) -> u32 pub fn aya_ebpf::programs::sk_buff::SkBuffContext::load(&self, offset: usize) -> core::result::Result pub fn aya_ebpf::programs::sk_buff::SkBuffContext::load_bytes(&self, offset: usize, dst: &mut [u8]) -> core::result::Result -pub const fn aya_ebpf::programs::sk_buff::SkBuffContext::new(skb: *mut aya_ebpf_bindings::x86_64::bindings::__sk_buff) -> Self +pub const fn aya_ebpf::programs::sk_buff::SkBuffContext::new(skb: *mut aya_ebpf_bindings::aarch64::bindings::__sk_buff) -> Self pub fn aya_ebpf::programs::sk_buff::SkBuffContext::pull_data(&self, len: u32) -> core::result::Result<(), aya_ebpf_cty::od::c_long> pub fn aya_ebpf::programs::sk_buff::SkBuffContext::set_mark(&self, mark: u32) pub fn aya_ebpf::programs::sk_buff::SkBuffContext::store(&self, offset: usize, v: &T, flags: u64) -> core::result::Result<(), aya_ebpf_cty::od::c_long> @@ -1863,9 +1937,9 @@ impl core::marker::UnsafeUnpin for aya_ebpf::programs::sk_buff::SkBuffContext impl core::panic::unwind_safe::RefUnwindSafe for aya_ebpf::programs::sk_buff::SkBuffContext impl core::panic::unwind_safe::UnwindSafe for aya_ebpf::programs::sk_buff::SkBuffContext pub struct aya_ebpf::programs::SkLookupContext -pub aya_ebpf::programs::SkLookupContext::lookup: *mut aya_ebpf_bindings::x86_64::bindings::bpf_sk_lookup +pub aya_ebpf::programs::SkLookupContext::lookup: *mut aya_ebpf_bindings::aarch64::bindings::bpf_sk_lookup impl aya_ebpf::programs::sk_lookup::SkLookupContext -pub const fn aya_ebpf::programs::sk_lookup::SkLookupContext::new(lookup: *mut aya_ebpf_bindings::x86_64::bindings::bpf_sk_lookup) -> Self +pub const fn aya_ebpf::programs::sk_lookup::SkLookupContext::new(lookup: *mut aya_ebpf_bindings::aarch64::bindings::bpf_sk_lookup) -> Self impl aya_ebpf::EbpfContext for aya_ebpf::programs::sk_lookup::SkLookupContext pub fn aya_ebpf::programs::sk_lookup::SkLookupContext::as_ptr(&self) -> *mut core::ffi::c_void pub fn aya_ebpf::programs::sk_lookup::SkLookupContext::command(&self) -> core::result::Result<[u8; 16], i32> @@ -1881,11 +1955,11 @@ impl core::marker::UnsafeUnpin for aya_ebpf::programs::sk_lookup::SkLookupContex impl core::panic::unwind_safe::RefUnwindSafe for aya_ebpf::programs::sk_lookup::SkLookupContext impl core::panic::unwind_safe::UnwindSafe for aya_ebpf::programs::sk_lookup::SkLookupContext pub struct aya_ebpf::programs::SkMsgContext -pub aya_ebpf::programs::SkMsgContext::msg: *mut aya_ebpf_bindings::x86_64::bindings::sk_msg_md +pub aya_ebpf::programs::SkMsgContext::msg: *mut aya_ebpf_bindings::aarch64::bindings::sk_msg_md impl aya_ebpf::programs::sk_msg::SkMsgContext pub fn aya_ebpf::programs::sk_msg::SkMsgContext::data(&self) -> usize pub fn aya_ebpf::programs::sk_msg::SkMsgContext::data_end(&self) -> usize -pub const fn aya_ebpf::programs::sk_msg::SkMsgContext::new(msg: *mut aya_ebpf_bindings::x86_64::bindings::sk_msg_md) -> Self +pub const fn aya_ebpf::programs::sk_msg::SkMsgContext::new(msg: *mut aya_ebpf_bindings::aarch64::bindings::sk_msg_md) -> Self pub fn aya_ebpf::programs::sk_msg::SkMsgContext::pop_data(&self, start: u32, len: u32, flags: u64) -> core::result::Result<(), i32> pub fn aya_ebpf::programs::sk_msg::SkMsgContext::push_data(&self, start: u32, len: u32, flags: u64) -> core::result::Result<(), i32> pub fn aya_ebpf::programs::sk_msg::SkMsgContext::size(&self) -> u32 @@ -1904,7 +1978,7 @@ impl core::marker::UnsafeUnpin for aya_ebpf::programs::sk_msg::SkMsgContext impl core::panic::unwind_safe::RefUnwindSafe for aya_ebpf::programs::sk_msg::SkMsgContext impl core::panic::unwind_safe::UnwindSafe for aya_ebpf::programs::sk_msg::SkMsgContext pub struct aya_ebpf::programs::SkReuseportContext -pub aya_ebpf::programs::SkReuseportContext::md: *mut aya_ebpf_bindings::x86_64::bindings::sk_reuseport_md +pub aya_ebpf::programs::SkReuseportContext::md: *mut aya_ebpf_bindings::aarch64::bindings::sk_reuseport_md impl aya_ebpf::programs::sk_reuseport::SkReuseportContext pub fn aya_ebpf::programs::sk_reuseport::SkReuseportContext::bind_inany(&self) -> u32 pub fn aya_ebpf::programs::sk_reuseport::SkReuseportContext::data(&self) -> usize @@ -1915,7 +1989,7 @@ pub fn aya_ebpf::programs::sk_reuseport::SkReuseportContext::ip_protocol(&self) pub fn aya_ebpf::programs::sk_reuseport::SkReuseportContext::is_empty(&self) -> bool pub fn aya_ebpf::programs::sk_reuseport::SkReuseportContext::len(&self) -> usize pub fn aya_ebpf::programs::sk_reuseport::SkReuseportContext::migrating_sk(&self) -> core::option::Option -pub const fn aya_ebpf::programs::sk_reuseport::SkReuseportContext::new(md: *mut aya_ebpf_bindings::x86_64::bindings::sk_reuseport_md) -> Self +pub const fn aya_ebpf::programs::sk_reuseport::SkReuseportContext::new(md: *mut aya_ebpf_bindings::aarch64::bindings::sk_reuseport_md) -> Self pub fn aya_ebpf::programs::sk_reuseport::SkReuseportContext::sk(&self) -> aya_ebpf::programs::sock::SockContext impl aya_ebpf::EbpfContext for aya_ebpf::programs::sk_reuseport::SkReuseportContext pub fn aya_ebpf::programs::sk_reuseport::SkReuseportContext::as_ptr(&self) -> *mut aya_ebpf_cty::c_void @@ -1932,9 +2006,9 @@ impl core::marker::UnsafeUnpin for aya_ebpf::programs::sk_reuseport::SkReuseport impl core::panic::unwind_safe::RefUnwindSafe for aya_ebpf::programs::sk_reuseport::SkReuseportContext impl core::panic::unwind_safe::UnwindSafe for aya_ebpf::programs::sk_reuseport::SkReuseportContext pub struct aya_ebpf::programs::SockAddrContext -pub aya_ebpf::programs::SockAddrContext::sock_addr: *mut aya_ebpf_bindings::x86_64::bindings::bpf_sock_addr +pub aya_ebpf::programs::SockAddrContext::sock_addr: *mut aya_ebpf_bindings::aarch64::bindings::bpf_sock_addr impl aya_ebpf::programs::sock_addr::SockAddrContext -pub const fn aya_ebpf::programs::sock_addr::SockAddrContext::new(sock_addr: *mut aya_ebpf_bindings::x86_64::bindings::bpf_sock_addr) -> Self +pub const fn aya_ebpf::programs::sock_addr::SockAddrContext::new(sock_addr: *mut aya_ebpf_bindings::aarch64::bindings::bpf_sock_addr) -> Self impl aya_ebpf::EbpfContext for aya_ebpf::programs::sock_addr::SockAddrContext pub fn aya_ebpf::programs::sock_addr::SockAddrContext::as_ptr(&self) -> *mut core::ffi::c_void pub fn aya_ebpf::programs::sock_addr::SockAddrContext::command(&self) -> core::result::Result<[u8; 16], i32> @@ -1950,9 +2024,9 @@ impl core::marker::UnsafeUnpin for aya_ebpf::programs::sock_addr::SockAddrContex impl core::panic::unwind_safe::RefUnwindSafe for aya_ebpf::programs::sock_addr::SockAddrContext impl core::panic::unwind_safe::UnwindSafe for aya_ebpf::programs::sock_addr::SockAddrContext pub struct aya_ebpf::programs::SockContext -pub aya_ebpf::programs::SockContext::sock: *mut aya_ebpf_bindings::x86_64::bindings::bpf_sock +pub aya_ebpf::programs::SockContext::sock: *mut aya_ebpf_bindings::aarch64::bindings::bpf_sock impl aya_ebpf::programs::sock::SockContext -pub const fn aya_ebpf::programs::sock::SockContext::new(sock: *mut aya_ebpf_bindings::x86_64::bindings::bpf_sock) -> Self +pub const fn aya_ebpf::programs::sock::SockContext::new(sock: *mut aya_ebpf_bindings::aarch64::bindings::bpf_sock) -> Self impl aya_ebpf::EbpfContext for aya_ebpf::programs::sock::SockContext pub fn aya_ebpf::programs::sock::SockContext::as_ptr(&self) -> *mut core::ffi::c_void pub fn aya_ebpf::programs::sock::SockContext::command(&self) -> core::result::Result<[u8; 16], i32> @@ -1968,7 +2042,7 @@ impl core::marker::UnsafeUnpin for aya_ebpf::programs::sock::SockContext impl core::panic::unwind_safe::RefUnwindSafe for aya_ebpf::programs::sock::SockContext impl core::panic::unwind_safe::UnwindSafe for aya_ebpf::programs::sock::SockContext pub struct aya_ebpf::programs::SockOpsContext -pub aya_ebpf::programs::SockOpsContext::ops: *mut aya_ebpf_bindings::x86_64::bindings::bpf_sock_ops +pub aya_ebpf::programs::SockOpsContext::ops: *mut aya_ebpf_bindings::aarch64::bindings::bpf_sock_ops impl aya_ebpf::programs::sock_ops::SockOpsContext pub fn aya_ebpf::programs::sock_ops::SockOpsContext::arg(&self, n: usize) -> u32 pub fn aya_ebpf::programs::sock_ops::SockOpsContext::cb_flags(&self) -> u32 @@ -1976,7 +2050,7 @@ pub fn aya_ebpf::programs::sock_ops::SockOpsContext::family(&self) -> u32 pub fn aya_ebpf::programs::sock_ops::SockOpsContext::local_ip4(&self) -> u32 pub fn aya_ebpf::programs::sock_ops::SockOpsContext::local_ip6(&self) -> [u32; 4] pub fn aya_ebpf::programs::sock_ops::SockOpsContext::local_port(&self) -> u32 -pub const fn aya_ebpf::programs::sock_ops::SockOpsContext::new(ops: *mut aya_ebpf_bindings::x86_64::bindings::bpf_sock_ops) -> Self +pub const fn aya_ebpf::programs::sock_ops::SockOpsContext::new(ops: *mut aya_ebpf_bindings::aarch64::bindings::bpf_sock_ops) -> Self pub fn aya_ebpf::programs::sock_ops::SockOpsContext::op(&self) -> u32 pub fn aya_ebpf::programs::sock_ops::SockOpsContext::remote_ip4(&self) -> u32 pub fn aya_ebpf::programs::sock_ops::SockOpsContext::remote_ip6(&self) -> [u32; 4] @@ -1998,9 +2072,9 @@ impl core::marker::UnsafeUnpin for aya_ebpf::programs::sock_ops::SockOpsContext impl core::panic::unwind_safe::RefUnwindSafe for aya_ebpf::programs::sock_ops::SockOpsContext impl core::panic::unwind_safe::UnwindSafe for aya_ebpf::programs::sock_ops::SockOpsContext pub struct aya_ebpf::programs::SockoptContext -pub aya_ebpf::programs::SockoptContext::sockopt: *mut aya_ebpf_bindings::x86_64::bindings::bpf_sockopt +pub aya_ebpf::programs::SockoptContext::sockopt: *mut aya_ebpf_bindings::aarch64::bindings::bpf_sockopt impl aya_ebpf::programs::sockopt::SockoptContext -pub const fn aya_ebpf::programs::sockopt::SockoptContext::new(sockopt: *mut aya_ebpf_bindings::x86_64::bindings::bpf_sockopt) -> Self +pub const fn aya_ebpf::programs::sockopt::SockoptContext::new(sockopt: *mut aya_ebpf_bindings::aarch64::bindings::bpf_sockopt) -> Self impl aya_ebpf::EbpfContext for aya_ebpf::programs::sockopt::SockoptContext pub fn aya_ebpf::programs::sockopt::SockoptContext::as_ptr(&self) -> *mut core::ffi::c_void pub fn aya_ebpf::programs::sockopt::SockoptContext::command(&self) -> core::result::Result<[u8; 16], i32> @@ -2016,9 +2090,9 @@ impl core::marker::UnsafeUnpin for aya_ebpf::programs::sockopt::SockoptContext impl core::panic::unwind_safe::RefUnwindSafe for aya_ebpf::programs::sockopt::SockoptContext impl core::panic::unwind_safe::UnwindSafe for aya_ebpf::programs::sockopt::SockoptContext pub struct aya_ebpf::programs::SysctlContext -pub aya_ebpf::programs::SysctlContext::sysctl: *mut aya_ebpf_bindings::x86_64::bindings::bpf_sysctl +pub aya_ebpf::programs::SysctlContext::sysctl: *mut aya_ebpf_bindings::aarch64::bindings::bpf_sysctl impl aya_ebpf::programs::sysctl::SysctlContext -pub const fn aya_ebpf::programs::sysctl::SysctlContext::new(sysctl: *mut aya_ebpf_bindings::x86_64::bindings::bpf_sysctl) -> Self +pub const fn aya_ebpf::programs::sysctl::SysctlContext::new(sysctl: *mut aya_ebpf_bindings::aarch64::bindings::bpf_sysctl) -> Self impl aya_ebpf::EbpfContext for aya_ebpf::programs::sysctl::SysctlContext pub fn aya_ebpf::programs::sysctl::SysctlContext::as_ptr(&self) -> *mut core::ffi::c_void pub fn aya_ebpf::programs::sysctl::SysctlContext::command(&self) -> core::result::Result<[u8; 16], i32> @@ -2050,7 +2124,7 @@ pub fn aya_ebpf::programs::tc::TcContext::l4_csum_replace(&self, offset: usize, pub fn aya_ebpf::programs::tc::TcContext::len(&self) -> u32 pub fn aya_ebpf::programs::tc::TcContext::load(&self, offset: usize) -> core::result::Result pub fn aya_ebpf::programs::tc::TcContext::load_bytes(&self, offset: usize, dst: &mut [u8]) -> core::result::Result -pub const fn aya_ebpf::programs::tc::TcContext::new(skb: *mut aya_ebpf_bindings::x86_64::bindings::__sk_buff) -> Self +pub const fn aya_ebpf::programs::tc::TcContext::new(skb: *mut aya_ebpf_bindings::aarch64::bindings::__sk_buff) -> Self pub fn aya_ebpf::programs::tc::TcContext::pull_data(&self, len: u32) -> core::result::Result<(), aya_ebpf_cty::od::c_long> pub fn aya_ebpf::programs::tc::TcContext::set_mark(&self, mark: u32) pub fn aya_ebpf::programs::tc::TcContext::store(&self, offset: usize, v: &T, flags: u64) -> core::result::Result<(), aya_ebpf_cty::od::c_long> @@ -2087,14 +2161,14 @@ impl core::marker::UnsafeUnpin for aya_ebpf::programs::tracepoint::TracePointCon impl core::panic::unwind_safe::RefUnwindSafe for aya_ebpf::programs::tracepoint::TracePointContext impl core::panic::unwind_safe::UnwindSafe for aya_ebpf::programs::tracepoint::TracePointContext pub struct aya_ebpf::programs::XdpContext -pub aya_ebpf::programs::XdpContext::ctx: *mut aya_ebpf_bindings::x86_64::bindings::xdp_md +pub aya_ebpf::programs::XdpContext::ctx: *mut aya_ebpf_bindings::aarch64::bindings::xdp_md impl aya_ebpf::programs::xdp::XdpContext pub fn aya_ebpf::programs::xdp::XdpContext::data(&self) -> usize pub fn aya_ebpf::programs::xdp::XdpContext::data_end(&self) -> usize pub fn aya_ebpf::programs::xdp::XdpContext::ingress_ifindex(&self) -> usize pub fn aya_ebpf::programs::xdp::XdpContext::metadata(&self) -> usize pub fn aya_ebpf::programs::xdp::XdpContext::metadata_end(&self) -> usize -pub const fn aya_ebpf::programs::xdp::XdpContext::new(ctx: *mut aya_ebpf_bindings::x86_64::bindings::xdp_md) -> Self +pub const fn aya_ebpf::programs::xdp::XdpContext::new(ctx: *mut aya_ebpf_bindings::aarch64::bindings::xdp_md) -> Self pub fn aya_ebpf::programs::xdp::XdpContext::rx_queue_index(&self) -> u32 impl aya_ebpf::EbpfContext for aya_ebpf::programs::xdp::XdpContext pub fn aya_ebpf::programs::xdp::XdpContext::as_ptr(&self) -> *mut core::ffi::c_void diff --git a/xtask/public-api/aya-obj.txt b/xtask/public-api/aya-obj.txt index 92988819d5..fcb5dfa768 100644 --- a/xtask/public-api/aya-obj.txt +++ b/xtask/public-api/aya-obj.txt @@ -4,6 +4,8 @@ pub enum aya_obj::btf::BtfError pub aya_obj::btf::BtfError::FileError pub aya_obj::btf::BtfError::FileError::error: std::io::error::Error pub aya_obj::btf::BtfError::FileError::path: std::path::PathBuf +pub aya_obj::btf::BtfError::InnerMapCannotBePinned +pub aya_obj::btf::BtfError::InnerMapCannotBePinned::name: alloc::string::String pub aya_obj::btf::BtfError::InvalidDatasec pub aya_obj::btf::BtfError::InvalidHeader pub aya_obj::btf::BtfError::InvalidInfo @@ -23,11 +25,15 @@ pub aya_obj::btf::BtfError::InvalidSymbolName pub aya_obj::btf::BtfError::InvalidTypeInfo pub aya_obj::btf::BtfError::InvalidTypeKind pub aya_obj::btf::BtfError::InvalidTypeKind::kind: u32 +pub aya_obj::btf::BtfError::InvalidValuesSpec +pub aya_obj::btf::BtfError::InvalidValuesSpec::name: alloc::string::String pub aya_obj::btf::BtfError::LoadError pub aya_obj::btf::BtfError::LoadError::io_error: std::io::error::Error pub aya_obj::btf::BtfError::LoadError::verifier_log: aya_obj::VerifierLog pub aya_obj::btf::BtfError::MaximumTypeDepthReached pub aya_obj::btf::BtfError::MaximumTypeDepthReached::type_id: u32 +pub aya_obj::btf::BtfError::MultiLevelMapInMapNotSupported +pub aya_obj::btf::BtfError::MultiLevelMapInMapNotSupported::name: alloc::string::String pub aya_obj::btf::BtfError::SymbolOffsetNotFound pub aya_obj::btf::BtfError::SymbolOffsetNotFound::symbol_name: alloc::string::String pub aya_obj::btf::BtfError::UnexpectedBtfType @@ -4475,11 +4481,13 @@ pub aya_obj::maps::Map::Legacy(aya_obj::maps::LegacyMap) impl aya_obj::maps::Map pub fn aya_obj::maps::Map::data(&self) -> &[u8] pub fn aya_obj::maps::Map::data_mut(&mut self) -> &mut alloc::vec::Vec +pub fn aya_obj::maps::Map::inner(&self) -> core::option::Option pub const fn aya_obj::maps::Map::key_size(&self) -> u32 pub const fn aya_obj::maps::Map::map_extra(&self) -> u64 pub const fn aya_obj::maps::Map::map_flags(&self) -> u32 pub const fn aya_obj::maps::Map::map_type(&self) -> u32 pub const fn aya_obj::maps::Map::max_entries(&self) -> u32 +pub const fn aya_obj::maps::Map::new_from_params(map_type: u32, key_size: u32, value_size: u32, max_entries: u32, flags: u32) -> Self pub const fn aya_obj::maps::Map::pinning(&self) -> aya_obj::maps::PinningType pub const fn aya_obj::maps::Map::section_index(&self) -> usize pub const fn aya_obj::maps::Map::section_kind(&self) -> aya_obj::EbpfSectionKind @@ -4574,6 +4582,7 @@ impl core::panic::unwind_safe::UnwindSafe for aya_obj::maps::BtfMapDef pub struct aya_obj::maps::LegacyMap pub aya_obj::maps::LegacyMap::data: alloc::vec::Vec pub aya_obj::maps::LegacyMap::def: aya_obj::maps::bpf_map_def +pub aya_obj::maps::LegacyMap::inner_def: core::option::Option pub aya_obj::maps::LegacyMap::section_index: usize pub aya_obj::maps::LegacyMap::section_kind: aya_obj::EbpfSectionKind pub aya_obj::maps::LegacyMap::symbol_index: core::option::Option @@ -5216,11 +5225,13 @@ pub aya_obj::Map::Legacy(aya_obj::maps::LegacyMap) impl aya_obj::maps::Map pub fn aya_obj::maps::Map::data(&self) -> &[u8] pub fn aya_obj::maps::Map::data_mut(&mut self) -> &mut alloc::vec::Vec +pub fn aya_obj::maps::Map::inner(&self) -> core::option::Option pub const fn aya_obj::maps::Map::key_size(&self) -> u32 pub const fn aya_obj::maps::Map::map_extra(&self) -> u64 pub const fn aya_obj::maps::Map::map_flags(&self) -> u32 pub const fn aya_obj::maps::Map::map_type(&self) -> u32 pub const fn aya_obj::maps::Map::max_entries(&self) -> u32 +pub const fn aya_obj::maps::Map::new_from_params(map_type: u32, key_size: u32, value_size: u32, max_entries: u32, flags: u32) -> Self pub const fn aya_obj::maps::Map::pinning(&self) -> aya_obj::maps::PinningType pub const fn aya_obj::maps::Map::section_index(&self) -> usize pub const fn aya_obj::maps::Map::section_kind(&self) -> aya_obj::EbpfSectionKind diff --git a/xtask/public-api/aya.txt b/xtask/public-api/aya.txt index eeeae67c82..952854f733 100644 --- a/xtask/public-api/aya.txt +++ b/xtask/public-api/aya.txt @@ -236,6 +236,64 @@ impl core::marker::Unpin for aya::maps::lpm_trie::LpmTrie wher impl core::marker::UnsafeUnpin for aya::maps::lpm_trie::LpmTrie where T: core::marker::UnsafeUnpin impl core::panic::unwind_safe::RefUnwindSafe for aya::maps::lpm_trie::LpmTrie where T: core::panic::unwind_safe::RefUnwindSafe, K: core::panic::unwind_safe::RefUnwindSafe, V: core::panic::unwind_safe::RefUnwindSafe impl core::panic::unwind_safe::UnwindSafe for aya::maps::lpm_trie::LpmTrie where T: core::panic::unwind_safe::UnwindSafe, K: core::panic::unwind_safe::UnwindSafe, V: core::panic::unwind_safe::UnwindSafe +pub mod aya::maps::of_maps +pub struct aya::maps::of_maps::ArrayOfMaps +impl, V: aya::maps::FromMapData> aya::maps::ArrayOfMaps +pub fn aya::maps::ArrayOfMaps::get(&self, index: &u32, flags: u64) -> core::result::Result +impl, V> aya::maps::ArrayOfMaps +pub fn aya::maps::ArrayOfMaps::is_empty(&self) -> bool +pub fn aya::maps::ArrayOfMaps::len(&self) -> u32 +impl, V: aya::maps::InnerMap> aya::maps::ArrayOfMaps +pub fn aya::maps::ArrayOfMaps::set(&mut self, index: u32, value: &V, flags: u64) -> core::result::Result<(), aya::maps::MapError> +impl aya::maps::ArrayOfMaps +pub fn aya::maps::ArrayOfMaps::pin>(self, path: P) -> core::result::Result<(), aya::pin::PinError> +impl<'a, V: aya::maps::InnerMap> core::convert::TryFrom<&'a aya::maps::Map> for aya::maps::ArrayOfMaps<&'a aya::maps::MapData, V> +pub type aya::maps::ArrayOfMaps<&'a aya::maps::MapData, V>::Error = aya::maps::MapError +pub fn aya::maps::ArrayOfMaps<&'a aya::maps::MapData, V>::try_from(map: &'a aya::maps::Map) -> core::result::Result +impl<'a, V: aya::maps::InnerMap> core::convert::TryFrom<&'a mut aya::maps::Map> for aya::maps::ArrayOfMaps<&'a mut aya::maps::MapData, V> +pub type aya::maps::ArrayOfMaps<&'a mut aya::maps::MapData, V>::Error = aya::maps::MapError +pub fn aya::maps::ArrayOfMaps<&'a mut aya::maps::MapData, V>::try_from(map: &'a mut aya::maps::Map) -> core::result::Result +impl core::fmt::Debug for aya::maps::ArrayOfMaps +pub fn aya::maps::ArrayOfMaps::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result +impl core::convert::TryFrom for aya::maps::ArrayOfMaps +pub type aya::maps::ArrayOfMaps::Error = aya::maps::MapError +pub fn aya::maps::ArrayOfMaps::try_from(map: aya::maps::Map) -> core::result::Result +impl core::marker::Freeze for aya::maps::ArrayOfMaps where T: core::marker::Freeze +impl core::marker::Send for aya::maps::ArrayOfMaps where T: core::marker::Send, V: core::marker::Send +impl core::marker::Sync for aya::maps::ArrayOfMaps where T: core::marker::Sync, V: core::marker::Sync +impl core::marker::Unpin for aya::maps::ArrayOfMaps where T: core::marker::Unpin, V: core::marker::Unpin +impl core::marker::UnsafeUnpin for aya::maps::ArrayOfMaps where T: core::marker::UnsafeUnpin +impl core::panic::unwind_safe::RefUnwindSafe for aya::maps::ArrayOfMaps where T: core::panic::unwind_safe::RefUnwindSafe, V: core::panic::unwind_safe::RefUnwindSafe +impl core::panic::unwind_safe::UnwindSafe for aya::maps::ArrayOfMaps where T: core::panic::unwind_safe::UnwindSafe, V: core::panic::unwind_safe::UnwindSafe +pub struct aya::maps::of_maps::HashOfMaps +impl aya::maps::HashOfMaps +pub fn aya::maps::HashOfMaps::pin>(self, path: P) -> core::result::Result<(), aya::pin::PinError> +impl, K: aya::Pod, V: aya::maps::FromMapData> aya::maps::HashOfMaps +pub fn aya::maps::HashOfMaps::get(&self, key: &K, flags: u64) -> core::result::Result +impl, K: aya::Pod, V> aya::maps::HashOfMaps +pub fn aya::maps::HashOfMaps::keys(&self) -> aya::maps::MapKeys<'_, K> +impl, K: aya::Pod, V: aya::maps::InnerMap> aya::maps::HashOfMaps +pub fn aya::maps::HashOfMaps::insert(&mut self, key: impl core::borrow::Borrow, value: &V, flags: u64) -> core::result::Result<(), aya::maps::MapError> +impl, K: aya::Pod, V> aya::maps::HashOfMaps +pub fn aya::maps::HashOfMaps::remove(&mut self, key: &K) -> core::result::Result<(), aya::maps::MapError> +impl<'a, K: aya::Pod, V: aya::maps::InnerMap> core::convert::TryFrom<&'a aya::maps::Map> for aya::maps::HashOfMaps<&'a aya::maps::MapData, K, V> +pub type aya::maps::HashOfMaps<&'a aya::maps::MapData, K, V>::Error = aya::maps::MapError +pub fn aya::maps::HashOfMaps<&'a aya::maps::MapData, K, V>::try_from(map: &'a aya::maps::Map) -> core::result::Result +impl<'a, K: aya::Pod, V: aya::maps::InnerMap> core::convert::TryFrom<&'a mut aya::maps::Map> for aya::maps::HashOfMaps<&'a mut aya::maps::MapData, K, V> +pub type aya::maps::HashOfMaps<&'a mut aya::maps::MapData, K, V>::Error = aya::maps::MapError +pub fn aya::maps::HashOfMaps<&'a mut aya::maps::MapData, K, V>::try_from(map: &'a mut aya::maps::Map) -> core::result::Result +impl core::convert::TryFrom for aya::maps::HashOfMaps +pub type aya::maps::HashOfMaps::Error = aya::maps::MapError +pub fn aya::maps::HashOfMaps::try_from(map: aya::maps::Map) -> core::result::Result +impl core::fmt::Debug for aya::maps::HashOfMaps +pub fn aya::maps::HashOfMaps::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result +impl core::marker::Freeze for aya::maps::HashOfMaps where T: core::marker::Freeze +impl core::marker::Send for aya::maps::HashOfMaps where T: core::marker::Send, K: core::marker::Send, V: core::marker::Send +impl core::marker::Sync for aya::maps::HashOfMaps where T: core::marker::Sync, K: core::marker::Sync, V: core::marker::Sync +impl core::marker::Unpin for aya::maps::HashOfMaps where T: core::marker::Unpin, K: core::marker::Unpin, V: core::marker::Unpin +impl core::marker::UnsafeUnpin for aya::maps::HashOfMaps where T: core::marker::UnsafeUnpin +impl core::panic::unwind_safe::RefUnwindSafe for aya::maps::HashOfMaps where T: core::panic::unwind_safe::RefUnwindSafe, K: core::panic::unwind_safe::RefUnwindSafe, V: core::panic::unwind_safe::RefUnwindSafe +impl core::panic::unwind_safe::UnwindSafe for aya::maps::HashOfMaps where T: core::panic::unwind_safe::UnwindSafe, K: core::panic::unwind_safe::UnwindSafe, V: core::panic::unwind_safe::UnwindSafe pub mod aya::maps::perf pub enum aya::maps::perf::PerfBufferError pub aya::maps::perf::PerfBufferError::IOError(std::io::error::Error) @@ -710,11 +768,13 @@ impl core::panic::unwind_safe::RefUnwindSafe for aya::maps::XskMap where T impl core::panic::unwind_safe::UnwindSafe for aya::maps::XskMap where T: core::panic::unwind_safe::UnwindSafe pub enum aya::maps::Map pub aya::maps::Map::Array(aya::maps::MapData) +pub aya::maps::Map::ArrayOfMaps(aya::maps::MapData) pub aya::maps::Map::BloomFilter(aya::maps::MapData) pub aya::maps::Map::CpuMap(aya::maps::MapData) pub aya::maps::Map::DevMap(aya::maps::MapData) pub aya::maps::Map::DevMapHash(aya::maps::MapData) pub aya::maps::Map::HashMap(aya::maps::MapData) +pub aya::maps::Map::HashOfMaps(aya::maps::MapData) pub aya::maps::Map::LpmTrie(aya::maps::MapData) pub aya::maps::Map::LruHashMap(aya::maps::MapData) pub aya::maps::Map::PerCpuArray(aya::maps::MapData) @@ -733,6 +793,7 @@ pub aya::maps::Map::StackTraceMap(aya::maps::MapData) pub aya::maps::Map::Unsupported(aya::maps::MapData) pub aya::maps::Map::XskMap(aya::maps::MapData) impl aya::maps::Map +pub const fn aya::maps::Map::fd(&self) -> &aya::maps::MapFd pub fn aya::maps::Map::from_map_data(map_data: aya::maps::MapData) -> core::result::Result pub fn aya::maps::Map::pin>(&self, path: P) -> core::result::Result<(), aya::pin::PinError> impl core::convert::TryFrom for aya::maps::CpuMap @@ -785,6 +846,12 @@ pub fn aya::maps::hash_map::PerCpuHashMap<&'a mut aya::maps::MapData, K, V>::try impl<'a, K: aya::Pod, V: aya::Pod> core::convert::TryFrom<&'a mut aya::maps::Map> for aya::maps::lpm_trie::LpmTrie<&'a mut aya::maps::MapData, K, V> pub type aya::maps::lpm_trie::LpmTrie<&'a mut aya::maps::MapData, K, V>::Error = aya::maps::MapError pub fn aya::maps::lpm_trie::LpmTrie<&'a mut aya::maps::MapData, K, V>::try_from(map: &'a mut aya::maps::Map) -> core::result::Result +impl<'a, K: aya::Pod, V: aya::maps::InnerMap> core::convert::TryFrom<&'a aya::maps::Map> for aya::maps::HashOfMaps<&'a aya::maps::MapData, K, V> +pub type aya::maps::HashOfMaps<&'a aya::maps::MapData, K, V>::Error = aya::maps::MapError +pub fn aya::maps::HashOfMaps<&'a aya::maps::MapData, K, V>::try_from(map: &'a aya::maps::Map) -> core::result::Result +impl<'a, K: aya::Pod, V: aya::maps::InnerMap> core::convert::TryFrom<&'a mut aya::maps::Map> for aya::maps::HashOfMaps<&'a mut aya::maps::MapData, K, V> +pub type aya::maps::HashOfMaps<&'a mut aya::maps::MapData, K, V>::Error = aya::maps::MapError +pub fn aya::maps::HashOfMaps<&'a mut aya::maps::MapData, K, V>::try_from(map: &'a mut aya::maps::Map) -> core::result::Result impl<'a, V: aya::Pod> core::convert::TryFrom<&'a aya::maps::Map> for aya::maps::PerCpuArray<&'a aya::maps::MapData, V> pub type aya::maps::PerCpuArray<&'a aya::maps::MapData, V>::Error = aya::maps::MapError pub fn aya::maps::PerCpuArray<&'a aya::maps::MapData, V>::try_from(map: &'a aya::maps::Map) -> core::result::Result @@ -827,6 +894,12 @@ pub fn aya::maps::sk_storage::SkStorage<&'a mut aya::maps::MapData, V>::try_from impl<'a, V: aya::Pod> core::convert::TryFrom<&'a mut aya::maps::Map> for aya::maps::stack::Stack<&'a mut aya::maps::MapData, V> pub type aya::maps::stack::Stack<&'a mut aya::maps::MapData, V>::Error = aya::maps::MapError pub fn aya::maps::stack::Stack<&'a mut aya::maps::MapData, V>::try_from(map: &'a mut aya::maps::Map) -> core::result::Result +impl<'a, V: aya::maps::InnerMap> core::convert::TryFrom<&'a aya::maps::Map> for aya::maps::ArrayOfMaps<&'a aya::maps::MapData, V> +pub type aya::maps::ArrayOfMaps<&'a aya::maps::MapData, V>::Error = aya::maps::MapError +pub fn aya::maps::ArrayOfMaps<&'a aya::maps::MapData, V>::try_from(map: &'a aya::maps::Map) -> core::result::Result +impl<'a, V: aya::maps::InnerMap> core::convert::TryFrom<&'a mut aya::maps::Map> for aya::maps::ArrayOfMaps<&'a mut aya::maps::MapData, V> +pub type aya::maps::ArrayOfMaps<&'a mut aya::maps::MapData, V>::Error = aya::maps::MapError +pub fn aya::maps::ArrayOfMaps<&'a mut aya::maps::MapData, V>::try_from(map: &'a mut aya::maps::Map) -> core::result::Result impl<'a> core::convert::TryFrom<&'a aya::maps::Map> for aya::maps::CpuMap<&'a aya::maps::MapData> pub type aya::maps::CpuMap<&'a aya::maps::MapData>::Error = aya::maps::MapError pub fn aya::maps::CpuMap<&'a aya::maps::MapData>::try_from(map: &'a aya::maps::Map) -> core::result::Result @@ -896,6 +969,9 @@ pub fn aya::maps::hash_map::PerCpuHashMap::try_from(ma impl core::convert::TryFrom for aya::maps::lpm_trie::LpmTrie pub type aya::maps::lpm_trie::LpmTrie::Error = aya::maps::MapError pub fn aya::maps::lpm_trie::LpmTrie::try_from(map: aya::maps::Map) -> core::result::Result +impl core::convert::TryFrom for aya::maps::HashOfMaps +pub type aya::maps::HashOfMaps::Error = aya::maps::MapError +pub fn aya::maps::HashOfMaps::try_from(map: aya::maps::Map) -> core::result::Result impl core::convert::TryFrom for aya::maps::PerCpuArray pub type aya::maps::PerCpuArray::Error = aya::maps::MapError pub fn aya::maps::PerCpuArray::try_from(map: aya::maps::Map) -> core::result::Result @@ -917,6 +993,9 @@ pub fn aya::maps::sk_storage::SkStorage::try_from(map: ay impl core::convert::TryFrom for aya::maps::stack::Stack pub type aya::maps::stack::Stack::Error = aya::maps::MapError pub fn aya::maps::stack::Stack::try_from(map: aya::maps::Map) -> core::result::Result +impl core::convert::TryFrom for aya::maps::ArrayOfMaps +pub type aya::maps::ArrayOfMaps::Error = aya::maps::MapError +pub fn aya::maps::ArrayOfMaps::try_from(map: aya::maps::Map) -> core::result::Result impl core::marker::Freeze for aya::maps::Map impl core::marker::Send for aya::maps::Map impl core::marker::Sync for aya::maps::Map @@ -944,6 +1023,8 @@ pub aya::maps::MapError::InvalidValueStride::size: usize pub aya::maps::MapError::InvalidValueStride::stride: usize pub aya::maps::MapError::IoError(std::io::error::Error) pub aya::maps::MapError::KeyNotFound +pub aya::maps::MapError::MissingInnerMapDefinition +pub aya::maps::MapError::MissingInnerMapDefinition::outer_name: alloc::string::String pub aya::maps::MapError::OutOfBounds pub aya::maps::MapError::OutOfBounds::index: u32 pub aya::maps::MapError::OutOfBounds::max_entries: u32 @@ -954,7 +1035,7 @@ pub aya::maps::MapError::ProgIdNotSupported pub aya::maps::MapError::ProgramNotLoaded pub aya::maps::MapError::SyscallError(aya::sys::SyscallError) pub aya::maps::MapError::Unsupported -pub aya::maps::MapError::Unsupported::map_type: aya_obj::generated::linux_bindings_x86_64::bpf_map_type +pub aya::maps::MapError::Unsupported::map_type: aya_obj::generated::linux_bindings_aarch64::bpf_map_type pub aya::maps::MapError::Unsupported::name: alloc::string::String pub aya::maps::MapError::UnsupportedMapFlags pub aya::maps::MapError::UnsupportedMapFlags::flags: u32 @@ -1023,9 +1104,9 @@ impl core::clone::Clone for aya::maps::MapType pub fn aya::maps::MapType::clone(&self) -> aya::maps::MapType impl core::cmp::PartialEq for aya::maps::MapType pub fn aya::maps::MapType::eq(&self, other: &aya::maps::MapType) -> bool -impl core::convert::TryFrom for aya::maps::MapType +impl core::convert::TryFrom for aya::maps::MapType pub type aya::maps::MapType::Error = aya::maps::MapError -pub fn aya::maps::MapType::try_from(map_type: aya_obj::generated::linux_bindings_x86_64::bpf_map_type) -> core::result::Result +pub fn aya::maps::MapType::try_from(map_type: aya_obj::generated::linux_bindings_aarch64::bpf_map_type) -> core::result::Result impl core::fmt::Debug for aya::maps::MapType pub fn aya::maps::MapType::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result impl core::marker::Copy for aya::maps::MapType @@ -1065,6 +1146,34 @@ impl core::marker::Unpin for aya::maps::array::Array where T: core:: impl core::marker::UnsafeUnpin for aya::maps::array::Array where T: core::marker::UnsafeUnpin impl core::panic::unwind_safe::RefUnwindSafe for aya::maps::array::Array where T: core::panic::unwind_safe::RefUnwindSafe, V: core::panic::unwind_safe::RefUnwindSafe impl core::panic::unwind_safe::UnwindSafe for aya::maps::array::Array where T: core::panic::unwind_safe::UnwindSafe, V: core::panic::unwind_safe::UnwindSafe +pub struct aya::maps::ArrayOfMaps +impl, V: aya::maps::FromMapData> aya::maps::ArrayOfMaps +pub fn aya::maps::ArrayOfMaps::get(&self, index: &u32, flags: u64) -> core::result::Result +impl, V> aya::maps::ArrayOfMaps +pub fn aya::maps::ArrayOfMaps::is_empty(&self) -> bool +pub fn aya::maps::ArrayOfMaps::len(&self) -> u32 +impl, V: aya::maps::InnerMap> aya::maps::ArrayOfMaps +pub fn aya::maps::ArrayOfMaps::set(&mut self, index: u32, value: &V, flags: u64) -> core::result::Result<(), aya::maps::MapError> +impl aya::maps::ArrayOfMaps +pub fn aya::maps::ArrayOfMaps::pin>(self, path: P) -> core::result::Result<(), aya::pin::PinError> +impl<'a, V: aya::maps::InnerMap> core::convert::TryFrom<&'a aya::maps::Map> for aya::maps::ArrayOfMaps<&'a aya::maps::MapData, V> +pub type aya::maps::ArrayOfMaps<&'a aya::maps::MapData, V>::Error = aya::maps::MapError +pub fn aya::maps::ArrayOfMaps<&'a aya::maps::MapData, V>::try_from(map: &'a aya::maps::Map) -> core::result::Result +impl<'a, V: aya::maps::InnerMap> core::convert::TryFrom<&'a mut aya::maps::Map> for aya::maps::ArrayOfMaps<&'a mut aya::maps::MapData, V> +pub type aya::maps::ArrayOfMaps<&'a mut aya::maps::MapData, V>::Error = aya::maps::MapError +pub fn aya::maps::ArrayOfMaps<&'a mut aya::maps::MapData, V>::try_from(map: &'a mut aya::maps::Map) -> core::result::Result +impl core::fmt::Debug for aya::maps::ArrayOfMaps +pub fn aya::maps::ArrayOfMaps::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result +impl core::convert::TryFrom for aya::maps::ArrayOfMaps +pub type aya::maps::ArrayOfMaps::Error = aya::maps::MapError +pub fn aya::maps::ArrayOfMaps::try_from(map: aya::maps::Map) -> core::result::Result +impl core::marker::Freeze for aya::maps::ArrayOfMaps where T: core::marker::Freeze +impl core::marker::Send for aya::maps::ArrayOfMaps where T: core::marker::Send, V: core::marker::Send +impl core::marker::Sync for aya::maps::ArrayOfMaps where T: core::marker::Sync, V: core::marker::Sync +impl core::marker::Unpin for aya::maps::ArrayOfMaps where T: core::marker::Unpin, V: core::marker::Unpin +impl core::marker::UnsafeUnpin for aya::maps::ArrayOfMaps where T: core::marker::UnsafeUnpin +impl core::panic::unwind_safe::RefUnwindSafe for aya::maps::ArrayOfMaps where T: core::panic::unwind_safe::RefUnwindSafe, V: core::panic::unwind_safe::RefUnwindSafe +impl core::panic::unwind_safe::UnwindSafe for aya::maps::ArrayOfMaps where T: core::panic::unwind_safe::UnwindSafe, V: core::panic::unwind_safe::UnwindSafe pub struct aya::maps::BloomFilter impl, V: aya::Pod> aya::maps::bloom_filter::BloomFilter pub fn aya::maps::bloom_filter::BloomFilter::contains(&self, value: impl core::borrow::Borrow, flags: u64) -> core::result::Result<(), aya::maps::MapError> @@ -1205,6 +1314,35 @@ impl core::marker::Unpin for aya::maps::hash_map::HashMap wher impl core::marker::UnsafeUnpin for aya::maps::hash_map::HashMap where T: core::marker::UnsafeUnpin impl core::panic::unwind_safe::RefUnwindSafe for aya::maps::hash_map::HashMap where T: core::panic::unwind_safe::RefUnwindSafe, K: core::panic::unwind_safe::RefUnwindSafe, V: core::panic::unwind_safe::RefUnwindSafe impl core::panic::unwind_safe::UnwindSafe for aya::maps::hash_map::HashMap where T: core::panic::unwind_safe::UnwindSafe, K: core::panic::unwind_safe::UnwindSafe, V: core::panic::unwind_safe::UnwindSafe +pub struct aya::maps::HashOfMaps +impl aya::maps::HashOfMaps +pub fn aya::maps::HashOfMaps::pin>(self, path: P) -> core::result::Result<(), aya::pin::PinError> +impl, K: aya::Pod, V: aya::maps::FromMapData> aya::maps::HashOfMaps +pub fn aya::maps::HashOfMaps::get(&self, key: &K, flags: u64) -> core::result::Result +impl, K: aya::Pod, V> aya::maps::HashOfMaps +pub fn aya::maps::HashOfMaps::keys(&self) -> aya::maps::MapKeys<'_, K> +impl, K: aya::Pod, V: aya::maps::InnerMap> aya::maps::HashOfMaps +pub fn aya::maps::HashOfMaps::insert(&mut self, key: impl core::borrow::Borrow, value: &V, flags: u64) -> core::result::Result<(), aya::maps::MapError> +impl, K: aya::Pod, V> aya::maps::HashOfMaps +pub fn aya::maps::HashOfMaps::remove(&mut self, key: &K) -> core::result::Result<(), aya::maps::MapError> +impl<'a, K: aya::Pod, V: aya::maps::InnerMap> core::convert::TryFrom<&'a aya::maps::Map> for aya::maps::HashOfMaps<&'a aya::maps::MapData, K, V> +pub type aya::maps::HashOfMaps<&'a aya::maps::MapData, K, V>::Error = aya::maps::MapError +pub fn aya::maps::HashOfMaps<&'a aya::maps::MapData, K, V>::try_from(map: &'a aya::maps::Map) -> core::result::Result +impl<'a, K: aya::Pod, V: aya::maps::InnerMap> core::convert::TryFrom<&'a mut aya::maps::Map> for aya::maps::HashOfMaps<&'a mut aya::maps::MapData, K, V> +pub type aya::maps::HashOfMaps<&'a mut aya::maps::MapData, K, V>::Error = aya::maps::MapError +pub fn aya::maps::HashOfMaps<&'a mut aya::maps::MapData, K, V>::try_from(map: &'a mut aya::maps::Map) -> core::result::Result +impl core::convert::TryFrom for aya::maps::HashOfMaps +pub type aya::maps::HashOfMaps::Error = aya::maps::MapError +pub fn aya::maps::HashOfMaps::try_from(map: aya::maps::Map) -> core::result::Result +impl core::fmt::Debug for aya::maps::HashOfMaps +pub fn aya::maps::HashOfMaps::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result +impl core::marker::Freeze for aya::maps::HashOfMaps where T: core::marker::Freeze +impl core::marker::Send for aya::maps::HashOfMaps where T: core::marker::Send, K: core::marker::Send, V: core::marker::Send +impl core::marker::Sync for aya::maps::HashOfMaps where T: core::marker::Sync, K: core::marker::Sync, V: core::marker::Sync +impl core::marker::Unpin for aya::maps::HashOfMaps where T: core::marker::Unpin, K: core::marker::Unpin, V: core::marker::Unpin +impl core::marker::UnsafeUnpin for aya::maps::HashOfMaps where T: core::marker::UnsafeUnpin +impl core::panic::unwind_safe::RefUnwindSafe for aya::maps::HashOfMaps where T: core::panic::unwind_safe::RefUnwindSafe, K: core::panic::unwind_safe::RefUnwindSafe, V: core::panic::unwind_safe::RefUnwindSafe +impl core::panic::unwind_safe::UnwindSafe for aya::maps::HashOfMaps where T: core::panic::unwind_safe::UnwindSafe, K: core::panic::unwind_safe::UnwindSafe, V: core::panic::unwind_safe::UnwindSafe pub struct aya::maps::LpmTrie impl, K: aya::Pod, V: aya::Pod> aya::maps::lpm_trie::LpmTrie pub fn aya::maps::lpm_trie::LpmTrie::get(&self, key: &aya::maps::lpm_trie::Key, flags: u64) -> core::result::Result @@ -1259,6 +1397,8 @@ impl core::marker::UnsafeUnpin for aya::maps::MapData impl core::panic::unwind_safe::RefUnwindSafe for aya::maps::MapData impl core::panic::unwind_safe::UnwindSafe for aya::maps::MapData pub struct aya::maps::MapFd +impl aya::maps::MapFd +pub fn aya::maps::MapFd::try_clone(&self) -> std::io::error::Result impl core::fmt::Debug for aya::maps::MapFd pub fn aya::maps::MapFd::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result impl std::os::fd::owned::AsFd for aya::maps::MapFd @@ -1680,6 +1820,14 @@ impl core::marker::Unpin for aya::maps::XskMap where T: core::marker::Unpi impl core::marker::UnsafeUnpin for aya::maps::XskMap where T: core::marker::UnsafeUnpin impl core::panic::unwind_safe::RefUnwindSafe for aya::maps::XskMap where T: core::panic::unwind_safe::RefUnwindSafe impl core::panic::unwind_safe::UnwindSafe for aya::maps::XskMap where T: core::panic::unwind_safe::UnwindSafe +pub trait aya::maps::CreatableMap: aya::maps::sealed::CreatableMap +pub fn aya::maps::CreatableMap::create(max_entries: u32, flags: u32) -> core::result::Result +impl aya::maps::CreatableMap for T +pub fn T::create(max_entries: u32, flags: u32) -> core::result::Result +pub trait aya::maps::FromMapData: core::marker::Sized + aya::maps::sealed::FromMapData +impl aya::maps::FromMapData for T +pub trait aya::maps::InnerMap: aya::maps::sealed::InnerMap +impl aya::maps::InnerMap for T pub trait aya::maps::IterableMap pub fn aya::maps::IterableMap::get(&self, key: &K) -> core::result::Result pub fn aya::maps::IterableMap::map(&self) -> &aya::maps::MapData @@ -2836,9 +2984,9 @@ impl core::clone::Clone for aya::programs::links::LinkType pub fn aya::programs::links::LinkType::clone(&self) -> aya::programs::links::LinkType impl core::cmp::PartialEq for aya::programs::links::LinkType pub fn aya::programs::links::LinkType::eq(&self, other: &aya::programs::links::LinkType) -> bool -impl core::convert::TryFrom for aya::programs::links::LinkType +impl core::convert::TryFrom for aya::programs::links::LinkType pub type aya::programs::links::LinkType::Error = aya::programs::links::LinkError -pub fn aya::programs::links::LinkType::try_from(link_type: aya_obj::generated::linux_bindings_x86_64::bpf_link_type) -> core::result::Result +pub fn aya::programs::links::LinkType::try_from(link_type: aya_obj::generated::linux_bindings_aarch64::bpf_link_type) -> core::result::Result impl core::fmt::Debug for aya::programs::links::LinkType pub fn aya::programs::links::LinkType::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result impl core::marker::Copy for aya::programs::links::LinkType @@ -5478,8 +5626,8 @@ impl core::clone::Clone for aya::programs::ProgramType pub fn aya::programs::ProgramType::clone(&self) -> aya::programs::ProgramType impl core::cmp::PartialEq for aya::programs::ProgramType pub fn aya::programs::ProgramType::eq(&self, other: &aya::programs::ProgramType) -> bool -impl core::convert::From for aya_obj::generated::linux_bindings_x86_64::bpf_prog_type -pub fn aya_obj::generated::linux_bindings_x86_64::bpf_prog_type::from(value: aya::programs::ProgramType) -> Self +impl core::convert::From for aya_obj::generated::linux_bindings_aarch64::bpf_prog_type +pub fn aya_obj::generated::linux_bindings_aarch64::bpf_prog_type::from(value: aya::programs::ProgramType) -> Self impl core::fmt::Debug for aya::programs::ProgramType pub fn aya::programs::ProgramType::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result impl core::marker::Copy for aya::programs::ProgramType @@ -6334,7 +6482,7 @@ pub fn aya::programs::ProgramInfo::map_ids(&self) -> core::result::Result core::result::Result pub fn aya::programs::ProgramInfo::name(&self) -> &[u8] pub fn aya::programs::ProgramInfo::name_as_str(&self) -> core::option::Option<&str> -pub fn aya::programs::ProgramInfo::program_type(&self) -> aya_obj::generated::linux_bindings_x86_64::bpf_prog_type +pub fn aya::programs::ProgramInfo::program_type(&self) -> aya_obj::generated::linux_bindings_aarch64::bpf_prog_type pub const fn aya::programs::ProgramInfo::run_count(&self) -> u64 pub const fn aya::programs::ProgramInfo::run_time(&self) -> core::time::Duration pub const fn aya::programs::ProgramInfo::size_jitted(&self) -> u32 @@ -6993,8 +7141,8 @@ pub mod aya::sys pub aya::sys::Stats::RunTime impl core::clone::Clone for aya::sys::Stats pub fn aya::sys::Stats::clone(&self) -> aya::sys::Stats -impl core::convert::From for aya_obj::generated::linux_bindings_x86_64::bpf_stats_type -pub fn aya_obj::generated::linux_bindings_x86_64::bpf_stats_type::from(value: aya::sys::Stats) -> Self +impl core::convert::From for aya_obj::generated::linux_bindings_aarch64::bpf_stats_type +pub fn aya_obj::generated::linux_bindings_aarch64::bpf_stats_type::from(value: aya::sys::Stats) -> Self impl core::fmt::Debug for aya::sys::Stats pub fn aya::sys::Stats::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result impl core::marker::Copy for aya::sys::Stats @@ -7254,8 +7402,8 @@ impl core::marker::UnsafeUnpin for aya::VerifierLogLevel impl core::panic::unwind_safe::RefUnwindSafe for aya::VerifierLogLevel impl core::panic::unwind_safe::UnwindSafe for aya::VerifierLogLevel pub unsafe trait aya::Pod: core::marker::Copy + 'static -impl aya::Pod for aya_obj::generated::linux_bindings_x86_64::bpf_cpumap_val -impl aya::Pod for aya_obj::generated::linux_bindings_x86_64::bpf_devmap_val +impl aya::Pod for aya_obj::generated::linux_bindings_aarch64::bpf_cpumap_val +impl aya::Pod for aya_obj::generated::linux_bindings_aarch64::bpf_devmap_val impl aya::Pod for i128 impl aya::Pod for i16 impl aya::Pod for i32