Repository navigation
runtime: aarch64: do not use DC ZVA while the MMU is off - #2183
Merged
Merged
Conversation
francescolavra
requested changes
Oct 10, 2026
AngeloRubens
force-pushed
the
aarch64-zva-mmu
branch
2 times, most recently
from
October 10, 2026 17:35
1ff1525 to
932d6a2
Compare
DC ZVA requires Normal memory. While the MMU is off every access is Device memory, where the instruction faults whatever DCZID_EL0.DZP reports, and the kernel can run in that state during early boot: zero() called there takes a synchronous exception on real hardware. An emulator that does not enforce the restriction boots either way, which is why this has gone unnoticed. In a kernel build, check SCTLR_EL1.M alongside the DZP check that is already there. SCTLR_EL1 cannot be read from EL0, and zero() also runs in runtime test programs, so outside the kernel the MMU is taken as on.
AngeloRubens
force-pushed
the
aarch64-zva-mmu
branch
from
October 10, 2026 17:49
932d6a2 to
2995df0
Compare
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.
DC ZVA requires Normal memory. While the MMU is off every access is Device
memory, where the instruction faults whatever DCZID_EL0.DZP reports.
The kernel runs in exactly that state between the UEFI loader clearing
SCTLR_EL1 and enable_mmu() turning translation back on, so any zero() call in
that window takes a synchronous exception on real hardware. QEMU does not
enforce the restriction, so the same image boots there either way.
Observed on a VM.Standard.A1.Flex instance in eu-milan-1:
which the disassembly of the running kernel resolves to the dc zva instruction
in zero(). With the check added, the same image boots and serves requests.
The change adds SCTLR_EL1.M to the condition that already tests DZP, and leaves
the body of the fast path untouched.
Console of the instance, captured with oci compute console-history, before the
change:
Disassembly of the kernel that produced it, at that address:
addr2line places it in zero() at src/runtime/memops.c.
After the change, the same image on the same shape reaches userspace:
and an application server on top of it starts and serves requests.