feat(health_monitor): implement ARM MTE memory provider - #630
Draft
SebStefenel wants to merge 3 commits into
Draft
feat(health_monitor): implement ARM MTE memory provider#630SebStefenel wants to merge 3 commits into
SebStefenel wants to merge 3 commits into
Conversation
Implement ARM Memory Tagging Extension (MTE) memory provider to protect allocated memory regions via hardware tagging. Guarded behind the //config:enable_arm_mte Bazel flag so users can enable it once the target hardware and OS support MTE. Closes eclipse-score#119 Signed-off-by: Sebastian Stefenel <stefenel.sebastian@gmail.com>
SebStefenel
requested a deployment
to
workflow-approval
September 13, 2026 07:05 — with
GitHub Actions
Waiting
SebStefenel
requested a deployment
to
workflow-approval
September 13, 2026 07:05 — with
GitHub Actions
Waiting
SebStefenel
requested a deployment
to
workflow-approval
September 14, 2026 00:35 — with
GitHub Actions
Waiting
SebStefenel
requested a deployment
to
workflow-approval
September 14, 2026 00:35 — with
GitHub Actions
Waiting
Fix the borrow checker error in the read/write boundary test, which broke every Rust build, the Clippy job and the sanitizer jobs. Replace the `core::arch::aarch64::__arm_mte_*` intrinsics by inline `irg` and `stg` instructions. The intrinsics are nightly-only (stdarch_aarch64_mte), so the backend could never have been compiled by the stable toolchain. Correct the prctl definitions: PR_SET_TAGGED_ADDR_CTRL is 55 (56 queries the setting), PR_TAGGED_ADDR_ENABLE is bit 0, and the tag inclusion mask has to be set, otherwise `irg` is only allowed to generate tag 0. Degrade to plain, unprotected memory instead of failing the allocation when MTE is requested but unavailable, so x86_64, sanitizer and QNX builds keep working with the feature enabled. `is_protection_active` and the new `is_protected` report whether a region is hardware-protected, so the degraded configuration stays detectable. Build the MTE backend for aarch64 Linux so that it gets compile coverage, no default configuration compiles it. Sort the imports and the BUILD attributes as the formatter expects. Signed-off-by: Sebastian Stefenel <stefenel.sebastian@gmail.com>
SebStefenel
force-pushed
the
feat/arm-mte-memory-provider
branch
from
September 14, 2026 00:35
1c242f8 to
a1aaeff
Compare
SebStefenel
requested a deployment
to
workflow-approval
September 14, 2026 00:35 — with
GitHub Actions
Waiting
SebStefenel
requested a deployment
to
workflow-approval
September 14, 2026 00:35 — with
GitHub Actions
Waiting
SebStefenel
force-pushed
the
feat/arm-mte-memory-provider
branch
from
September 14, 2026 00:56
a1aaeff to
25efef3
Compare
SebStefenel
requested a deployment
to
workflow-approval
September 14, 2026 00:57 — with
GitHub Actions
Waiting
SebStefenel
requested a deployment
to
workflow-approval
September 14, 2026 00:57 — with
GitHub Actions
Waiting
A pointer read straight out of the `irg` `asm!` block carries no provenance of the mapping it points into, which the strict provenance model does not allow to be dereferenced. Take only the tagged address from the block and rebuild the pointer with `with_addr`, which keeps the provenance of the mapping. The nightly `__arm_mte_create_random_tag` intrinsic preserves it the same way. Document that tags cover whole 16-byte granules, so an access up to 15 bytes past the requested size still matches the tag of the region and is not detected. Document that querying `is_protection_active` enables tag checking for the calling thread, which is a per-thread kernel setting. Signed-off-by: Sebastian Stefenel <stefenel.sebastian@gmail.com>
SebStefenel
requested a deployment
to
workflow-approval
September 14, 2026 05:31 — with
GitHub Actions
Waiting
SebStefenel
requested a deployment
to
workflow-approval
September 14, 2026 05:31 — with
GitHub Actions
Waiting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the ARM MTE memory provider requested in #119:
ProtectedMemoryAllocatorallocates memory regions protected by the ARM Memory Tagging Extension. The provider is gated behind the new//config:enable_arm_mteBazel flag (default: off) and themteCargo feature, so it can be enabled once the target hardware and OS support it.Behavior by configuration:
mmap(PROT_MTE), MTE support is detected at runtime (getauxval(AT_HWCAP2)), synchronous tag checking is enabled per thread (prctl(PR_SET_TAGGED_ADDR_CTRL)), and a random non-zero tag is assigned to every 16-byte granule.Degrading instead of failing
Allocation never fails because MTE is unavailable. The alternative -- returning an error -- would make the flag unusable on the x86_64 hosts that run the unit tests and the sanitizer builds, and would turn a capability mismatch into a startup failure on targets that are otherwise fine.
Degrading is deliberately not silent, so a caller that must not run unprotected can detect it:
ProtectedMemoryAllocator::is_protection_active()reports whether the platform provides protection.ProtectedMemoryRegion::is_protected()reports whether that specific region is hardware-tagged.Happy to switch to a hard failure when the flag is explicitly enabled if that matches the safety concept better.
Implementation notes
core::arch::aarch64::__arm_mte_*intrinsics are nightly-only (stdarch_aarch64_mte, Tracking Issue for AArch64 MTE memory tagging intrinsics rust-lang/rust#129010), soirgandstgare emitted as inline assembly from functions carrying#[target_feature(enable = "mte")]. This keeps the backend buildable with the Ferrocene toolchain.PR_SET_TAGGED_ADDR_CTRLis 55 (56 reads the setting back),PR_TAGGED_ADDR_ENABLEis bit 0, and the control word sets the tag inclusion mask. The kernel reads that field as the set of tagsirgmay generate, so leaving it zero would exclude all 16 tags and yield tag 0 only.//score/health_monitor/src/rust:health_monitoring_lib_mtebuilds the MTE backend unconditionally for aarch64 Linux, and is skipped elsewhere. Without it no CI configuration compiles that code, since it is gated on both the feature and the target.ProtectedMemoryAllocatorremains a unit struct, so all existing construction sites (builders, tests) are unchanged.&ProtectedMemoryAllocatorunchanged; moving monitor state into protected regions is intentionally left for a follow-up.Closes #119