Repository navigation
mcc: Make carveout and MCC failures fatal on every chip - #320
Merged
Merged
Conversation
A failed firmware-carveout unmap panicked only on T8140, T6040 and T6050. On every other chip aura continued with the TZ carveouts mapped RWX. Panic on every chip. mcc_unmap_carveouts() returned -1 when the ADT had no /chosen/carveout-memory-map node, which is not a failure to unmap but the absence of anything aura can unmap. Every Apple Silicon Mac ADT carries the node (T8103, T8132, T6040, T6041, T6050, T8140, T8142, T8152), with region-id-2 and region-id-4 filled in by iBoot, so only an older SoC without the node can get there. Return 0 for it with a message. A node that is present but has no usable region-id-2/-4 range stays a failure, and now says which range was missing or out of RAM. Chips whose MCC TZ registers aura knows never take this path. The gate came from 55ba1d8 by Ryan Murray and was extended to T6050 in 05b2d56 by Jeff Queisser; the ADT fallback from 05b2d56 is kept. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Two more fail-open paths in the same mechanism: - With no MCC TZ registers, a missing /chosen/carveout-memory-map left every TZ carveout in aura's RWX identity map with only a message. Every Apple Silicon Mac ADT has the node, so its absence now fails mcc_unmap_carveouts() and the caller panics, as for a bad range. - An mcc_init() failure was fatal only on T8140 and T6040. A failure of an MCC revision aura has a driver for (missing reg or channel properties) is now fatal on every chip. An MCC revision with no driver here (today mcc,t6050) returns MCC_UNSUPPORTED instead of an error and boots on, with its carveouts taken from the ADT list, which is required. The mcc_init() gate came from the T8140 and T6040 bring-up; its checks are kept as they were for those chips. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
RyanTheTide
marked this pull request as ready for review
November 19, 2026 14:35
Pick up main's clang-format fix for src/sptm_virt_s2r.c (#294) so format-check runs against this change alone. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
This was referenced Nov 20, 2026
Merged
DjDeveloperr
added a commit
to sithglan/aura
that referenced
this pull request
Nov 20, 2026
…t does not describe the MCC Every T8132 (M4) ADT stores amcc_aperture_count in 4 bytes (value 2): J604, J623, J624, J713, J715 and J773g in macOS 26B131 and 25G83, and the live J773g ADT. mcc_init_m4() read it as a u64 with ADT_GETPROP, which refuses a size mismatch. Since aura#320 made an mcc_init() failure fatal on every chip, every M4 Mac resets about 44 ms into Stage 2. Before aurora-silicon#320, aura logged "MCC: Failed to get mcc count!" and booted on, so no T8132 board has ever run this MCC setup. The counts now go through mcc_get_count(), which takes 4 or 8 bytes, with no chip or board list: - amcc_aperture_count / amcc-count (T8132); - amcc-count (T8142); - dcs-count-per-amcc and plane-count-per-amcc (M3, M4, M5); - dcs_num_channels (M1, M2). amcc-count is read only when amcc_aperture_count is absent. The M3 and M4 per-AMCC counts were checked with !ADT_GETPROP(). ADT_GETPROP returns the length on success and a negative value on failure, so that check never fired, and a missing or wrong-width count quietly became 0 planes. When the ADT does not give a driver its counts (missing, another width, out of range) or its register windows, mcc_init() returns MCC_UNSUPPORTED instead of failing. The MCC is then left alone, as for a revision with no driver here (T6050, whose path is unchanged), and mcc_unmap_carveouts() takes the carveouts from /chosen/carveout-memory-map, which it requires. That list, which every ADT carries and iBoot fills in, is what keeps firmware memory out of aura's RWX map. The firmware-cache path (T8140, T6041) is unchanged and still fails closed. The TZ windows read from MCC registers are used only when they lie in RAM and cover the ADT's region-id-2 and region-id-4. T8132 reuses the T6030 TZ register layout untested. If that layout reads differently, the carveouts come from the ADT list, as before aurora-silicon#320, and the MCC is not driven further (no cache-enable writes, no plane info). With no usable ADT list, the TZ windows are used as before, skipping any outside RAM. tests/python/test_mcc_adt_counts.py compiles the whole of src/mcc.c against a fake ADT that keeps adt_getprop_copy()'s contract. It covers 4- and 8-byte counts and the malformed and missing cases on the T8132, T8122, T8142, T8103 and T6000 paths, and the TZ cross-check. Main fails it on the 4-byte count. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Diljit Singh <hey@djdev.me>
This was referenced Nov 21, 2026
IronsideXXVI
pushed a commit
to IronsideXXVI/aura
that referenced
this pull request
Nov 21, 2026
Every aura image built since aurora-silicon#320 resets an M4 Max (T6041) about 44 ms into boot, before the trial watchdog is armed (aura#406, J616C row). mcc_init_firmware_cache() admitted mcc,t6041 only with exactly 4 AMCCs, 4 channels, 4 planes and fixed apertures, which is the M4 Pro (J616s, J614s, J773s). Every M4 Max ADT has amcc-count 8: J614c, J616c and J575c in the 27.2.1 IPSW, and a live J616c. A binned J616C also reports amcc-enable-mask 0x3f (6 of 8) and dcs-channel-enable-mask 0xffffff. So the path returned -1, and since aurora-silicon#320 aura_main() panics on any mcc_init() < 0. Before aurora-silicon#320, T6041 only logged the failure, which is why a b9 chain boots that Mac. The current distro pin 2f487f2 fails the same way through its chip_id == T6040 clause. Take everything from the ADT, with no per-SoC geometry: - the AMCC count and register index, and the enabled AMCCs and channels, from /arm-io/mcc; - the planes and their stride from /chosen/lock-regs/amcc; - each enabled AMCC's window from reg, which must also be in lock-regs' aperture list where the ADT has one. Only the AMCCs that amcc-enable-mask names are recorded and read, so a fused-off AMCC is never touched. mcc_count and mcc_regs[] hold only those. The failure policy follows the rule for this path: - An ADT that contradicts itself fails before any register read: - amcc-count 0; - an empty amcc-enable-mask, or one past amcc-count; - a channel mask that is empty, past the channels, or has more channels than the enabled AMCCs hold; - a channel mask with no channel count; - an enabled AMCC with no window, or one too small for its planes; - a window lock-regs does not list; - a lock-regs list that disagrees with its own count; - no planes, or a misaligned stride. - An ADT that does not describe what the path needs returns MCC_UNSUPPORTED and boots on, as for T8132 since aurora-silicon#392: - a missing property, or one of another width; - more AMCCs or channels than aura tracks; - for the mcc,t6041 status reads, no plane stride in lock-regs. - A cache status other than the 12-way one iBoot leaves on the M4 Pro is now logged and the MCC left alone, not fatal. This path writes no register, and its carveouts come from the ADT list either way. Nothing downstream needs the MCC driven, except T8140, which keeps its own kboot refusal. The M4 Pro still records 4 AMCCs after 16 status reads, and the T8140 still records its one AMCC without reads. tests/python/test_mcc_firmware_cache.py compiles all of src/mcc.c against fake ADTs built from real trees (tests/data/mcc-firmware-cache.json): the binned J616C, a full J616c, the J614c as the IPSW has it and as iBoot completes it, the J773s and the J700. Its docstring lists the eight ways this can fail. It fails on main at the binned J616C (mcc_init() = -1), and each mutant tried (reading masked-out AMCCs, a fatal status, no lock-regs membership, no channel count check, no stride requirement, a soft amcc-count 0) fails it. It replaces tests/python/test_t6040_mcc.py, which asserted that every non-M4 Pro tree is refused. Host-tested only. The J616C row is still to run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Diljit Singh <hey@djdev.me>
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.
Problem
aura failed open on three memory-safety paths outside T8140/T6040/T6050:
src/memory.cpanicked on a failedmcc_unmap_carveouts()only on T8140, T6040 and T6050 (gate from 55ba1d8, extended in 05b2d56). Every other chip kept running with the TZ carveouts in its identity map as normal RWX memory./chosen/carveout-memory-mapreturned an error that those chips then ignored.src/main.ctreated anmcc_init()failure as fatal only on T8140 and T6040.Change
mcc_unmap_carveouts(): with TZ registers known (T8103, T8112, T6000/T602x, T8122, T603x, T8132, T8142) it reads them, unchanged. Without them it needs the ADT list: a missing node, or aregion-id-2/region-id-4that is missing, the wrong size, unaligned or outside RAM, fails and prints which range was wrong.mcc_init(): a failure of an MCC revision aura has a driver for is fatal on every chip. An MCC revision with no driver here (todaymcc,t6050) returnsMCC_UNSUPPORTED, prints the compatible and boots on, with its carveouts taken from the required ADT list.Testing
USE_CLANG=1builds pass (rc=0), no new warnings, clang-format clean.Each lab row is an aura-try of a Stage 2 head that stacks all of these sweep PRs together: 1.0.0b13-g78381479 on J616s (fleet75), M1 Pro and M2 (fleet74), and 1.0.0b13-gcba9872c on Neo, which adds #336-#339 and #333 and is compared against production 7.3.0-40. Stage 1 is untouched. Every row booted to userspace with Enforcing, 0 failed units, 0 kernel errors or AVCs, all CPUs online, s2idle passing, AVE output identical to production (H.264/HEVC on J616s) and 0 DART faults. M1 Pro and M2 also logged MCC init and the TZ0-TZ2 (M1 Pro) and TZ0/TZ2 (M2) unmaps.
Still to run
Nothing on the lab Macs.
ADT facts
/arm-io/mccand/chosen/carveout-memory-map: T8103 j313, T8132 j713/j773/j604, T6040 j773s, T6041 j616c, T6050 j873s, T8140 j700, T8142 j813 and T8152 j873. Dumps taken after boot carryregion-id-2andregion-id-4; template dumps (j313, j813, j873s, j604) have the node, empty until iBoot fills it.mcc_init()).mcc_init()failure, beforeMCC_UNSUPPORTED, boots onAssisted-by: LLM (Claude:Opus 5.5)