Skip to content

binaries fail strict validation on macOS #14045

@mitchellh

Description

@mitchellh

Zig Version

zig-linux-x86_64-0.11.0-dev.926+266e2e9a3

Steps to Reproduce and Observed Behavior

I'm unsure if you'll be able to reproduce this... I have no minimal reproduction but I can reliably reproduce with my software and I'm happy to pair sometime.

When updating from build 824 to build 926, with the identical build environment (Nix so everything is content hash identical), codesigning is now regularly failing for the past 3 days.

Last known working version: zig-linux-x86_64-0.11.0-dev.824+b3f4e0d09 (plus earlier releases for many months, I haven't had any issues)

Error below:

$ /usr/bin/codesign --force -s "$MACOS_CERTIFICATE_NAME" --options runtime zig-out/MyApp.app -v
1 identity imported.
keychain: "/Users/runner/Library/Keychains/build.keychain-db"
version: 512
class: 0x00000010 
attributes:
    0x00000000 <uint32>=0x00000010 
    0x00000001 <blob>="Mac Developer ID Application: Mitchell Hashimoto"
    0x00000002 <blob>=<NULL>
    0x00000003 <uint32>=0x00000001 
    0x00000004 <uint32>=0x00000000 
    0x00000005 <uint32>=0x00000000 
    0x00000006 <blob>=0x1DDCE3827A64403042576AAAB1E30016D665B4E9  "\035\334\343\202zd\326e\264\351"
    0x00000007 <blob>=<NULL>
    0x00000008 <blob>=0x7B38373139316361322D306663392D3131643430326235323132327D00  "{87191ca2-0fc9-11d4-849a}\000"
    0x00000009 <uint32>=0x0000002A  "\000\000\000*"
    0x0000000A <uint32>=0x00000800 
    0x0000000B <uint32>=0x00000800 
    0x0000000C <blob>=0x0000000000000000 
    0x0000000D <blob>=0x0000000000000000 
    0x0000000E <uint32>=0x00000001 
    0x0000000F <uint32>=0x00000001 
    0x00000010 <uint32>=0x00000001 
    0x00000011 <uint32>=0x00000000 
    0x00000012 <uint32>=0x00000001 
    0x00000013 <uint32>=0x00000001 
    0x00000014 <uint32>=0x00000001 
    0x00000015 <uint32>=0x00000001 
    0x00000016 <uint32>=0x00000001 
    0x00000017 <uint32>=0x00000001 
    0x00000018 <uint32>=0x00000001 
    0x00000019 <uint32>=0x00000001 
    0x0000001A <uint32>=0x00000001
zig-out/MyApp.app: main executable failed strict validation

(Note: I did muck with the output of this a little in this issue I didn't know if any of these bytes were secrets so if you want the original let me know -- only a few fields were modified)

The MyApp.app bundle is a mostly empty bundle that just has the zig-built binary as the entrypoint.

Expected Behavior

Codesign works since nothing has changed... all my dependency content hashes are identical and the app source was only changed for the field_type => type @typeInfo change in a recent Zig commit. Codesign from the last working version (zig-linux-x86_64-0.11.0-dev.824+b3f4e0d09) and prior versions was working for many months.

It feels like perhaps a linker change occurred which is making codesign upset?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behaviorlinkingos-macosregressionIt worked in a previous version of Zig, but stopped working.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions