Cut over Hardware Concurrency to finer-grained RFP Check
Categories
(Core :: DOM: Workers, enhancement)
Tracking
()
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
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Comment 1•4 years ago
|
||
Updated•4 years ago
|
Updated•4 years ago
|
Comment 3•4 years ago
|
||
Backed out for causing mochitest failures on browser_navigator.js
Failure line(s): TEST-UNEXPECTED-FAIL | browser/components/resistfingerprinting/test/browser/browser_navigator.js | Checking spoofed navigator.hardwareConcurrency. - Got 6, expected 2
Comment 4•4 years ago
|
||
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.
Comment 5•4 years ago
|
||
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....
Comment 6•4 years ago
|
||
Comment 7•4 years ago
|
||
Comment 8•4 years ago
|
||
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
Comment 10•4 years ago
|
||
bugherder |
Comment 11•4 years ago
|
||
Need to land a couple more on this bug.
Comment 13•4 years ago
|
||
Updated•4 years ago
|
![]() |
||
Comment 14•4 years ago
|
||
Backed out for causing failures on browser_navigator.js. CLOSED TREE
Backout link: https://hg.mozilla.org/integration/autoland/rev/f749cf663753da619cf06d946d51535c89dc67b5
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"
Comment 15•3 years ago
•
|
||
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?
Comment 16•3 years ago
|
||
(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.
Comment 17•3 years ago
|
||
Comment 18•3 years ago
|
||
Comment 19•3 years ago
|
||
bugherder |
Updated•3 years ago
|
Comment 20•3 years ago
|
||
Since the status are different for nightly and release, what's the status for beta?
For more information, please visit auto_nag documentation.
Comment 21•3 years ago
|
||
We haven't resolved this yet.
Comment 22•3 years ago
|
||
![]() |
||
Comment 23•3 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/b43752720ca6
https://hg.mozilla.org/mozilla-central/rev/904ca697efbb
https://hg.mozilla.org/mozilla-central/rev/d386072b56b6
![]() |
||
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Description
•