The script, added in #2350 after this PR was opened, also defaulted --llvm-mc
to os.environ.get("LLVM_MC", "llvm-mc") and checked that name with
shutil.which, so with only Ubuntu's llvm-21 it skipped (exit 77). It now asks
mc_command.mc_command() like run_gpu_tests.py, and the guard test added here
passes on main again.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RAL8MMXUuNpQAVa1iiyAMP
Every Gen.host_addr access (buffer, global_, scalar and BVH loads, stores and atomics) calls one
%guard_fn with its sign-extended 48-bit heap offset, kind and span. Below the arena's size it passes
after a compare; elsewhere the 4 KiB pages of its first and last byte are looked up in a two-level
page table (level 1 by offset bits 47..32, level 2 one bit per page). A refused load reads the zero
area, a refused store or atomic the dump area (an atomic returns 0), and the refusal is counted in
the guard header. Without the header's magic every access passes; without the flag the module is
unchanged byte for byte.
tools/address_guard.py is the Python reference of the table and the check. cs_address_guard is the
fixture of the translator test and of scripts/run_address_guard_gpu_test.py, which runs it on a heap
where every address it touches is real memory, so no run can fault.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>