Bug 195484

Summary: [iOS] Block access to backboardd service
Product: WebKit Reporter: Per Arne Vollan <pvollan>
Component: WebKit Misc.Assignee: Per Arne Vollan <pvollan>
Status: RESOLVED FIXED    
Severity: Normal CC: bfulgham, commit-queue, ryanhaddad, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 195606    
Bug Blocks:    
Attachments:
Description Flags
Patch
none
Patch
none
Patch
bfulgham: review+
Patch
none
Patch none

Description Per Arne Vollan 2019-03-08 14:50:15 PST
This bug is addressing blocking the backboardd service "com.apple.backboard.hid.services".
Comment 1 Radar WebKit Bug Importer 2019-03-08 14:51:05 PST
<rdar://problem/48726709>
Comment 2 Per Arne Vollan 2019-03-08 15:00:37 PST
Created attachment 364076 [details]
Patch
Comment 3 Per Arne Vollan 2019-03-08 15:16:53 PST
Created attachment 364081 [details]
Patch
Comment 4 Brent Fulgham 2019-03-11 09:47:31 PDT
In file included from /Volumes/Data/EWS/WebKit/WebKitBuild/Release-iphoneos/DerivedSources/WebKit2/unified-sources/UnifiedSource31-mm.mm:7:
/Volumes/Data/EWS/WebKit/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm:405:134: error: use of undeclared identifier 'UIBacklightLevelChangedNotification'
    CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), this, backlightLevelDidChangeCallback, (CFStringRef)UIBacklightLevelChangedNotification, nullptr, CFNotificationSuspensionBehaviorCoalesce);
                                                                                                                                     ^
/Volumes/Data/EWS/WebKit/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm:457:104: error: use of undeclared identifier 'UIBacklightLevelChangedNotification'
    CFNotificationCenterRemoveObserver(CFNotificationCenterGetDarwinNotifyCenter(), this, (CFStringRef)UIBacklightLevelChangedNotification, nullptr);
Comment 5 Brent Fulgham 2019-03-11 09:48:46 PDT
Comment on attachment 364081 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=364081&action=review

> Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm:403
> +    CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), this, backlightLevelDidChangeCallback, (CFStringRef)UIBacklightLevelChangedNotification, nullptr, CFNotificationSuspensionBehaviorCoalesce);

You might need to forward declare UIBacklightLevelChangedNotification, perhaps in an SPI file. Or you might just be missing a relevant include.
Comment 6 Per Arne Vollan 2019-03-11 12:21:19 PDT
Created attachment 364275 [details]
Patch
Comment 7 Per Arne Vollan 2019-03-11 12:21:58 PDT
(In reply to Brent Fulgham from comment #5)
> Comment on attachment 364081 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=364081&action=review
> 
> > Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm:403
> > +    CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), this, backlightLevelDidChangeCallback, (CFStringRef)UIBacklightLevelChangedNotification, nullptr, CFNotificationSuspensionBehaviorCoalesce);
> 
> You might need to forward declare UIBacklightLevelChangedNotification,
> perhaps in an SPI file. Or you might just be missing a relevant include.

Thanks! I have updated the patch.
Comment 8 Brent Fulgham 2019-03-11 12:28:45 PDT
Comment on attachment 364275 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=364275&action=review

> Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm:711
> +

I think you should have a FIXME comment referencing the radar where the relevant backlight code will be improved in the future so we don't have to do this silly swizzling.
Comment 9 Per Arne Vollan 2019-03-11 13:53:01 PDT
Created attachment 364284 [details]
Patch
Comment 10 Per Arne Vollan 2019-03-11 13:55:03 PDT
(In reply to Brent Fulgham from comment #8)
> Comment on attachment 364275 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=364275&action=review
> 
> > Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm:711
> > +
> 
> I think you should have a FIXME comment referencing the radar where the
> relevant backlight code will be improved in the future so we don't have to
> do this silly swizzling.

Done. Thanks for reviewing!
Comment 11 WebKit Commit Bot 2019-03-11 15:15:57 PDT
Comment on attachment 364284 [details]
Patch

Clearing flags on attachment: 364284

Committed r242745: <https://trac.webkit.org/changeset/242745>
Comment 12 Ryan Haddad 2019-03-11 22:25:07 PDT
Rolled out in https://trac.webkit.org/r242775 because it broke internal builds. Details in radar.
Comment 13 Per Arne Vollan 2019-03-12 11:08:52 PDT
Created attachment 364411 [details]
Patch
Comment 14 WebKit Commit Bot 2019-03-12 11:51:18 PDT
Comment on attachment 364411 [details]
Patch

Clearing flags on attachment: 364411

Committed r242807: <https://trac.webkit.org/changeset/242807>