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>
- The subprog_call pattern also matched SEC("?..."), so every
non-autoloaded program counted as a BPF-to-BPF call blocker, in
contradiction with the soft rule for the same syntax.
- The kfunc pattern matched any bpf_xdp_* or bpf_skb_* call, which are
ordinary helpers (bpf_skb_store_bytes is in SUPPORTED_HELPERS). Only
the kfunc families keep those prefixes; an unsupported helper is still
a hard blocker, classified as one.
- strip_comments removed // inside string literals, truncating section
names like SEC("uprobe//proc/self/exe:func") and classifying the file
as a shim. Strings are matched first and kept.
- Every bpf_map_* helper not in SUPPORTED_HELPERS was dropped before the
unsupported-helper test, so bpf_map_push_elem and friends never showed
up as blockers. The membership test classifies them now.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The porting assessment was produced by a one-off script that scored every
program under tools/testing/selftests/bpf/progs against the compiler's
envelope; the notes recommended keeping it so the numbers can be regenerated
after each feature lands. This is that script, rebuilt: it strips comments,
skips include-shims and header-only fixtures, and reports per program the
hard blockers (language gaps) and soft flags (porting costs), with a
histogram and a near-miss listing. The helper, map and construct lists at
the top are the envelope and are maintained by hand.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DLMW3X7opqAPH6bjmTVkr7
* widen bitfields whose declared width exceeds their base type
clang2py can emit a bitfield typed as a smaller ctype than its own
declared width (e.g. a 15-bit field typed ctypes.c_ubyte, which only
has 8 bits) - ctypes rejects these with 'ValueError: number of bits
invalid for bit field'. Surfaced by struct_vmbus_channel_offer_channel
on a kernel with Hyper-V support enabled (not present locally, but
present on GitHub Actions' Azure-hosted runners).
Generalizes the existing c_bool-specific workaround to all integer
ctypes, widening to the smallest standard type that fits.
* fix ruff-format violation in vmlinux-gen.py
* Add CI workflow to run the test suite (#96)
* add CI workflow to run the test suite
Runs make test on every push/PR. Kernel verifier tests need passwordless
sudo and a kernel with BTF/BPF enabled, which isn't guaranteed on every
runner, so the workflow probes for working sudo first and only attempts
them if it's available.
Also add ctypeslib2 to the test extra: make test now regenerates
vmlinux.py via tools/vmlinux-gen.py, which needs clang2py.
* fix CI: bpftool is a virtual package on Ubuntu, install linux-tools instead
* fix CI: locate bpftool binary and add it to PATH manually
linux-tools-generic's update-alternatives symlink for bpftool doesn't
fire on GitHub-hosted runners, since their kernel version has no
matching linux-tools-<version> package.
* pin clang bindings to 16.0.6 to match Ubuntu's default libclang
pip installs the latest 'clang' release by default, whose libclang API
surface is newer than Ubuntu 24.04's apt libclang-16, causing a
LibclangError about an undefined symbol. Older bindings against a
newer libclang stay compatible, so pin the bindings low rather than
the system library.
* DEBUG: dump struct_vmbus_channel_offer_channel on test failure
* remove debug step now that the bitfield issue is fixed
* fix CI: install LLVM 19 from apt.llvm.org, Ubuntu's default is too old
llvmlite>=0.49's ArgumentAttributes only recognizes the LLVM 19+
'captures(none)' spelling of the renamed 'nocapture' attribute.
Ubuntu noble's default llvm/clang packages are LLVM 18, whose llc
can't parse that attribute in the emitted .ll text.
* DEBUG: show real llc stderr on failure
* fix YAML syntax in debug step
* fix CI: install LLVM 22 (matching llvmlite's bundled version), not 19
Verified on CI: LLVM 19's llc still rejects 'captures(none)' as a
parse error ('expected ) at end of argument list'). llvmlite 0.49
bundles LLVM 22.1.0 internally; match that generation instead.
* remove debug step, LLVM 22 fix confirmed working on CI
* avoid running CI twice per push: scope push trigger to master
Branches live in this repo, not forks, so a push to a branch with an
open PR fired both push and pull_request for the same commit. push
now only fires for master (a post-merge check); pull_request already
covers every commit on a feature branch.
Prevents ctypes _fields_ assignment collisions when multiple anonymous
struct/union members across different structs get the same generic
'_N' name from clang2py.
TODO: struct_kioctx for x86_64 vmlinux.h has anonymous structs that refused to transpile well, so an extra rule has been written to make only the structs of that external. Fix this in the future.