Core: Implement ArrayMap as BPF_MAP_TYPE_ARRAY

process_array_map was a stub raising NotImplementedError while ArrayMap
was exported from pythonbpf.maps as if usable. The lowering is the hash
map's with a different type constant: the same lookup/update/delete
helpers, and the kernel fixes the key at a 4-byte index. The lookup
allocation path accepts ARRAY alongside HASH, the audit tool lists
ARRAY as supported, and the array_map_lookup_update case is a passing
test now instead of a strict xfail.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Pragyansh Chaturvedi
2026-09-25 01:18:52 +05:30
parent efe58fc396
commit 3de9832792
5 changed files with 21 additions and 10 deletions

View File

@ -208,7 +208,7 @@ def _allocate_for_map_method(
return
map_params = map_sym_tab[map_name].params
if map_params["type"] != BPFMapType.HASH:
if map_params["type"] not in (BPFMapType.HASH, BPFMapType.ARRAY):
logger.warning(
"Map method lookup used on non-hash map, using fallback allocation"
)