WebGL fails to initialize when resistFingerprint is enabled

RESOLVED FIXED in Firefox 58

Status

()

defect
RESOLVED FIXED
2 years ago
Last year

People

(Reporter: floooh, Assigned: daoshengmu)

Tracking

58 Branch
mozilla59
Points:
---
Bug Flags:
qe-verify -

Firefox Tracking Flags

(firefox58 fixed, firefox59 fixed)

Details

(Whiteboard: [tor][fingerprinting-breakage][fp:backlog][gfx-noted])

Attachments

(2 attachments)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:58.0) Gecko/20100101 Firefox/58.0
Build ID: 20171017220415

Steps to reproduce:

When enabling the new resistFingerprinting flag in FF Nightly the WebGL context fails to initialize.

To reproduce:

- on OSX or Win7 (tested configs were: mid-2014 13" MBP OSX 10.13.1 Beta (17B35a) with Intel GPU, and Win7 with Geforce GTX760 GPU)
- in FF Nightly 58.0a1 (2017-10-17) (64-bit) or (32-bit)
- go to https://threejs.org/examples/#webgl_animation_cloth (or most other WebGL demos)

The WebGL context fails to initialize with the following messages on the JS console:  

Error: WebGL warning: Unable to restrict WebGL limits in order to resist fingerprinting
three.js:21080:22
Error: WebGL warning: Failed to create WebGL context: WebGL creation failed: 
* 
* Exhausted GL driver options.

Some of my own demos for testing (same problem):

- https://floooh.github.io/sokol-html5/
- https://floooh.github.io/oryol/
- http://floooh.github.io/oryol-samples/index.html
This ticket is related to the original resistFingerprint feature ticket here: https://bugzilla.mozilla.org/show_bug.cgi?id=1217290
PS: forgot to mention in the repro steps that resistFingerprinting must be enabled:

- goto about:config, set privacy.resistFingerprinting to true
Whiteboard: [tor][fingerprinting][fp:backlog]
Component: Untriaged → Canvas: WebGL
Product: Firefox → Core
(In reply to Andre Weissflog from comment #2)
> PS: forgot to mention in the repro steps that resistFingerprinting must be
> enabled:
> 
> - goto about:config, set privacy.resistFingerprinting to true

Do you mean you can still reproduce this issue even privacy.resistFingerprinting set to false? If so, i guess it wont' have the error message you mentioned in the beginning like 

Error: WebGL warning: Unable to restrict WebGL limits in order to resist fingerprinting
....
....

What else message you saw? Attaching about:support into this bug would be fine for further analysis. Thanks.
Flags: needinfo?(floooh)
http://searchfox.org/mozilla-central/rev/dca019c94bf3a840ed7ff50261483410cfece24f/dom/canvas/WebGLContextValidate.cpp#81

Somehow many machines get [1, 1] from ALIASED_LINE_WIDTH_RANGE, even if they have powerful graphics cards, so I guess at least we should change this to 1.
Whiteboard: [tor][fingerprinting][fp:backlog] → [tor][fingerprinting-breakage][fp:backlog]
(In reply to Vincent Liu[:vliu] from comment #3)
> (In reply to Andre Weissflog from comment #2)
> > PS: forgot to mention in the repro steps that resistFingerprinting must be
> > enabled:
> > 
> > - goto about:config, set privacy.resistFingerprinting to true
> 
> Do you mean you can still reproduce this issue even
> privacy.resistFingerprinting set to false? If so, i guess it wont' have the
> error message you mentioned in the beginning like 
> 
> Error: WebGL warning: Unable to restrict WebGL limits in order to resist
> fingerprinting
> ....
> ....
> 
No, sorry for being unclear, the problem *only* happens when resistFingerprinting is set to true, everything is fine when it is disabled.

> What else message you saw? 

The only other messages I saw were webpage specific caused by the WebGL context failing to initialize.

> Attaching about:support into this bug would be fine for further analysis. Thanks.

I'm attaching an about:support log from my Mac.
Flags: needinfo?(floooh)
Btw, the problem also reproduces on my gaming PC, Win10 with Geforce 1070 (so far it happened on all machines I tested on).
Just a thought, but shouldn't the resistFingerprinting feature *never* cause the WebGL initialization to fail? How would you guarantee that some future change in WebGL or the underlying layers (ANGLE or the graphics driver) will not cause the same problem, especially on mobile with its wide range of capabilities?

Also, how would we take advantage with hardware with *better* capabilities than what the fingerprinting-normalization allows? There's a huge difference between desktop and mobile GPUs for instance.

Wouldn't it be better, if a capability doesn't meet the resistFingerprinting requirement, that this capability is 'tunneled through' even if it means some minor variation in the "fingerprint" (90% of the other caps will still be normalized).
Testing on MacBook Pro (13-inch, 2016, Four Thunderbolt 3 Ports) macOS Sierra 10.12.6 and Firefox Nightly 58.0a1 (2017-10-18) (64-bit), I am able to reproduce, with STR

1. In about:config, set pref privacy.resistFingerprinting;true
2. Visit https://threejs.org/examples/#webgl_animation_cloth

Will print out "Your graphics card does not seem to support WebGL", with

the following items in the log:

Error: WebGL warning: Unable to restrict WebGL limits in order to resist fingerprinting
Detector.js:13:99
Error: WebGL warning: Failed to create WebGL context: WebGL creation failed: 
* 
* Exhausted GL driver options.
Detector.js:13:99
Error: WebGL warning: Unable to restrict WebGL limits in order to resist fingerprinting
Detector.js:13:131
Error: WebGL warning: Failed to create WebGL context: WebGL creation failed: 
* 
* Exhausted GL driver options.
Detector.js:13:131
THREE.WebGLRenderer 87
three.js:20919:3
Error: WebGL warning: Unable to restrict WebGL limits in order to resist fingerprinting
three.js:21080:22
Error: WebGL warning: Failed to create WebGL context: WebGL creation failed: 
* 
* Exhausted GL driver options.
three.js:21080:22
Error: WebGL warning: Unable to restrict WebGL limits in order to resist fingerprinting
three.js:21080:74
Error: WebGL warning: Failed to create WebGL context: WebGL creation failed: 
* 
* Exhausted GL driver options.
three.js:21080:74
Error: WebGL warning: Unable to restrict WebGL limits in order to resist fingerprinting
three.js:21084:10
Error: WebGL warning: Failed to create WebGL context: WebGL creation failed: 
* 
* Exhausted GL driver options.
three.js:21084:10
THREE.WebGLRenderer: Error creating WebGL context.
three.js:21113:4
TypeError: gl is null
[Learn More]
Status: UNCONFIRMED → NEW
Ever confirmed: true
about:support gives no WebGL available under graphics section when the pref privacy.resistFingerprinting is enabled, and when that pref is disabled, the result is

Graphics
Features
Compositing	OpenGL
Asynchronous Pan/Zoom	wheel input enabled; scrollbar drag enabled; keyboard enabled; autoscroll enabled
WebGL 1 Driver WSI Info	CGL
WebGL 1 Driver Renderer	Intel Inc. -- Intel(R) Iris(TM) Graphics 550
WebGL 1 Driver Version	4.1 INTEL-10.25.17
WebGL 1 Driver Extensions	GL_ARB_blend_func_extended GL_ARB_draw_buffers_blend GL_ARB_draw_indirect GL_ARB_ES2_compatibility GL_ARB_explicit_attrib_location GL_ARB_gpu_shader_fp64 GL_ARB_gpu_shader5 GL_ARB_instanced_arrays GL_ARB_internalformat_query GL_ARB_occlusion_query2 GL_ARB_sample_shading GL_ARB_sampler_objects GL_ARB_separate_shader_objects GL_ARB_shader_bit_encoding GL_ARB_shader_subroutine GL_ARB_shading_language_include GL_ARB_tessellation_shader GL_ARB_texture_buffer_object_rgb32 GL_ARB_texture_cube_map_array GL_ARB_texture_gather GL_ARB_texture_query_lod GL_ARB_texture_rgb10_a2ui GL_ARB_texture_storage GL_ARB_texture_swizzle GL_ARB_timer_query GL_ARB_transform_feedback2 GL_ARB_transform_feedback3 GL_ARB_vertex_attrib_64bit GL_ARB_vertex_type_2_10_10_10_rev GL_ARB_viewport_array GL_EXT_debug_label GL_EXT_debug_marker GL_EXT_framebuffer_multisample_blit_scaled GL_EXT_texture_compression_s3tc GL_EXT_texture_filter_anisotropic GL_EXT_texture_sRGB_decode GL_APPLE_client_storage GL_APPLE_container_object_shareable GL_APPLE_flush_render GL_APPLE_object_purgeable GL_APPLE_rgb_422 GL_APPLE_row_bytes GL_APPLE_texture_range GL_ATI_texture_mirror_once GL_NV_texture_barrier
WebGL 1 Extensions	ANGLE_instanced_arrays EXT_blend_minmax EXT_color_buffer_half_float EXT_frag_depth EXT_sRGB EXT_shader_texture_lod EXT_texture_filter_anisotropic EXT_disjoint_timer_query OES_element_index_uint OES_standard_derivatives OES_texture_float OES_texture_float_linear OES_texture_half_float OES_texture_half_float_linear OES_vertex_array_object WEBGL_color_buffer_float WEBGL_compressed_texture_s3tc WEBGL_compressed_texture_s3tc_srgb WEBGL_debug_renderer_info WEBGL_debug_shaders WEBGL_depth_texture WEBGL_draw_buffers WEBGL_lose_context
WebGL 2 Driver WSI Info	CGL
WebGL 2 Driver Renderer	Intel Inc. -- Intel(R) Iris(TM) Graphics 550
WebGL 2 Driver Version	4.1 INTEL-10.25.17
WebGL 2 Driver Extensions	GL_ARB_blend_func_extended GL_ARB_draw_buffers_blend GL_ARB_draw_indirect GL_ARB_ES2_compatibility GL_ARB_explicit_attrib_location GL_ARB_gpu_shader_fp64 GL_ARB_gpu_shader5 GL_ARB_instanced_arrays GL_ARB_internalformat_query GL_ARB_occlusion_query2 GL_ARB_sample_shading GL_ARB_sampler_objects GL_ARB_separate_shader_objects GL_ARB_shader_bit_encoding GL_ARB_shader_subroutine GL_ARB_shading_language_include GL_ARB_tessellation_shader GL_ARB_texture_buffer_object_rgb32 GL_ARB_texture_cube_map_array GL_ARB_texture_gather GL_ARB_texture_query_lod GL_ARB_texture_rgb10_a2ui GL_ARB_texture_storage GL_ARB_texture_swizzle GL_ARB_timer_query GL_ARB_transform_feedback2 GL_ARB_transform_feedback3 GL_ARB_vertex_attrib_64bit GL_ARB_vertex_type_2_10_10_10_rev GL_ARB_viewport_array GL_EXT_debug_label GL_EXT_debug_marker GL_EXT_framebuffer_multisample_blit_scaled GL_EXT_texture_compression_s3tc GL_EXT_texture_filter_anisotropic GL_EXT_texture_sRGB_decode GL_APPLE_client_storage GL_APPLE_container_object_shareable GL_APPLE_flush_render GL_APPLE_object_purgeable GL_APPLE_rgb_422 GL_APPLE_row_bytes GL_APPLE_texture_range GL_ATI_texture_mirror_once GL_NV_texture_barrier
WebGL 2 Extensions	EXT_color_buffer_float EXT_texture_filter_anisotropic EXT_disjoint_timer_query OES_texture_float_linear WEBGL_compressed_texture_s3tc WEBGL_compressed_texture_s3tc_srgb WEBGL_debug_renderer_info WEBGL_debug_shaders WEBGL_lose_context
GPU #1
Active	Yes
Vendor ID	0x8086
Device ID	0x1927
Diagnostics
AzureCanvasAccelerated	1
AzureCanvasBackend	skia
AzureContentBackend	skia
AzureFallbackCanvasBackend	none
TileHeight	1024
TileWidth	1024
Decision Log
WEBRENDER	
opt-in by default: WebRender is an opt-in feature
OMTP	
disabled by default: Disabled by default
blocked by runtime: OMTP does not yet support tiling
Whiteboard: [tor][fingerprinting-breakage][fp:backlog] → [tor][fingerprinting-breakage][fp:backlog][gfx-noted]
Assignee: nobody → dmu
This happens at ok &= RestrictCap(&mGLAliasedLineWidthRange[1], kCommonAliasedLineWidthRangeMax);, https://dxr.mozilla.org/mozilla-central/rev/b056526be38e96b3e381b7e90cd8254ad1d96d9d/dom/canvas/WebGLContextValidate.cpp#638. If we change kCommonAliasedLineWidthRangeMax to be 1, the problem can be resolved. I am interested in why we define this constant value?
See Also: → 1217290
On try server, we get LOCAL_GL_MAX_CUBE_MAP_TEXTURE_SIZE = 512 on mac, but on my local OSX machine, it would be 16384. Probably, our try server doesn't meet our requirement for WebGLMinCapabilityMode.
See Also: → 1418343
Comment on attachment 8930314 [details]
Bug 1409677 - Adjust kCommonAliasedLineWidthRangeMax to 1 in WebGL resistFingerprint mode;

https://reviewboard.mozilla.org/r/201456/#review206612

Looks good to me, thanks for doing this :)
Attachment #8930314 - Flags: review?(cfu) → review+
Comment on attachment 8930314 [details]
Bug 1409677 - Adjust kCommonAliasedLineWidthRangeMax to 1 in WebGL resistFingerprint mode;

https://reviewboard.mozilla.org/r/201456/#review207178
Attachment #8930314 - Flags: review?(jgilbert) → review+
Pushed by dmu@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/22f422e17767
Adjust kCommonAliasedLineWidthRangeMax to 1 in WebGL resistFingerprint mode; r=cfu,jgilbert
https://hg.mozilla.org/mozilla-central/rev/22f422e17767
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
Andre, could you help me check the current Nightly has resolved your problem when `resistFingerprinting;true`? thanks!

This bug seems to affect FF 57 as well. We need to uplift it after getting the confirmation.
Flags: needinfo?(floooh)
Comment on attachment 8930314 [details]
Bug 1409677 - Adjust kCommonAliasedLineWidthRangeMax to 1 in WebGL resistFingerprint mode;

Approval Request Comment
[Feature/Bug causing the regression]: Turn on ResistFingerprint making WebGL can't initialize on Mac and Windows.
[User impact if declined]: Users can't use WebGL when they choose ResistFingerprint.
[Is this code covered by automated tests?]: Yes. We have `dom/canvas/test/webgl-mochitest/test_webgl_fingerprinting_resistance.html` for this.
[Has the fix been verified in Nightly?]: Yes
[Needs manual test from QE? If yes, steps to reproduce]: Nope. I have verified it personally.
[List of other uplifts needed for the feature/fix]: nope
[Is the change risky?]: nope. It helps the users when using `ResistFingerprint`.
[Why is the change risky/not risky?]: no risky. It makes users can initialize WebGL.
[String changes made/needed]: nope.
Attachment #8930314 - Flags: approval-mozilla-beta?
(In reply to Daosheng Mu[:daoshengmu] from comment #19)
> Comment on attachment 8930314 [details]
> Bug 1409677 - Adjust kCommonAliasedLineWidthRangeMax to 1 in WebGL
> resistFingerprint mode;
> 
> Approval Request Comment
> [Feature/Bug causing the regression]: Turn on ResistFingerprint making WebGL
> can't initialize on Mac and Windows.
> [User impact if declined]: Users can't use WebGL when they choose
> ResistFingerprint.
> [Is this code covered by automated tests?]: Yes. We have
> `dom/canvas/test/webgl-mochitest/test_webgl_fingerprinting_resistance.html`
> for this.
> [Has the fix been verified in Nightly?]: Yes
> [Needs manual test from QE? If yes, steps to reproduce]: Nope. I have
> verified it personally.
> [List of other uplifts needed for the feature/fix]: nope
> [Is the change risky?]: nope. It helps the users when using
> `ResistFingerprint`.
> [Why is the change risky/not risky?]: no risky. It makes users can
> initialize WebGL.
> [String changes made/needed]: nope.

The bug no. that causes this regression: Bug 1217290.
(In reply to Daosheng Mu[:daoshengmu] from comment #18)
> Andre, could you help me check the current Nightly has resolved your problem
> when `resistFingerprinting;true`? thanks!
> 
> This bug seems to affect FF 57 as well. We need to uplift it after getting
> the confirmation.

This specific problem appears to be fixed (WebGL is initialization now and my samples are running). I tested on MacOS 10.13.2 Beta, with FF Nightly 59.0a1 (2017-11-25) (64-bit). I'm seeing reduced WebGL capabilities (such as max texture size), but they are enough at least for my demos.

I'm seeing another problem which is unrelated to WebGL though, it appears the timer functions are broken, or have a very low resolution, so my time measurement stuff is getting confused.

I'll try to find out if there's already a ticket for that and will open a new one if not.

Cheers!
Flags: needinfo?(floooh)
Comment on attachment 8930314 [details]
Bug 1409677 - Adjust kCommonAliasedLineWidthRangeMax to 1 in WebGL resistFingerprint mode;

Fix a side effect of enabling ResistFingerprint. Let's take it in Beta58.
Attachment #8930314 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
(In reply to Daosheng Mu[:daoshengmu] from comment #19)
> [Is this code covered by automated tests?]: Yes. We have
> `dom/canvas/test/webgl-mochitest/test_webgl_fingerprinting_resistance.html`
> for this.
> [Has the fix been verified in Nightly?]: Yes
> [Needs manual test from QE? If yes, steps to reproduce]: Nope. I have
> verified it personally.

Has automated coverage, does not need manual testing, per Daosheng Mu.
Flags: qe-verify-
Duplicate of this bug: 1418343
You need to log in before you can comment on or make changes to this bug.