From d5e4e9270ae4214ced858582ecb7ec6fc979d77e Mon Sep 17 00:00:00 2001 From: Michal R Date: Mon, 15 Sep 2025 08:59:30 +0200 Subject: [PATCH] aya-ebpf: Remove irrelevant `FIXME` comment eBPF verifier in recent kernels should be smart enough to track map map types and catch invalid pointer casts. Rust type system makes sure that the `get` method can return only the same type the map was created with. Therefore, safe usage of Aya map types shouldn't cause element type mismatches. Manual alignment checks (`pointer::is_aligned` or manual pointer arithmetic operations) cause the following verifier error: ``` bitwise operator &= on pointer prohibited ``` And it extremely unlikely `bpf_map_lookup_elem` ever returns a misaligned pointer. --- ebpf/aya-ebpf/src/maps/array.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/ebpf/aya-ebpf/src/maps/array.rs b/ebpf/aya-ebpf/src/maps/array.rs index ca26e48b..17f0a269 100644 --- a/ebpf/aya-ebpf/src/maps/array.rs +++ b/ebpf/aya-ebpf/src/maps/array.rs @@ -49,7 +49,6 @@ impl Array { #[inline(always)] pub fn get(&self, index: u32) -> Option<&T> { - // FIXME: alignment unsafe { self.lookup(index).map(|p| p.as_ref()) } }