Skip to content

chore(arm64): make the BPF build arch-aware for aarch64 - #63

Open
tattoosonmyskin wants to merge 1 commit into
mainfrom
chore/arm64-build-portability
Open

chore(arm64): make the BPF build arch-aware for aarch64#63
tattoosonmyskin wants to merge 1 commit into
mainfrom
chore/arm64-build-portability

Conversation

@tattoosonmyskin

Copy link
Copy Markdown
Contributor

Prep for running Jinn Guard on arm64. No change to x86 outputARCH still resolves to x86 on x86_64 (verified: ARCH=[x86] UNAME_M=[x86_64]), and an LSM object still compiles identically. This just stops the build hardcoding x86 so an aarch64 host builds without manual flags.

  • bpf/Makefile: derive ARCH from uname -m (x86_64->x86, aarch64->arm64), overridable with make ARCH=..., defaulting to x86 for unknown machines. Adds a regen-vmlinux target — the committed bpf/vmlinux.h is x86-generated (vendored so CI compiles without BTF), so a foreign-arch build regenerates it from local BTF.
  • scripts/validate_m2_path_resolution.sh, scripts/run_professor_validation.sh: derive -D__TARGET_ARCH_ from the host instead of hardcoding _x86.
  • rust-toolchain.toml: add aarch64-unknown-linux-gnu to the target list.

Does not touch the x86-hosted CI compile-gate (correct as-is). Real on-board bring-up (BTF gate, runner registration, kernel_lsm validation) still needs the aarch64 hardware and is tracked in the internal bring-up runbook.

🤖 Generated with Claude Code

Prep for running Jinn Guard on arm64. Nothing here changes x86 output
(ARCH still resolves to `x86` on x86_64, verified), it just stops the
build from hardcoding x86 so an aarch64 host builds without manual flags.

- bpf/Makefile: derive ARCH from `uname -m` (x86_64->x86, aarch64->arm64),
  overridable with `make ARCH=...`; defaults to x86 for unknown machines.
  Add a `regen-vmlinux` target: the committed bpf/vmlinux.h is x86-generated
  (vendored so CI can compile without BTF), so a foreign-arch build must
  regenerate it from local BTF.
- scripts/validate_m2_path_resolution.sh, scripts/run_professor_validation.sh:
  derive -D__TARGET_ARCH_ from the host instead of hardcoding _x86.
- rust-toolchain.toml: add aarch64-unknown-linux-gnu to the target list.

Does not touch the x86-hosted CI compile-gate. Real on-board bring-up
(BTF gate, runner registration, kernel_lsm validation) is tracked in the
internal arm64 bring-up runbook and still needs the hardware.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 8, 2026 03:22

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR makes the eBPF (BPF-LSM) build and validation flow architecture-aware so the project can be built on arm64/aarch64 hosts without manually editing flags, while preserving the existing x86_64 behavior.

Changes:

  • Derive the kernel-style BPF arch name (x86 vs arm64) from uname -m in the BPF Makefile (with ARCH still overridable via make ARCH=...).
  • Update validation scripts to pass -D__TARGET_ARCH_${arch} instead of hardcoding __TARGET_ARCH_x86.
  • Add aarch64-unknown-linux-gnu to the Rust toolchain target list.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
bpf/Makefile Makes ARCH host-derived (x86_64→x86, aarch64→arm64) and adds a regen-vmlinux helper target for local BTF regeneration.
scripts/validate_m2_path_resolution.sh Uses host-derived __TARGET_ARCH_* define when compiling BPF LSM objects during validation.
scripts/run_professor_validation.sh Uses host-derived __TARGET_ARCH_* define when compiling/installing BPF LSM objects in Tier 4.
rust-toolchain.toml Adds the aarch64 Linux target to the pinned toolchain configuration.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants