зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 2 changesets (bug 1709383) for failures on test_TelemetryEnvironment.js. CLOSED TREE
Backed out changeset 64774be5aaff (bug 1709383) Backed out changeset 17a95b19bb75 (bug 1709383)
This commit is contained in:
Родитель
fec8826aa3
Коммит
91ab999d72
|
@ -4,7 +4,6 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/SandboxSettings.h"
|
||||
#include "mozISandboxSettings.h"
|
||||
|
||||
#include "mozilla/Components.h"
|
||||
|
@ -14,80 +13,10 @@
|
|||
|
||||
#include "prenv.h"
|
||||
|
||||
#ifdef XP_WIN
|
||||
# include "mozilla/gfx/gfxVars.h"
|
||||
# include "mozilla/WindowsVersion.h"
|
||||
# include "nsExceptionHandler.h"
|
||||
#endif // XP_WIN
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
const char* ContentWin32kLockdownStateToString(
|
||||
ContentWin32kLockdownState aValue) {
|
||||
switch (aValue) {
|
||||
case ContentWin32kLockdownState::LockdownEnabled:
|
||||
return "Win32k Lockdown enabled";
|
||||
|
||||
case ContentWin32kLockdownState::MissingWebRender:
|
||||
return "Win32k Lockdown disabled -- Missing WebRender";
|
||||
|
||||
case ContentWin32kLockdownState::OperatingSystemNotSupported:
|
||||
return "Win32k Lockdown disabled -- Operating system not supported";
|
||||
|
||||
case ContentWin32kLockdownState::PrefNotSet:
|
||||
return "Win32k Lockdown disabled -- Preference not set";
|
||||
}
|
||||
|
||||
MOZ_CRASH("Should never reach here");
|
||||
}
|
||||
|
||||
ContentWin32kLockdownState GetContentWin32kLockdownState() {
|
||||
#ifdef XP_WIN
|
||||
static ContentWin32kLockdownState result = [] {
|
||||
ContentWin32kLockdownState state = [] {
|
||||
if (!IsWin8OrLater()) {
|
||||
return ContentWin32kLockdownState::OperatingSystemNotSupported;
|
||||
}
|
||||
|
||||
// Win32k Lockdown requires WebRender, but WR is not currently guaranteed
|
||||
// on all computers. It can also fail to initialize and fallback to
|
||||
// non-WR render path.
|
||||
//
|
||||
// We don't want a situation where "Win32k Lockdown + No WR" occurs
|
||||
// without the user explicitly requesting unsupported behavior.
|
||||
if (!gfx::gfxVars::UseWebRender()) {
|
||||
return ContentWin32kLockdownState::MissingWebRender;
|
||||
}
|
||||
|
||||
// It's important that this goes last, as we'd like to know in
|
||||
// telemetry and crash reporting if the only thing holding the user
|
||||
// back from Win32k Lockdown is the-lack-of-asking-for-it
|
||||
if (!StaticPrefs::security_sandbox_content_win32k_disable()) {
|
||||
return ContentWin32kLockdownState::PrefNotSet;
|
||||
}
|
||||
|
||||
return ContentWin32kLockdownState::LockdownEnabled;
|
||||
}();
|
||||
|
||||
const char* stateStr = ContentWin32kLockdownStateToString(state);
|
||||
CrashReporter::AnnotateCrashReport(
|
||||
CrashReporter::Annotation::ContentSandboxWin32kState,
|
||||
nsDependentCString(stateStr));
|
||||
|
||||
return state;
|
||||
}();
|
||||
|
||||
return result;
|
||||
|
||||
#else // XP_WIN
|
||||
|
||||
return ContentWin32kLockdownState::OperatingSystemNotSupported;
|
||||
|
||||
#endif // XP_WIN
|
||||
}
|
||||
|
||||
int GetEffectiveContentSandboxLevel() {
|
||||
if (PR_GetEnv("MOZ_DISABLE_CONTENT_SANDBOX")) {
|
||||
return 0;
|
||||
|
@ -158,20 +87,6 @@ NS_IMETHODIMP SandboxSettings::GetEffectiveContentSandboxLevel(
|
|||
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
|
||||
|
||||
NS_IMPL_COMPONENT_FACTORY(mozISandboxSettings) {
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
#ifndef mozilla_SandboxSettings_h
|
||||
#define mozilla_SandboxSettings_h
|
||||
#include <cinttypes>
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
@ -19,18 +18,6 @@ int GetEffectiveSocketProcessSandboxLevel();
|
|||
// Checks whether the effective content sandbox level is > 0.
|
||||
bool IsContentSandboxEnabled();
|
||||
|
||||
enum class ContentWin32kLockdownState : int32_t {
|
||||
LockdownEnabled = 1,
|
||||
MissingWebRender,
|
||||
OperatingSystemNotSupported,
|
||||
PrefNotSet,
|
||||
};
|
||||
|
||||
const char* ContentWin32kLockdownStateToString(
|
||||
ContentWin32kLockdownState aValue);
|
||||
|
||||
ContentWin32kLockdownState GetContentWin32kLockdownState();
|
||||
|
||||
#if defined(XP_MACOSX)
|
||||
int ClampFlashSandboxLevel(const int aLevel);
|
||||
#endif
|
||||
|
|
|
@ -12,13 +12,6 @@
|
|||
interface mozISandboxSettings : nsISupports
|
||||
{
|
||||
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++
|
||||
|
|
|
@ -660,19 +660,13 @@ void SandboxBroker::SetSecurityLevelForContentProcess(int32_t aSandboxLevel,
|
|||
MOZ_RELEASE_ASSERT(sandbox::SBOX_ALL_OK == result,
|
||||
"Invalid flags for SetProcessMitigations.");
|
||||
|
||||
ContentWin32kLockdownState win32kLockdownState =
|
||||
GetContentWin32kLockdownState();
|
||||
|
||||
LOG_W("Win32k Lockdown State: '%s'",
|
||||
ContentWin32kLockdownStateToString(win32kLockdownState));
|
||||
|
||||
// The file content process has some win32k usage particular to it, for
|
||||
// example at least moz-icon usage, but we don't want to block enabling for
|
||||
// other content processes. We might want to use moz-icon in the privileged
|
||||
// about content process in the future, so we would need to exclude that as
|
||||
// well or remote moz-icon.
|
||||
if (!aIsFileProcess &&
|
||||
(win32kLockdownState == ContentWin32kLockdownState::LockdownEnabled)) {
|
||||
StaticPrefs::security_sandbox_content_win32k_disable()) {
|
||||
result = AddWin32kLockdownPolicy(mPolicy, false);
|
||||
MOZ_RELEASE_ASSERT(result == sandbox::SBOX_ALL_OK,
|
||||
"Failed to add the win32k lockdown policy");
|
||||
|
|
|
@ -1595,27 +1595,15 @@ EnvironmentCache.prototype = {
|
|||
|
||||
_getSandboxData() {
|
||||
let effectiveContentProcessLevel = null;
|
||||
let contentWin32kLockdownState = null;
|
||||
try {
|
||||
let sandboxSettings = Cc[
|
||||
"@mozilla.org/sandbox/sandbox-settings;1"
|
||||
].getService(Ci.mozISandboxSettings);
|
||||
effectiveContentProcessLevel =
|
||||
sandboxSettings.effectiveContentSandboxLevel;
|
||||
|
||||
// See `ContentWin32kLockdownState` in
|
||||
// <security/sandbox/common/SandboxSettings.h>
|
||||
//
|
||||
// Values:
|
||||
// 1 = LockdownEnabled
|
||||
// 2 = MissingWebRender
|
||||
// 3 = OperatingSystemNotSupported
|
||||
// 4 = PrefNotSet
|
||||
contentWin32kLockdownState = sandboxSettings.contentWin32kLockdownState;
|
||||
} catch (e) {}
|
||||
return {
|
||||
effectiveContentProcessLevel,
|
||||
contentWin32kLockdownState,
|
||||
};
|
||||
},
|
||||
|
||||
|
|
|
@ -88,7 +88,6 @@ Structure:
|
|||
},
|
||||
sandbox: {
|
||||
effectiveContentProcessLevel: <integer>,
|
||||
contentWin32kLockdownState: <integer>,
|
||||
}
|
||||
},
|
||||
// Optional, missing if fetching the information failed or had not yet completed.
|
||||
|
@ -420,7 +419,6 @@ This object contains data about the state of Firefox's sandbox.
|
|||
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``.
|
||||
- ``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
|
||||
-------
|
||||
|
|
|
@ -299,21 +299,6 @@ var TelemetryEnvironmentTesting = {
|
|||
Assert.equal(typeof update.autoDownload, "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.
|
||||
if ("defaultSearchEngine" in data.settings) {
|
||||
this.checkString(data.settings.defaultSearchEngine);
|
||||
|
|
|
@ -230,11 +230,6 @@ ContentSandboxLevel:
|
|||
Content sandbox level.
|
||||
type: integer
|
||||
|
||||
ContentSandboxWin32kState:
|
||||
description: >
|
||||
Content sandbox Win32k state
|
||||
type: string
|
||||
|
||||
CoUnmarshalInterfaceResult:
|
||||
description: >
|
||||
Annotation describing the error returned by trying to unmarshal an object
|
||||
|
|
|
@ -343,7 +343,6 @@ can-sandbox-content = Content Process Sandboxing
|
|||
can-sandbox-media = Media Plugin Sandboxing
|
||||
content-sandbox-level = 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-file = file content
|
||||
sandbox-proc-type-media-plugin = media plugin
|
||||
|
|
|
@ -1001,8 +1001,6 @@ if (AppConstants.MOZ_SANDBOX) {
|
|||
);
|
||||
data.effectiveContentSandboxLevel =
|
||||
sandboxSettings.effectiveContentSandboxLevel;
|
||||
data.contentWin32kLockdownState =
|
||||
sandboxSettings.contentWin32kLockdownStateString;
|
||||
}
|
||||
|
||||
done(data);
|
||||
|
|
|
@ -1000,10 +1000,6 @@ const SNAPSHOT_SCHEMA = {
|
|||
required: AppConstants.MOZ_SANDBOX,
|
||||
type: "number",
|
||||
},
|
||||
contentWin32kLockdownState: {
|
||||
required: AppConstants.MOZ_SANDBOX,
|
||||
type: "string",
|
||||
},
|
||||
syscallLog: {
|
||||
required: AppConstants.platform == "linux",
|
||||
type: "array",
|
||||
|
|
Загрузка…
Ссылка в новой задаче