Repository navigation
fix(native): accept universal binaries with LIB64 x86_64 slices - #1982
Merged
morluto merged 7 commits intoOct 12, 2026
Merged
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cc932e23bd
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
lipo -detailed_info prints a slice's capability byte separately from its symbolic subtype: CPU_SUBTYPE_LIB64 for x86_64 and ppc64, and other bits as hex. Only the arm64e pointer-auth form was applied, so a LIB64 x86_64 slice normalized to subtype 3 while its FAT entry carries 0x80000003, and slice validation rejected the universal binary as an integrity mismatch. Fold the printed capability byte into the subtype code.
The lipo shipped with macOS 26 prints an empty capabilities line for x86_64 slices whose FAT capability byte is 0x80 as well as 0x00, so a symbolic subtype alone does not identify the slice's CPU subtype. The parser assumed no capability bits and still reported subtype 3 for LIB64 slices, which made universal applications such as Sublime Text fail slice validation. Report the subtype code as unknown when lipo prints no capability byte, as arm64e already does; slice validation then relies on the remaining physical facts.
Fold CPU_SUBTYPE_LIB64 and hex capability bytes into x86_64 subtype codes, and keep the code unknown for the blank capabilities line that macOS 26 lipo prints.
Read a universal image whose x86_64 FAT entry carries 0x80000003 while lipo reports CPU_SUBTYPE_X86_ALL with a blank capabilities line, as macOS 26 lipo does, and expect both slices instead of an integrity failure.
A blank capabilities line leaves the subtype code unknown, and slice matching then skipped the subtype entirely. A FAT entry whose named subtype differs, such as CPU_SUBTYPE_ARM64_V8 recorded by lipo as CPU_SUBTYPE_ARM64_ALL, was accepted. Keep comparing the complete subtype when lipo printed its capability byte, and otherwise compare the subtype bits its record names.
Read the LIB64 universal fixture through one helper that takes the x86_64 subtype lipo reports, so further cases reuse the same image and lipo record. The existing expectation is unchanged.
With the capabilities line blank, a lipo record naming CPU_SUBTYPE_X86_64_H for the x86_64 LIB64 slice still disagrees with the FAT entry's subtype bits and fails slice validation.
viniciusdsandrade
force-pushed
the
fix/native-lipo-capability-bits
branch
from
October 11, 2026 22:44
af483b4 to
951bec1
Compare
3 tasks done
2 tasks done
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
Universal Mach-O files whose x86_64 slice carries the LIB64 capability bit (FAT cpusubtype
0x80000003, common for x86_64 executables) fail slice reading withlipo slice metadata disagrees with the Mach-O FAT table: x86_64 .... The lipo parser applied capability bits only to arm64e, so it reported subtype 3 for these slices. Apply the capability byte lipo prints, and leave the subtype code unknown when lipo prints none.No existing issue covers this. #1168 and #1765 concern arm64e slices, and open #1772 does not touch the lipo parser.
Problem and expected behavior
On macOS 26.7.1,
lipo -detailed_infofrom Xcode prints this for/Applications/Sublime Text.app/Contents/MacOS/sublime_text:otool -freportscpusubtype 3andcapabilities 0x80for the same FAT entry. The same lipo prints the same blank line for/bin/ls, whose x86_64 capability byte is0x0, so the blank line does not identify the subtype. cctools lipo printscapabilities CPU_SUBTYPE_LIB64for this case instead (misc/lipo.c), which the parser also ignored.In both cases
cpuSubtypeCodereturned 3.lipoMatchesSlicecompares that with the FAT subtype0x80000003, finds no matching slice, andMachOSliceArtifactReaderthrows anintegrityfailure, the same failure class #1765 shows surfacing asintegrity_mismatch. Expected: both slices are listed, as for universal files whose x86_64 entry has no capability bits.Change and scope
capabilityBitsreads the capability byte lipo prints next to the subtype:CPU_SUBTYPE_LIB64(0x80) or a hex byte such as0x80or0x0. Non-arm64e subtype codes include it, as arm64e codes already include their pointer-auth byte.null, the rule arm64e already follows withoutPTR_AUTH_VERSION, and the entry keeps the existing "retained as unnormalized source text" limitation.nullcode,lipoSubtypeMatchescompares the subtype bits fromlipoSubtypeBitswith the FAT entry's low 24 bits, so a record naming another subtype (for exampleCPU_SUBTYPE_ARM64_ALLfor anARM64_V8entry) is still rejected.inspect_machoslice selection within one CPU family, which is a separate problem.Contract and boundary impact
lipo -detailed_infoparsing insrc/native/parsers/lipo.ts, and its slice comparison insrc/artifacts/MachOSliceArtifactReader.ts.cpu_subtype_codeincludes printed capability bits and isnullwhen lipo prints none.docs/public/product-catalog.json), package, or installation impact: none.Evidence and regression coverage
src/native/parsers/lipo.test.tscoversCPU_SUBTYPE_LIB64,0x80,0x0and the blank line.tests/boundary/providers/native/artifactProvider.machOSlices.test.tsreads a FAT image whose x86_64 entry carries0x80000003with the macOS 26 lipo output and expects both slices (on the base revision that read throws the integrity failure), and still rejects a blank-capability record namingCPU_SUBTYPE_X86_64_Hfor that entry.lipo -detailed_infoandotool -foutput above, observed on macOS 26.7.1 for Sublime Text and/bin/ls, and cctoolsmisc/lipo.cfor the named LIB64 form. The failure path throughcpuSubtypeCodeandlipoMatchesSliceis source-derived.lipo slice metadata disagrees with the Mach-O FAT table: x86_64 (cputype=CPU_TYPE_X86_64, cpusubtype=CPU_SUBTYPE_X86_ALL, offset=16384, ...); after, the x86_64 and arm64 slices.For evidence-bearing changes:
Validation performed
lipo -detailed_infoandotool -fwere run on the binaries named above.Compatibility, safety, and release
cpu_subtype_codechanges from an assumed value tonullonly where lipo prints no capability byte.Review checklist
type(scope): outcome.