diff --git a/ebpf/aya-ebpf/src/maps/hash_map.rs b/ebpf/aya-ebpf/src/maps/hash_map.rs index 765188dc..b1581229 100644 --- a/ebpf/aya-ebpf/src/maps/hash_map.rs +++ b/ebpf/aya-ebpf/src/maps/hash_map.rs @@ -85,6 +85,16 @@ impl HashMap { } } +impl HashMap { + /// Retrieve the value associate with `key` from the map. This can not lead + /// to memory/type-safety bugs because a corrupt scalar can only lead to + /// logic bugs. + #[inline] + pub fn get_corrupt_u32(&self, key: &K) -> Option<&u32> { + unsafe { get(self.def.get(), key) } + } +} + #[repr(transparent)] pub struct LruHashMap { def: UnsafeCell,