RESOLVED FIXED 136473
Avoid warning if a process does not have access to com.apple.webinspector
https://bugs.webkit.org/show_bug.cgi?id=136473
Summary Avoid warning if a process does not have access to com.apple.webinspector
Joseph Pecoraro
Reported 2014-09-02 18:34:11 PDT
Some sandboxed processes will warn that they do not have access to the com.apple.webinspector mach port. Applications will automatically get the JavaScriptCore framework sandbox extensions to access the port but it seems some processes don't. In such cases the sandbox warning in syslog can be avoided because it is just noise. <rdar://problem/16647344>
Attachments
[PATCH] Proposed Fix (2.16 KB, patch)
2014-09-02 18:35 PDT, Joseph Pecoraro
ap: review+
[PATCH] For Landing (2.38 KB, patch)
2014-09-03 15:08 PDT, Joseph Pecoraro
no flags
Joseph Pecoraro
Comment 1 2014-09-02 18:35:57 PDT
Created attachment 237539 [details] [PATCH] Proposed Fix Still don't know how I feel about this but here is the patch.
WebKit Commit Bot
Comment 2 2014-09-02 18:37:29 PDT
Attachment 237539 [details] did not pass style-queue: ERROR: Source/JavaScriptCore/inspector/remote/RemoteInspector.mm:69: Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons. [readability/comparison_to_zero] [5] Total errors found: 1 in 2 files If any of these errors are false positives, please file a bug against check-webkit-style.
Alexey Proskuryakov
Comment 3 2014-09-02 18:54:43 PDT
Comment on attachment 237539 [details] [PATCH] Proposed Fix View in context: https://bugs.webkit.org/attachment.cgi?id=237539&action=review > Source/JavaScriptCore/inspector/remote/RemoteInspector.mm:59 > +#if __has_include(<sandbox/private.h>) > +#import <sandbox/private.h> > +#else > +enum sandbox_filter_type { > + SANDBOX_FILTER_GLOBAL_NAME, > +}; > +extern "C" { > +int sandbox_check(pid_t, const char *operation, enum sandbox_filter_type, ...); > +} > +#endif Sandbox SPIs seem like a prime target for the new technique Maciej is suggesting, as we use them in many places. Instead of declaring the SPIs in each .mm file, they would go into SandboxSPI.h. In any case, sandbox_check declaration should not be inside the #else.
Joseph Pecoraro
Comment 4 2014-09-03 11:16:48 PDT
(In reply to comment #3) > (From update of attachment 237539 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=237539&action=review > > > Source/JavaScriptCore/inspector/remote/RemoteInspector.mm:59 > > +#if __has_include(<sandbox/private.h>) > > +#import <sandbox/private.h> > > +#else > > +enum sandbox_filter_type { > > + SANDBOX_FILTER_GLOBAL_NAME, > > +}; > > +extern "C" { > > +int sandbox_check(pid_t, const char *operation, enum sandbox_filter_type, ...); > > +} > > +#endif > > Sandbox SPIs seem like a prime target for the new technique Maciej is suggesting, as we use them in many places. Instead of declaring the SPIs in each .mm file, they would go into SandboxSPI.h. I suppose I could. This would be the first in JavaScriptCore so I opted for the easier path. > In any case, sandbox_check declaration should not be inside the #else. I don't follow. Why not?
Alexey Proskuryakov
Comment 5 2014-09-03 11:27:00 PDT
> > In any case, sandbox_check declaration should not be inside the #else. > > I don't follow. Why not? This way, we'll get a compile error internally if the function signature changes in the future. That's much better than having to chase a mysterious behavior difference between internal and open source builds.
Joseph Pecoraro
Comment 6 2014-09-03 11:43:28 PDT
(In reply to comment #5) > > > In any case, sandbox_check declaration should not be inside the #else. > > > > I don't follow. Why not? > > This way, we'll get a compile error internally if the function signature changes in the future. That's much better than having to chase a mysterious behavior difference between internal and open source builds. Internally we should just get the include, so if the signature changes we would fail immediately. If the file changes, then we'd be out of luck. #if __has_include(<sandbox/private.h>) #import <sandbox/private.h> ... I think we have to put some signature in the else, so that open source developers can compile the file. This pattern is repeated in a couple places (WebKit2).
Alexey Proskuryakov
Comment 7 2014-09-03 12:05:22 PDT
> if the signature changes we would fail immediately This depends on how the signature changes - it can be source compatible, but not binary compatible. Having an unconditional declaration after the conditional include would catch that.
Joseph Pecoraro
Comment 8 2014-09-03 15:08:27 PDT
Created attachment 237587 [details] [PATCH] For Landing
WebKit Commit Bot
Comment 9 2014-09-03 15:50:26 PDT
Comment on attachment 237587 [details] [PATCH] For Landing Clearing flags on attachment: 237587 Committed r173238: <http://trac.webkit.org/changeset/173238>
WebKit Commit Bot
Comment 10 2014-09-03 15:50:29 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.