Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macOS: Integrate codesigning and enable hardened runtime #8909

Closed
wants to merge 8 commits into from

Conversation

OatmealDome
Copy link
Member

@OatmealDome OatmealDome commented Jun 29, 2020

This PR integrates codesigning into the build system. It also enables the hardened runtime and adds the appropriate entitlements to DolphinQt. These are prerequisites to notarization.

To build:

cmake .. -DMACOS_CODE_SIGNING="ON" -DMACOS_CODE_SIGNING_IDENTITY="<identity common name or hash>"

Codesigning is disabled by default. In addition, the optional setting MACOS_CODE_SIGNING_IDENTITY_UPDATER can be set if the updater needs a different identity.

The entitlement com.apple.security.automation.apple-events is activated because I noticed tccd was raising an error about Dolphin attempting to use Apple Events. I couldn't spot any obvious usage of Apple Events in the codebase, so I'm not sure why it's complaining in the first place. Either way, I added the entitlement so functionality is not unintentionally broken.

If this PR is merged, the next step would be to integrate notarization into the macOS buildbot if the project is willing to move forward with that. I can assist in any manner to get it up and running. I have already notarized some of my local Dolphin builds, and successfully tested them on macOS Catalina. Example binaries can be provided on request. (They have some personal information embedded in the app bundle, as I'm using my personal Apple Developer account, so I'd rather not have them be posted in a public forum.)

mmap(nullptr, size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_ANON | MAP_PRIVATE, -1, 0);
int flags = MAP_ANON | MAP_PRIVATE;
#ifdef __APPLE__
flags |= MAP_JIT;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been available since Lion 10.7, I'm surprised that it is just being added now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The macOS version of Dolphin has been relatively unmaintained for a while, unfortunately.

@ryanmcgrath
Copy link

Not sure if Dolphin still supports Sierra/High Sierra (10.12/10.13), but the README says it, so I figured I'd give a heads up: you may need to conditional the MAP_JIT for those platforms otherwise it'll crash - I had to work around this in Slippi like so:

static inline int determine_macos_jit_flag()
{
        static int jit_flag = -1;

        if (jit_flag == -1)
        {
                struct utsname name;
                uname(&name);

                // Kernel version 18 = Mojave
                jit_flag = (atoi(name.release) >= 18) ? MAP_JIT : 0;
        }

        return jit_flag;
}
flags |= determine_macos_jit_flag();

@OatmealDome
Copy link
Member Author

@ryanmcgrath #9441 will probably supersede this PR, so I've forwarded your info there. Thanks for the heads up.

@OatmealDome
Copy link
Member Author

Superseded by #9441!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants