Signing fails on app extension targets: appex stub has no __text section, zsign aborts on free-space check
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 45/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- swift
- Lĩnh vực
- build-system
Hướng nghiên cứu
The failure occurs when bundled zsign processes an extension stub; the issue points to ZArchO::Init in archo.cpp and ReallocCodeSignSpace. Start by reading the free-space calculation and how existing LC_CODE_SIGNATURE commands are handled, then inspect the stub’s Mach-O load commands. Done means extension stubs without a __text section can be signed successfully; the issue does not name tests to run.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Bug
xtool dev build --sign fails on an app whose package declares an extension when zsign processes the appex trampoline stub:
>>> Can't find free space of LoadCommands for CodeSignature!
Error: Signing failed
Root cause
The -Extension-product link step emits a stub Mach-O whose __TEXT segment contains only __stubs and __got — there is no __text section. The bundled zsign fork computes load-command free space as
m_uLoadCommandsFreeSpace = __text.offset - sizeofcmds - headerSize
(ZArchO::Init, archo.cpp). With no __text section the value is 0, so ReallocCodeSignSpace refuses to append LC_CODE_SIGNATURE and aborts. A __text-less stub is legal Mach-O — codesign signs these fine; the abort is specific to zsign's free-space shortcut.
Repro
xtool 1.21.0, aarch64 Linux (Arch/Asahi), Darwin SDK artifactbundle. Any SwiftPM app package with an extensions: entry in xtool.yml — in my case a WidgetKit ControlWidget extension. The stub binary at .build/out/Products/Debug-iphoneos/<Name>-Extension has ncmds=24, __TEXT with __stubs at fileoff 16384 and no __text section.
Workaround that unblocked me
Post-link hook in the artifactbundle's toolset/bin/ld64.lld wrapper: after orig/ld64.lld succeeds, inject an empty LC_CODE_SIGNATURE { dataoff: filesize, datasize: 0 } into the stub's load-command padding (it has ~15 KB free). zsign then takes its existing-pcslc path, skips the free-space check, and writes the real signature at dataoff — both app and appex sign and the bundle deploys.
Possible fixes
- Emit a
__textsection in the extension stub link (e.g. a real entry-point object), or - Patch zsign's
ZArchO::Initto fall back to the__TEXTsegment'sfileoff/filesizewhen no__textsection exists.
Happy to send a PR against whichever side you prefer.
- Ngôn ngữ chính
- Swift
- Star
- 5.5k
- Fork
- 163
- Merge trung bình
- 19 giờ 33 phút
- Pull request đã merge (30 ngày)
- 25
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của xtool-org/xtool
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 63/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Error: exited(127)Đang mởbug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
xtool-org/xtool#365 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
xtool-org/xtool#364 · 6 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 12/100
xtool-org/xtool#359 · 3 bình luận · 2 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của xtool-org/xtool
Issue tương tự
-
product / auth product / databases product / functions product / messaging product / storage product / vcs
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
storage: eliminate force-unwraps and fatalError in continueStreamingUploadCó thể đã có người làm @chingor13 đã nhận hôm nay. Đang mởapi: storage type: cleanup
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
googleapis/google-cloud-swift#1527 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
ci-failure ci:assertion test
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
openwatersio/slackwater-ios#811 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
ai-assisted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
swiftlang/swift-testing#1979 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
foxglove/mcap#1907 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày