RESOLVED FIXED 211254
[iOS] Unable to take RunningBoard process assertions in the iOS Simulator
https://bugs.webkit.org/show_bug.cgi?id=211254
Summary [iOS] Unable to take RunningBoard process assertions in the iOS Simulator
Chris Dumez
Reported 2020-04-30 14:21:19 PDT
Unable to take RunningBoard process assertions in the iOS Simulator due to a missing entitlement.
Attachments
Patch (4.06 KB, patch)
2020-04-30 14:25 PDT, Chris Dumez
no flags
Patch (4.73 KB, patch)
2020-05-01 11:10 PDT, Chris Dumez
no flags
Patch (5.80 KB, patch)
2020-05-04 09:41 PDT, Chris Dumez
no flags
Patch (5.79 KB, patch)
2020-05-04 09:42 PDT, Chris Dumez
no flags
Patch (5.77 KB, patch)
2020-05-04 10:03 PDT, Chris Dumez
no flags
Radar WebKit Bug Importer
Comment 1 2020-04-30 14:21:34 PDT
Chris Dumez
Comment 2 2020-04-30 14:25:59 PDT
Alexey Proskuryakov
Comment 3 2020-04-30 17:30:00 PDT
Comment on attachment 398092 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=398092&action=review > Source/WebKit/ChangeLog:17 > + * GPUProcess/EntryPoint/Cocoa/XPCService/GPUService/Info-iOS.plist: > + * NetworkProcess/EntryPoint/Cocoa/XPCService/NetworkService/Info-iOS.plist: > + * WebProcess/EntryPoint/Cocoa/XPCService/WebContentService/Info-iOS.plist: Aren't these plists also used for macCatalyst?
Chris Dumez
Comment 4 2020-04-30 17:51:01 PDT
(In reply to Alexey Proskuryakov from comment #3) > Comment on attachment 398092 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=398092&action=review > > > Source/WebKit/ChangeLog:17 > > + * GPUProcess/EntryPoint/Cocoa/XPCService/GPUService/Info-iOS.plist: > > + * NetworkProcess/EntryPoint/Cocoa/XPCService/NetworkService/Info-iOS.plist: > > + * WebProcess/EntryPoint/Cocoa/XPCService/WebContentService/Info-iOS.plist: > > Aren't these plists also used for macCatalyst? Why? Do we have issues with RunningBoard assertions in macCatalyst? This bug is about iOS simulator.
Alexey Proskuryakov
Comment 5 2020-04-30 18:12:24 PDT
Right, so why add this in macCatalyst, what is I think what you are doing.
Chris Dumez
Comment 6 2020-04-30 20:42:11 PDT
Comment on attachment 398092 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=398092&action=review >>> Source/WebKit/ChangeLog:17 >>> + * WebProcess/EntryPoint/Cocoa/XPCService/WebContentService/Info-iOS.plist: >> >> Aren't these plists also used for macCatalyst? > > Why? Do we have issues with RunningBoard assertions in macCatalyst? This bug is about iOS simulator. You mean that the plists are shared between iOS and catalyst? That may be. does it matter? My new entries only have an impact in iOS simulator.
Alexey Proskuryakov
Comment 7 2020-05-01 09:57:25 PDT
Well, we usually try to not leave such tripmines.
Chris Dumez
Comment 8 2020-05-01 10:06:38 PDT
(In reply to Alexey Proskuryakov from comment #7) > Well, we usually try to not leave such tripmines. Why is it a tripmine? As I mentioned, it does not hurt. Is there a better alternative? Is your proposal to split those plist files for Catalyst and Simulator? (I have not verified they are currently shared).
Alexey Proskuryakov
Comment 9 2020-05-01 10:31:02 PDT
How can you be certain that it doesn't hurt, and never will? If nothing else, it's virtually guaranteed to confuse engineers investigating RunningBoard related issues in the future. > Is there a better alternative? Source/WebKit/Scripts/process-entitlements.sh builds accurate entitlements for each platform.
Chris Dumez
Comment 10 2020-05-01 11:03:01 PDT
Ok, I am the proper entitlement working finally, with some help from our experts at Apple. I will upload a patch shortly.
Chris Dumez
Comment 11 2020-05-01 11:10:53 PDT
EWS
Comment 12 2020-05-01 13:09:48 PDT
Committed r261015: <https://trac.webkit.org/changeset/261015> All reviewed patches have been landed. Closing bug and clearing flags on attachment 398206 [details].
Chris Dumez
Comment 13 2020-05-01 15:56:14 PDT
Reverted r261015 for reason: Seems to have broken clean builds Committed r261033: <https://trac.webkit.org/changeset/261033>
Chris Dumez
Comment 14 2020-05-01 15:59:23 PDT
*.entitlements files no longer seem to get generated for clean macOS builds...
Chris Dumez
Comment 15 2020-05-01 17:02:34 PDT
Comment on attachment 398206 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=398206&action=review > Source/WebKit/Configurations/BaseXPCService.xcconfig:87 > +CODE_SIGN_ENTITLEMENTS = $(WK_PROCESSED_XCENT_FILE); It looks to me that it is trying to code sign before the $(WK_PROCESSED_XCENT_FILE) file is even generated. I am not sure yet how to express the dependency.
Chris Dumez
Comment 16 2020-05-01 18:00:37 PDT
(In reply to Chris Dumez from comment #15) > Comment on attachment 398206 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=398206&action=review > > > Source/WebKit/Configurations/BaseXPCService.xcconfig:87 > > +CODE_SIGN_ENTITLEMENTS = $(WK_PROCESSED_XCENT_FILE); > > It looks to me that it is trying to code sign before the > $(WK_PROCESSED_XCENT_FILE) file is even generated. I am not sure yet how to > express the dependency. CODE_SIGN_ENTITLEMENTS seems to expect the file to already exist and it doesn't because it gets generated via a "Run Script Phase" in Xcode. I don't know how to make this work. If anyone knows, please let me know.
Chris Dumez
Comment 17 2020-05-04 09:41:35 PDT
Chris Dumez
Comment 18 2020-05-04 09:42:25 PDT
Alexey Proskuryakov
Comment 19 2020-05-04 09:55:46 PDT
Comment on attachment 398378 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=398378&action=review > Source/WebKit/Configurations/BaseXPCService.xcconfig:-91 > -WK_LIBRARY_VALIDATION_CODE_SIGN_FLAGS_iossimulatorfamily = $(WK_LIBRARY_VALIDATION_CODE_SIGN_FLAGS_iossimulatorfamily_XBS_$(RC_XBS)); Can you explain what replaces the logic that excluded RC_XBS builds, that used to be here and in process-entitlements.sh? I doubt that we are supposed to have com.apple.security.get-task-allow in production builds. But also not sure why we checked the environment variable instead of build configuration. > Source/WebKit/Configurations/BaseXPCService.xcconfig:93 > +CODE_SIGN_ENTITLEMENTS_iphonesimulator = Resources/ios/XPCService-ios-simulator.entitlements > +CODE_SIGN_ENTITLEMENTS_appletvsimulator = Resources/ios/XPCService-ios-simulator.entitlements > +CODE_SIGN_ENTITLEMENTS_watchsimulator = Resources/ios/XPCService-ios-simulator.entitlements I think that the file should be named XPCService-embedded-simulator.entitlements.
Chris Dumez
Comment 20 2020-05-04 10:00:51 PDT
(In reply to Alexey Proskuryakov from comment #19) > Comment on attachment 398378 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=398378&action=review > > > Source/WebKit/Configurations/BaseXPCService.xcconfig:-91 > > -WK_LIBRARY_VALIDATION_CODE_SIGN_FLAGS_iossimulatorfamily = $(WK_LIBRARY_VALIDATION_CODE_SIGN_FLAGS_iossimulatorfamily_XBS_$(RC_XBS)); > > Can you explain what replaces the logic that excluded RC_XBS builds, that > used to be here and in process-entitlements.sh? I doubt that we are supposed > to have com.apple.security.get-task-allow in production builds. But also not > sure why we checked the environment variable instead of build configuration. For now, nothing. I am not clear why we were excluding RC_XBS builds (or what those are). The fact is that we were not added the entitlements properly previously for simulator builds. This meant that the entitlements applied to the host instead of inside the simulator. Now that it is no longer a real entitlement, I am not convinced it needs to be conditionalized. I tried to be conservative and keep the entitlement in question but odds are that it is not needed at all (since it was not properly added before). > > > Source/WebKit/Configurations/BaseXPCService.xcconfig:93 > > +CODE_SIGN_ENTITLEMENTS_iphonesimulator = Resources/ios/XPCService-ios-simulator.entitlements > > +CODE_SIGN_ENTITLEMENTS_appletvsimulator = Resources/ios/XPCService-ios-simulator.entitlements > > +CODE_SIGN_ENTITLEMENTS_watchsimulator = Resources/ios/XPCService-ios-simulator.entitlements > > I think that the file should be named > XPCService-embedded-simulator.entitlements. Ok. Note that my personal preference would still be to use the script to generate the entitlements for simulator builds. However, I could not figure out how to make it work with CODE_SIGN_ENTITLEMENTS directive. I figured I would do something that works and if somebody has a idea on how to make this work better, I would fix it.
Chris Dumez
Comment 21 2020-05-04 10:03:24 PDT
Alexey Proskuryakov
Comment 22 2020-05-04 10:15:38 PDT
Having com.apple.security.get-task-allow on production builds seems likely to prevent them from going through Apple build system successfully. And it's not even clear to me if it's macOS or simulator side that needs to see it - after all, it's for using the debugger from macOS. > Note that my personal preference would still be to use the script to generate the entitlements for simulator builds. However, I could not figure out how to make it work with CODE_SIGN_ENTITLEMENTS directive. Understood. I'm obviously not an expert on these things.
Geoffrey Garen
Comment 23 2020-05-04 10:30:17 PDT
Comment on attachment 398382 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=398382&action=review > Source/WebKit/Scripts/process-entitlements.sh:211 > - [[ "${RC_XBS}" != YES ]] && plistbuddy Add :com.apple.security.get-task-allow bool YES > + cp "${CODE_SIGN_ENTITLEMENTS}" "${WK_PROCESSED_XCENT_FILE}" According to https://developer.apple.com/documentation/xcode/notarizing_macos_software_before_distribution/resolving_common_notarization_issues, get-task-allow is a security hole in production builds. This might mean that this change is a security hole, and/or that some B&I verifier will fail when trying to build with buildit or build in B&I or Guardian. I'm a little surprised, since this implies that we do not allow attaching the debugger to any production software? But apparently that's the case: (lldb) attach 8112 error: attach failed: cannot attach to process due to System Integrity Protection
Geoffrey Garen
Comment 24 2020-05-04 10:36:33 PDT
> According to > https://developer.apple.com/documentation/xcode/ > notarizing_macos_software_before_distribution/ > resolving_common_notarization_issues, get-task-allow is a security hole in > production builds... That said, the only purpose of a Simulator build is debugging, so maybe it's OK to apply this entitlement to production simulator builds.
Geoffrey Garen
Comment 25 2020-05-04 10:44:58 PDT
Comment on attachment 398382 [details] Patch r=me I don't think we'll know for sure whether a submission will build correctly until we try it. The most important thing is to know how we'll unblock the submission if it fails to build. Chris confirmed that we could just roll out this patch, since it has no dependencies yet.
Alexey Proskuryakov
Comment 26 2020-05-04 11:14:57 PDT
Is there any binary in the SDK with this entitlement today? Landing an incorrect change and hoping that tools won't block it seems exceptionally cavalier.
Chris Dumez
Comment 27 2020-05-04 11:20:28 PDT
(In reply to Alexey Proskuryakov from comment #26) > Is there any binary in the SDK with this entitlement today? Landing an > incorrect change and hoping that tools won't block it seems exceptionally > cavalier. This is not a real entitlement. It does not apply on the host system (anymore).
Geoffrey Garen
Comment 28 2020-05-04 11:38:00 PDT
> Is there any binary in the SDK with this entitlement today? Landing an > incorrect change and hoping that tools won't block it seems exceptionally > cavalier. There is a discussion of the correctness of the change above.
EWS
Comment 29 2020-05-04 12:28:25 PDT
Committed r261099: <https://trac.webkit.org/changeset/261099> All reviewed patches have been landed. Closing bug and clearing flags on attachment 398382 [details].
Chris Dumez
Comment 30 2020-05-04 12:28:31 PDT
From https://developer.apple.com/documentation/xcode/notarizing_macos_software_before_distribution/resolving_common_notarization_issues: """ As a result, Xcode automatically strips the entitlement from your app when you export and sign it using the standard workflow. """ Now that we use the regular CODE_SIGN_ENTITLEMENTS for iOS simulator builds, it looks to be that Xcode is in charge of stripping this entitlement for production builds. For other builds, we use a custom signing workflow so the entitlement would not get stripped.
Chris Dumez
Comment 31 2020-05-04 13:08:14 PDT
(In reply to Chris Dumez from comment #30) > From > https://developer.apple.com/documentation/xcode/ > notarizing_macos_software_before_distribution/ > resolving_common_notarization_issues: > """ > As a result, Xcode automatically strips the entitlement from your app when > you export and sign it using the standard workflow. > """ > > Now that we use the regular CODE_SIGN_ENTITLEMENTS for iOS simulator builds, > it looks to be that Xcode is in charge of stripping this entitlement for > production builds. > > For other builds, we use a custom signing workflow so the entitlement would > not get stripped. I am currently testing a patch at https://bugs.webkit.org/show_bug.cgi?id=211392 to avoid having to specific the get-task-allow explicitly and let Xcode take care of it for us.
Chris Dumez
Comment 32 2020-05-04 15:09:26 PDT
(In reply to Chris Dumez from comment #31) > (In reply to Chris Dumez from comment #30) > > From > > https://developer.apple.com/documentation/xcode/ > > notarizing_macos_software_before_distribution/ > > resolving_common_notarization_issues: > > """ > > As a result, Xcode automatically strips the entitlement from your app when > > you export and sign it using the standard workflow. > > """ > > > > Now that we use the regular CODE_SIGN_ENTITLEMENTS for iOS simulator builds, > > it looks to be that Xcode is in charge of stripping this entitlement for > > production builds. > > > > For other builds, we use a custom signing workflow so the entitlement would > > not get stripped. > > I am currently testing a patch at > https://bugs.webkit.org/show_bug.cgi?id=211392 to avoid having to specific > the get-task-allow explicitly and let Xcode take care of it for us. Follow-up in https://trac.webkit.org/changeset/261116.
Alexey Proskuryakov
Comment 33 2020-05-04 15:18:08 PDT
This looks substantially more convincing!
Note You need to log in before you can comment on or make changes to this bug.