forked from mirrors/gecko-dev
Bug 1829971: Remove the MinGW carveout for DynamicCodePolicy r=bobowen
Depends on D176730 Differential Revision: https://phabricator.services.mozilla.com/D176731
This commit is contained in:
parent
50011bc949
commit
3b00c227c2
7 changed files with 5 additions and 92 deletions
|
|
@ -1,38 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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/. */
|
||||
|
||||
// This file is temporarily needed for bug 1766432. We plan to remove it
|
||||
// afterwards. Do not add new definitions here.
|
||||
|
||||
#ifndef mozglue_misc_MozProcessMitigationDynamicCodePolicy_h__
|
||||
#define mozglue_misc_MozProcessMitigationDynamicCodePolicy_h__
|
||||
|
||||
#include <winnt.h>
|
||||
|
||||
// See bug 1766432 comment 4. We currently need to use our own definition
|
||||
// for PROCESS_MITIGATION_DYNAMIC_CODE_POLICY in MinGW builds.
|
||||
#if defined(__MINGW32__) || defined(__MINGW64__)
|
||||
|
||||
typedef struct _MOZ_PROCESS_MITIGATION_DYNAMIC_CODE_POLICY {
|
||||
__C89_NAMELESS union {
|
||||
DWORD Flags;
|
||||
__C89_NAMELESS struct {
|
||||
DWORD ProhibitDynamicCode : 1;
|
||||
DWORD AllowThreadOptOut : 1;
|
||||
DWORD AllowRemoteDowngrade : 1;
|
||||
DWORD ReservedFlags : 29;
|
||||
};
|
||||
};
|
||||
} MOZ_PROCESS_MITIGATION_DYNAMIC_CODE_POLICY;
|
||||
|
||||
#else
|
||||
|
||||
using MOZ_PROCESS_MITIGATION_DYNAMIC_CODE_POLICY =
|
||||
PROCESS_MITIGATION_DYNAMIC_CODE_POLICY;
|
||||
|
||||
#endif // defined(__MINGW32__) || defined(__MINGW64__)
|
||||
|
||||
#endif // mozglue_misc_MozProcessMitigationDynamicCodePolicy_h__
|
||||
|
|
@ -11,10 +11,7 @@
|
|||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/DynamicallyLinkedFunctionPtr.h"
|
||||
|
||||
// See bug 1766432 comment 4. In the future, we should keep this static assert
|
||||
// when we remove MOZ_PROCESS_MITIGATION_DYNAMIC_CODE_POLICY.
|
||||
#include "mozilla/MozProcessMitigationDynamicCodePolicy.h"
|
||||
static_assert(sizeof(MOZ_PROCESS_MITIGATION_DYNAMIC_CODE_POLICY) == 4);
|
||||
static_assert(sizeof(PROCESS_MITIGATION_DYNAMIC_CODE_POLICY) == 4);
|
||||
|
||||
#if (_WIN32_WINNT < 0x0602)
|
||||
BOOL WINAPI GetProcessMitigationPolicy(
|
||||
|
|
@ -65,7 +62,7 @@ MFBT_API bool IsDynamicCodeDisabled() {
|
|||
return false;
|
||||
}
|
||||
|
||||
MOZ_PROCESS_MITIGATION_DYNAMIC_CODE_POLICY polInfo;
|
||||
PROCESS_MITIGATION_DYNAMIC_CODE_POLICY polInfo;
|
||||
if (!pGetProcessMitigationPolicy(::GetCurrentProcess(),
|
||||
ProcessDynamicCodePolicy, &polInfo,
|
||||
sizeof(polInfo))) {
|
||||
|
|
|
|||
|
|
@ -75,7 +75,6 @@ if CONFIG["OS_ARCH"] == "WINNT":
|
|||
EXPORTS.mozilla += [
|
||||
"DynamicallyLinkedFunctionPtr.h",
|
||||
"ImportDir.h",
|
||||
"MozProcessMitigationDynamicCodePolicy.h",
|
||||
"NativeNt.h",
|
||||
"WindowsDpiInitialization.h",
|
||||
"WindowsEnumProcessModules.h",
|
||||
|
|
|
|||
|
|
@ -1,40 +0,0 @@
|
|||
# HG changeset patch
|
||||
# User Yannis Juglaret <yjuglaret@mozilla.com>
|
||||
# Date 1663959861 -7200
|
||||
# Fri Sep 23 21:04:21 2022 +0200
|
||||
# Node ID 3678927a7e8652895bc739d4095a6fccca9d9096
|
||||
# Parent dac6a19a0031a64efacc9d0dd6e2f2416b2bf2d8
|
||||
Bug 1766432 - Part 2: Propagate custom definition for PROCESS_MITIGATION_DYNAMIC_CODE_POLICY to third-party. r=bobowen
|
||||
|
||||
Differential Revision: https://phabricator.services.mozilla.com/D157904
|
||||
|
||||
diff --git a/security/sandbox/chromium/sandbox/win/src/process_mitigations.cc b/security/sandbox/chromium/sandbox/win/src/process_mitigations.cc
|
||||
--- a/security/sandbox/chromium/sandbox/win/src/process_mitigations.cc
|
||||
+++ b/security/sandbox/chromium/sandbox/win/src/process_mitigations.cc
|
||||
@@ -17,6 +17,8 @@
|
||||
#include "sandbox/win/src/sandbox_rand.h"
|
||||
#include "sandbox/win/src/win_utils.h"
|
||||
|
||||
+#include "mozilla/MozProcessMitigationDynamicCodePolicy.h"
|
||||
+
|
||||
namespace {
|
||||
|
||||
// API defined in libloaderapi.h >= Win8.
|
||||
@@ -231,7 +233,7 @@ bool ApplyProcessMitigationsToCurrentPro
|
||||
// Verify caller is not accidentally setting both mutually exclusive
|
||||
// policies.
|
||||
DCHECK(!(flags & MITIGATION_DYNAMIC_CODE_DISABLE_WITH_OPT_OUT));
|
||||
- PROCESS_MITIGATION_DYNAMIC_CODE_POLICY policy = {};
|
||||
+ MOZ_PROCESS_MITIGATION_DYNAMIC_CODE_POLICY policy = {};
|
||||
policy.ProhibitDynamicCode = true;
|
||||
|
||||
if (!set_process_mitigation_policy(ProcessDynamicCodePolicy, &policy,
|
||||
@@ -307,7 +309,7 @@ bool ApplyProcessMitigationsToCurrentPro
|
||||
// Verify caller is not accidentally setting both mutually exclusive
|
||||
// policies.
|
||||
DCHECK(!(flags & MITIGATION_DYNAMIC_CODE_DISABLE));
|
||||
- PROCESS_MITIGATION_DYNAMIC_CODE_POLICY policy = {};
|
||||
+ MOZ_PROCESS_MITIGATION_DYNAMIC_CODE_POLICY policy = {};
|
||||
policy.ProhibitDynamicCode = true;
|
||||
policy.AllowThreadOptOut = true;
|
||||
|
||||
|
|
@ -29,5 +29,4 @@ lower_SDK_version_requirement.patch
|
|||
add_CET_STRICT_MODE.patch
|
||||
broker_complex_line_breaks.patch
|
||||
allow_reparse_points.patch
|
||||
mingw_fix_PROCESS_MITIGATION_DYNAMIC_CODE_POLICY.patch
|
||||
derive_sid_from_name.patch
|
||||
|
|
|
|||
|
|
@ -17,8 +17,6 @@
|
|||
#include "sandbox/win/src/sandbox_rand.h"
|
||||
#include "sandbox/win/src/win_utils.h"
|
||||
|
||||
#include "mozilla/MozProcessMitigationDynamicCodePolicy.h"
|
||||
|
||||
namespace {
|
||||
|
||||
// API defined in libloaderapi.h >= Win8.
|
||||
|
|
@ -233,7 +231,7 @@ bool ApplyProcessMitigationsToCurrentProcess(MitigationFlags flags) {
|
|||
// Verify caller is not accidentally setting both mutually exclusive
|
||||
// policies.
|
||||
DCHECK(!(flags & MITIGATION_DYNAMIC_CODE_DISABLE_WITH_OPT_OUT));
|
||||
MOZ_PROCESS_MITIGATION_DYNAMIC_CODE_POLICY policy = {};
|
||||
PROCESS_MITIGATION_DYNAMIC_CODE_POLICY policy = {};
|
||||
policy.ProhibitDynamicCode = true;
|
||||
|
||||
if (!set_process_mitigation_policy(ProcessDynamicCodePolicy, &policy,
|
||||
|
|
@ -309,7 +307,7 @@ bool ApplyProcessMitigationsToCurrentProcess(MitigationFlags flags) {
|
|||
// Verify caller is not accidentally setting both mutually exclusive
|
||||
// policies.
|
||||
DCHECK(!(flags & MITIGATION_DYNAMIC_CODE_DISABLE));
|
||||
MOZ_PROCESS_MITIGATION_DYNAMIC_CODE_POLICY policy = {};
|
||||
PROCESS_MITIGATION_DYNAMIC_CODE_POLICY policy = {};
|
||||
policy.ProhibitDynamicCode = true;
|
||||
policy.AllowThreadOptOut = true;
|
||||
|
||||
|
|
|
|||
|
|
@ -24,8 +24,6 @@
|
|||
#include "nsWindowsDllInterceptor.h"
|
||||
#include "nsWindowsHelpers.h"
|
||||
|
||||
#include "mozilla/MozProcessMitigationDynamicCodePolicy.h"
|
||||
|
||||
NTSTATUS NTAPI NtFlushBuffersFile(HANDLE, PIO_STATUS_BLOCK);
|
||||
NTSTATUS NTAPI NtReadFile(HANDLE, HANDLE, PIO_APC_ROUTINE, PVOID,
|
||||
PIO_STATUS_BLOCK, PVOID, ULONG, PLARGE_INTEGER,
|
||||
|
|
@ -1182,7 +1180,7 @@ bool TestDynamicCodePolicy() {
|
|||
return true;
|
||||
}
|
||||
|
||||
MOZ_PROCESS_MITIGATION_DYNAMIC_CODE_POLICY policy = {};
|
||||
PROCESS_MITIGATION_DYNAMIC_CODE_POLICY policy = {};
|
||||
policy.ProhibitDynamicCode = true;
|
||||
|
||||
mozilla::DynamicallyLinkedFunctionPtr<decltype(&SetProcessMitigationPolicy)>
|
||||
|
|
|
|||
Loading…
Reference in a new issue