Closed Bug 1752907 Opened 4 years ago Closed 3 years ago

Cut over Hardware Concurrency to finer-grained RFP Check

Categories

(Core :: DOM: Workers, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
102 Branch
Tracking Status
firefox100 --- wontfix
firefox101 --- wontfix
firefox102 --- fixed

People

(Reporter: asharm28, Assigned: asharm28)

References

(Depends on 1 open bug, Blocks 1 open bug)

Details

Attachments

(4 files, 1 obsolete file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 Safari/537.36

Component: Untriaged → DOM: Workers
Product: Firefox → Core
Version: 1.0 Branch → unspecified
Assignee: nobody → asharm28
Blocks: 1753645
Blocks: finegrained-rfp
No longer blocks: 1753645
Blocks: 1753645
Pushed by tritter@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/370f46a043e4 Cut over Hardware Concurrency to finer-grained RFP Check r=tjr

Backed out for causing mochitest failures on browser_navigator.js

Backout link

Push with failures

Failure log

Failure line(s): TEST-UNEXPECTED-FAIL | browser/components/resistfingerprinting/test/browser/browser_navigator.js | Checking spoofed navigator.hardwareConcurrency. - Got 6, expected 2

Flags: needinfo?(asharm28)

There's a r+ patch which didn't land and no activity in this bug for 2 weeks.
:asharm28, could you have a look please?
If you still have some work to do, you can add an action "Plan Changes" in Phabricator.
For more information, please visit auto_nag documentation.

Flags: needinfo?(tom)
Flags: needinfo?(asharm28)
diff --git a/dom/workers/WorkerNavigator.cpp b/dom/workers/WorkerNavigator.cpp
--- a/dom/workers/WorkerNavigator.cpp
+++ b/dom/workers/WorkerNavigator.cpp
@@ -171,17 +171,21 @@ void WorkerNavigator::GetUserAgent(nsStr
 
   runnable->Dispatch(Canceling, aRv);
 }
 
 uint64_t WorkerNavigator::HardwareConcurrency() const {
   RuntimeService* rts = RuntimeService::GetService();
   MOZ_ASSERT(rts);
 
-  return rts->ClampedHardwareConcurrency();
+  WorkerPrivate* aWorkerPrivate = GetCurrentThreadWorkerPrivate();
+  bool rfp = aWorkerPrivate->ShouldResistFingerprinting();
+  fprintf(stderr, "ZTZT WorkerNavigator::HardwareConcurrency %s\n", rfp ? "yes" : "no");
+
+  return rts->ClampedHardwareConcurrency(rfp);
 }
 
 StorageManager* WorkerNavigator::Storage() {
   if (!mStorageManager) {
     WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate();
     MOZ_ASSERT(workerPrivate);
 
     RefPtr<nsIGlobalObject> global = workerPrivate->GlobalScope();
diff --git a/dom/workers/WorkerPrivate.cpp b/dom/workers/WorkerPrivate.cpp
--- a/dom/workers/WorkerPrivate.cpp
+++ b/dom/workers/WorkerPrivate.cpp
@@ -2644,16 +2644,17 @@ nsresult WorkerPrivate::GetLoadInfo(JSCo
     loadInfo.mHasStorageAccessPermissionGranted =
         aParent->HasStorageAccessPermissionGranted();
     loadInfo.mCookieJarSettings = aParent->CookieJarSettings();
     loadInfo.mOriginAttributes = aParent->GetOriginAttributes();
     loadInfo.mServiceWorkersTestingInWindow =
         aParent->ServiceWorkersTestingInWindow();
     loadInfo.mShouldResistFingerprinting =
         aParent->ShouldResistFingerprinting();
+    fprintf(stderr, "ZTZT %s\n", loadInfo.mShouldResistFingerprinting ? "yes" : "no");
     loadInfo.mIsThirdPartyContextToTopWindow =
         aParent->IsThirdPartyContextToTopWindow();
     loadInfo.mParentController = aParent->GlobalScope()->GetController();
     loadInfo.mWatchedByDevTools = aParent->IsWatchedByDevTools();
   } else {
     AssertIsOnMainThread();
 
     // Make sure that the IndexedDatabaseManager is set up
@@ -2785,16 +2786,17 @@ nsresult WorkerPrivate::GetLoadInfo(JSCo
       loadInfo.mFromWindow = true;
       loadInfo.mWindowID = globalWindow->WindowID();
       loadInfo.mStorageAccess = StorageAllowedForWindow(globalWindow);
       loadInfo.mUseRegularPrincipal = document->UseRegularPrincipal();
       loadInfo.mHasStorageAccessPermissionGranted =
           document->HasStorageAccessPermissionGranted();
       loadInfo.mShouldResistFingerprinting =
           nsContentUtils::ShouldResistFingerprinting(document);
+      fprintf(stderr, "ZTZT %s\n", loadInfo.mShouldResistFingerprinting ? "yes" : "no");
 
       // This is an hack to deny the storage-access-permission for workers of
       // sub-iframes.
       if (loadInfo.mHasStorageAccessPermissionGranted &&
           StorageAllowedForDocument(document) != StorageAccess::eAllow) {
         loadInfo.mHasStorageAccessPermissionGranted = false;
       }
       loadInfo.mIsThirdPartyContextToTopWindow =
diff --git a/dom/workers/WorkerPrivate.h b/dom/workers/WorkerPrivate.h
--- a/dom/workers/WorkerPrivate.h
+++ b/dom/workers/WorkerPrivate.h
@@ -847,16 +847,17 @@ class WorkerPrivate final
   }
 
   // Determine if the SW testing per-window flag is set by devtools
   bool ServiceWorkersTestingInWindow() const {
     return mLoadInfo.mServiceWorkersTestingInWindow;
   }
 
   bool ShouldResistFingerprinting() const {
+    fprintf(stderr, "ZTZT WP::ShouldResistFingerprinting() %s\n", mLoadInfo.mShouldResistFingerprinting ? "yes" : "no");
     return mLoadInfo.mShouldResistFingerprinting;
   }
 
   // Determin if the worker was created under a third-party context.
   bool IsThirdPartyContextToTopWindow() const {
     return mLoadInfo.mIsThirdPartyContextToTopWindow;
   }

Getting really weird result with the WorkerPrivate loadinfo data not being persisted; need to investigate....

Depends on: 1758125

Because right now we only have hardware concurrency wired
up to the fine-grained RFP checks this is a copy of the
regular RFP test but with the hardware concurrency field
set to the non-spoofed value

Depends on D141772

Pushed by tritter@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/94d4b31ef7d0 Correctly populate the RFP member on Workers r=asuth
Status: UNCONFIRMED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 100 Branch

Need to land a couple more on this bug.

Status: RESOLVED → REOPENED
Ever confirmed: true
Flags: needinfo?(tom)
Flags: needinfo?(asharm28)
Resolution: FIXED → ---
Pushed by tritter@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/e6c18f35ac5f Cut over Hardware Concurrency to finer-grained RFP Check r=tjr https://hg.mozilla.org/integration/autoland/rev/e50ad7304c18 Add some helpful log messages to test r=asuth https://hg.mozilla.org/integration/autoland/rev/747092282e35 Add a new RFP exemptions subtest r=asuth

Backed out for causing failures on browser_navigator.js. CLOSED TREE

Backout link: https://hg.mozilla.org/integration/autoland/rev/f749cf663753da619cf06d946d51535c89dc67b5

Push with failures : https://treeherder.mozilla.org/jobs?repo=autoland&resultStatus=pending%2Crunning%2Csuccess%2Ctestfailed%2Cbusted%2Cexception%2Crunnable&searchStr=windows%2C7%2Cwebrender%2Copt%2Cmochitests%2Cwith%2Cfission%2Cenabled%2Ctest-windows7-32-qr%2Fopt-mochitest-browser-chrome-fis-e10s%2Cbc7&revision=747092282e35bcd902865963dd72b76550a2f066

Link to failure log: https://treeherder.mozilla.org/logviewer?job_id=372215458&repo=autoland&lineNumber=5581

Failure message:
TEST-UNEXPECTED-FAIL | browser/components/resistfingerprinting/test/browser/browser_navigator.js | Checking spoofed navigator.oscpu. - Got "Windows NT 6.1", expected "Windows NT 10.0; Win64; x64"

Flags: needinfo?(asharm28)

This failure is unrelated to this patch.

This test is supposed to be skipped when it's 32 bit Firefox running on 64 bit Windows. The skip-if says 'debug', the test that failed was 'opt' but I'm not sure why the 'debug' is in there, it seems like it should be both. Chris, does that seem right?

Flags: needinfo?(cpeterson)

(In reply to Tom Ritter [:tjr] (ni for sec-approvals and such) from comment #15)

This failure is unrelated to this patch.

This test is supposed to be skipped when it's 32 bit Firefox running on 64 bit Windows. The skip-if says 'debug', the test that failed was 'opt' but I'm not sure why the 'debug' is in there, it seems like it should be both. Chris, does that seem right?

I agree:

  • That test failure is not this patch's fault.
  • We should probably skip this test for both debug and opt in 32-bit Firefox on 64-bit Windows.

I looking into fixing this test to pass in 32-bit Firefox on 64-bit Windows, but it wasn't a high priority and I forgot. I'll try to fix the test soon or just disable it for both debug and opt.

Flags: needinfo?(cpeterson)
See Also: → 1713764
Pushed by cpeterson@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/085cb7354660 Disable the navigator test on x86 Windows r=cpeterson
Status: REOPENED → RESOLVED
Closed: 4 years ago3 years ago
Resolution: --- → FIXED

Since the status are different for nightly and release, what's the status for beta?
For more information, please visit auto_nag documentation.

We haven't resolved this yet.

Status: RESOLVED → REOPENED
Flags: needinfo?(asharm28)
Resolution: FIXED → ---
Pushed by tritter@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/b43752720ca6 Cut over Hardware Concurrency to finer-grained RFP Check r=tjr https://hg.mozilla.org/integration/autoland/rev/904ca697efbb Add some helpful log messages to test r=asuth https://hg.mozilla.org/integration/autoland/rev/d386072b56b6 Add a new RFP exemptions subtest r=asuth
Attachment #9268889 - Attachment is obsolete: true
See Also: → 1841950
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: