зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1709383 - Add Win32k Lockdown status to about:support and Crash Reporter r=gsvelto,flod,bobowen,mossop,fluent-reviewers,chutten
- Move the decision logic for Win32k Lockdown to a common area where it can be re-used - Cache the Win32k Lockdown state, since the result will never change - Add IDL to allow JavaScript to query it - Add it to the "about:support" page - Add an annotation to Crash Reporter after the first time it's read Differential Revision: https://phabricator.services.mozilla.com/D114850
This commit is contained in:
Родитель
e92b057a83
Коммит
b2a51853d0
|
@ -17,7 +17,7 @@
|
||||||
#ifdef XP_WIN
|
#ifdef XP_WIN
|
||||||
# include "mozilla/gfx/gfxVars.h"
|
# include "mozilla/gfx/gfxVars.h"
|
||||||
# include "mozilla/WindowsVersion.h"
|
# include "mozilla/WindowsVersion.h"
|
||||||
|
# include "nsExceptionHandler.h"
|
||||||
#endif // XP_WIN
|
#endif // XP_WIN
|
||||||
|
|
||||||
using namespace mozilla;
|
using namespace mozilla;
|
||||||
|
@ -46,6 +46,7 @@ const char* ContentWin32kLockdownStateToString(
|
||||||
ContentWin32kLockdownState GetContentWin32kLockdownState() {
|
ContentWin32kLockdownState GetContentWin32kLockdownState() {
|
||||||
#ifdef XP_WIN
|
#ifdef XP_WIN
|
||||||
static ContentWin32kLockdownState result = [] {
|
static ContentWin32kLockdownState result = [] {
|
||||||
|
ContentWin32kLockdownState state = [] {
|
||||||
if (!IsWin8OrLater()) {
|
if (!IsWin8OrLater()) {
|
||||||
return ContentWin32kLockdownState::OperatingSystemNotSupported;
|
return ContentWin32kLockdownState::OperatingSystemNotSupported;
|
||||||
}
|
}
|
||||||
|
@ -70,6 +71,14 @@ ContentWin32kLockdownState GetContentWin32kLockdownState() {
|
||||||
return ContentWin32kLockdownState::LockdownEnabled;
|
return ContentWin32kLockdownState::LockdownEnabled;
|
||||||
}();
|
}();
|
||||||
|
|
||||||
|
const char* stateStr = ContentWin32kLockdownStateToString(state);
|
||||||
|
CrashReporter::AnnotateCrashReport(
|
||||||
|
CrashReporter::Annotation::ContentSandboxWin32kState,
|
||||||
|
nsDependentCString(stateStr));
|
||||||
|
|
||||||
|
return state;
|
||||||
|
}();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
#else // XP_WIN
|
#else // XP_WIN
|
||||||
|
@ -149,6 +158,20 @@ NS_IMETHODIMP SandboxSettings::GetEffectiveContentSandboxLevel(
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP SandboxSettings::GetContentWin32kLockdownState(int32_t* aRetVal) {
|
||||||
|
*aRetVal = static_cast<int32_t>(mozilla::GetContentWin32kLockdownState());
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
SandboxSettings::GetContentWin32kLockdownStateString(nsAString& aString) {
|
||||||
|
ContentWin32kLockdownState lockdownState =
|
||||||
|
mozilla::GetContentWin32kLockdownState();
|
||||||
|
aString = NS_ConvertASCIItoUTF16(
|
||||||
|
mozilla::ContentWin32kLockdownStateToString(lockdownState));
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
NS_IMPL_COMPONENT_FACTORY(mozISandboxSettings) {
|
NS_IMPL_COMPONENT_FACTORY(mozISandboxSettings) {
|
||||||
|
|
|
@ -12,6 +12,13 @@
|
||||||
interface mozISandboxSettings : nsISupports
|
interface mozISandboxSettings : nsISupports
|
||||||
{
|
{
|
||||||
readonly attribute long effectiveContentSandboxLevel;
|
readonly attribute long effectiveContentSandboxLevel;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The possible values for this are defined in the ContentWin32kLockdownState
|
||||||
|
* enum in security/sandbox/common/SandboxSettings.h
|
||||||
|
*/
|
||||||
|
readonly attribute long contentWin32kLockdownState;
|
||||||
|
readonly attribute AString contentWin32kLockdownStateString;
|
||||||
};
|
};
|
||||||
|
|
||||||
%{ C++
|
%{ C++
|
||||||
|
|
|
@ -1595,15 +1595,27 @@ EnvironmentCache.prototype = {
|
||||||
|
|
||||||
_getSandboxData() {
|
_getSandboxData() {
|
||||||
let effectiveContentProcessLevel = null;
|
let effectiveContentProcessLevel = null;
|
||||||
|
let contentWin32kLockdownState = null;
|
||||||
try {
|
try {
|
||||||
let sandboxSettings = Cc[
|
let sandboxSettings = Cc[
|
||||||
"@mozilla.org/sandbox/sandbox-settings;1"
|
"@mozilla.org/sandbox/sandbox-settings;1"
|
||||||
].getService(Ci.mozISandboxSettings);
|
].getService(Ci.mozISandboxSettings);
|
||||||
effectiveContentProcessLevel =
|
effectiveContentProcessLevel =
|
||||||
sandboxSettings.effectiveContentSandboxLevel;
|
sandboxSettings.effectiveContentSandboxLevel;
|
||||||
|
|
||||||
|
// See `ContentWin32kLockdownState` in
|
||||||
|
// <security/sandbox/common/SandboxSettings.h>
|
||||||
|
//
|
||||||
|
// Values:
|
||||||
|
// 1 = LockdownEnabled
|
||||||
|
// 2 = MissingWebRender
|
||||||
|
// 3 = OperatingSystemNotSupported
|
||||||
|
// 4 = PrefNotSet
|
||||||
|
contentWin32kLockdownState = sandboxSettings.contentWin32kLockdownState;
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
return {
|
return {
|
||||||
effectiveContentProcessLevel,
|
effectiveContentProcessLevel,
|
||||||
|
contentWin32kLockdownState,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -88,6 +88,7 @@ Structure:
|
||||||
},
|
},
|
||||||
sandbox: {
|
sandbox: {
|
||||||
effectiveContentProcessLevel: <integer>,
|
effectiveContentProcessLevel: <integer>,
|
||||||
|
contentWin32kLockdownState: <integer>,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// Optional, missing if fetching the information failed or had not yet completed.
|
// Optional, missing if fetching the information failed or had not yet completed.
|
||||||
|
@ -419,6 +420,7 @@ This object contains data about the state of Firefox's sandbox.
|
||||||
Specific keys are:
|
Specific keys are:
|
||||||
|
|
||||||
- ``effectiveContentProcessLevel``: The meanings of the values are OS dependent. Details of the meanings can be found in the `Firefox prefs file <https://hg.mozilla.org/mozilla-central/file/tip/browser/app/profile/firefox.js>`_. The value here is the effective value, not the raw value, some platforms enforce a minimum sandbox level. If there is an error calculating this, it will be ``null``.
|
- ``effectiveContentProcessLevel``: The meanings of the values are OS dependent. Details of the meanings can be found in the `Firefox prefs file <https://hg.mozilla.org/mozilla-central/file/tip/browser/app/profile/firefox.js>`_. The value here is the effective value, not the raw value, some platforms enforce a minimum sandbox level. If there is an error calculating this, it will be ``null``.
|
||||||
|
- ``contentWin32kLockdownState``: The status of Win32k Lockdown for Content process. 1 = "Lockdown enabled", 2 = "Lockdown disabled -- Missing WebRender", 3 = "Lockdown disabled -- Unsupported OS", 4 = "Lockdown disabled -- User pref not set". If there is an error calculating this, it will be ``null``.
|
||||||
|
|
||||||
profile
|
profile
|
||||||
-------
|
-------
|
||||||
|
|
|
@ -299,6 +299,21 @@ var TelemetryEnvironmentTesting = {
|
||||||
Assert.equal(typeof update.autoDownload, "boolean");
|
Assert.equal(typeof update.autoDownload, "boolean");
|
||||||
Assert.equal(typeof update.background, "boolean");
|
Assert.equal(typeof update.background, "boolean");
|
||||||
|
|
||||||
|
// Check sandbox settings exist and make sense
|
||||||
|
Assert.equal(
|
||||||
|
typeof data.settings.sandbox.effectiveContentProcessLevel,
|
||||||
|
"number",
|
||||||
|
"sandbox.effectiveContentProcessLevel must have the correct type"
|
||||||
|
);
|
||||||
|
Assert.equal(
|
||||||
|
typeof data.settings.sandbox.contentWin32kLockdownState,
|
||||||
|
"number",
|
||||||
|
"sandbox.contentWin32kLockdownState must have the correct type"
|
||||||
|
);
|
||||||
|
|
||||||
|
let win32kLockdownState = data.settings.sandbox.contentWin32kLockdownState;
|
||||||
|
Assert.ok(win32kLockdownState >= 1 && win32kLockdownState <= 4);
|
||||||
|
|
||||||
// Check "defaultSearchEngine" separately, as it can either be undefined or string.
|
// Check "defaultSearchEngine" separately, as it can either be undefined or string.
|
||||||
if ("defaultSearchEngine" in data.settings) {
|
if ("defaultSearchEngine" in data.settings) {
|
||||||
this.checkString(data.settings.defaultSearchEngine);
|
this.checkString(data.settings.defaultSearchEngine);
|
||||||
|
|
|
@ -230,6 +230,11 @@ ContentSandboxLevel:
|
||||||
Content sandbox level.
|
Content sandbox level.
|
||||||
type: integer
|
type: integer
|
||||||
|
|
||||||
|
ContentSandboxWin32kState:
|
||||||
|
description: >
|
||||||
|
Content sandbox Win32k state
|
||||||
|
type: string
|
||||||
|
|
||||||
CoUnmarshalInterfaceResult:
|
CoUnmarshalInterfaceResult:
|
||||||
description: >
|
description: >
|
||||||
Annotation describing the error returned by trying to unmarshal an object
|
Annotation describing the error returned by trying to unmarshal an object
|
||||||
|
|
|
@ -343,6 +343,7 @@ can-sandbox-content = Content Process Sandboxing
|
||||||
can-sandbox-media = Media Plugin Sandboxing
|
can-sandbox-media = Media Plugin Sandboxing
|
||||||
content-sandbox-level = Content Process Sandbox Level
|
content-sandbox-level = Content Process Sandbox Level
|
||||||
effective-content-sandbox-level = Effective Content Process Sandbox Level
|
effective-content-sandbox-level = Effective Content Process Sandbox Level
|
||||||
|
content-win32k-lockdown-state = Win32k Lockdown State for Content Process
|
||||||
sandbox-proc-type-content = content
|
sandbox-proc-type-content = content
|
||||||
sandbox-proc-type-file = file content
|
sandbox-proc-type-file = file content
|
||||||
sandbox-proc-type-media-plugin = media plugin
|
sandbox-proc-type-media-plugin = media plugin
|
||||||
|
|
|
@ -1001,6 +1001,8 @@ if (AppConstants.MOZ_SANDBOX) {
|
||||||
);
|
);
|
||||||
data.effectiveContentSandboxLevel =
|
data.effectiveContentSandboxLevel =
|
||||||
sandboxSettings.effectiveContentSandboxLevel;
|
sandboxSettings.effectiveContentSandboxLevel;
|
||||||
|
data.contentWin32kLockdownState =
|
||||||
|
sandboxSettings.contentWin32kLockdownStateString;
|
||||||
}
|
}
|
||||||
|
|
||||||
done(data);
|
done(data);
|
||||||
|
|
|
@ -1000,6 +1000,10 @@ const SNAPSHOT_SCHEMA = {
|
||||||
required: AppConstants.MOZ_SANDBOX,
|
required: AppConstants.MOZ_SANDBOX,
|
||||||
type: "number",
|
type: "number",
|
||||||
},
|
},
|
||||||
|
contentWin32kLockdownState: {
|
||||||
|
required: AppConstants.MOZ_SANDBOX,
|
||||||
|
type: "string",
|
||||||
|
},
|
||||||
syscallLog: {
|
syscallLog: {
|
||||||
required: AppConstants.platform == "linux",
|
required: AppConstants.platform == "linux",
|
||||||
type: "array",
|
type: "array",
|
||||||
|
|
Загрузка…
Ссылка в новой задаче