From f38cdcfbf11a64b7b48038accb5d63551c28242e Mon Sep 17 00:00:00 2001 From: Masatoshi Kimura Date: Wed, 10 Oct 2018 22:57:53 +0900 Subject: [PATCH] Bug 1496179 - Make mozglue.dll a private SxS assembly. r=aklotz,froydnj SxS assemblies do not obey the usual DLL search order. It will make it possible to load mozglue.dll from appdir even if the PreferSystem32Images mitigation is enabled and System32 has a random mozglue.dll. --- browser/app/firefox.exe.manifest | 10 ++++++++++ config/version_win.pl | 6 ++++++ ipc/app/plugin-container.exe.manifest | 10 ++++++++++ js/xpconnect/shell/xpcshell.exe.manifest | 10 ++++++++++ mozglue/build/Makefile.in | 6 ++++++ mozglue/build/moz.build | 1 + mozglue/build/mozglue.dll.manifest | 9 +++++++++ mozglue/build/mozglue.rc | 6 ++++++ .../pingsender/pingsender.exe.manifest | 19 +++++++++++++++++++ .../minidump-analyzer.exe.manifest | 19 +++++++++++++++++++ 10 files changed, 96 insertions(+) create mode 100644 mozglue/build/mozglue.dll.manifest create mode 100644 mozglue/build/mozglue.rc create mode 100644 toolkit/components/telemetry/pingsender/pingsender.exe.manifest create mode 100644 toolkit/crashreporter/minidump-analyzer/minidump-analyzer.exe.manifest diff --git a/browser/app/firefox.exe.manifest b/browser/app/firefox.exe.manifest index f27e149e3b43..1e1d6f651d27 100644 --- a/browser/app/firefox.exe.manifest +++ b/browser/app/firefox.exe.manifest @@ -19,6 +19,16 @@ /> + + + + + diff --git a/config/version_win.pl b/config/version_win.pl index 47c7dfe30e4a..a2ac99b8f1a2 100755 --- a/config/version_win.pl +++ b/config/version_win.pl @@ -274,12 +274,14 @@ print RCFILE qq{ my $versionlevel=0; my $insideversion=0; +my $has_manifest=0; if (open(RCINCLUDE, "<$rcinclude")) { print RCFILE "// From included resource $rcinclude\n"; # my $mstring=""; while () { + $has_manifest = 1 if /^1 (24|RT_MANIFEST) "$binary.manifest"/; $_ =~ s/\@MOZ_APP_DISPLAYNAME\@/$displayname/g; print RCFILE $_; # my $instr=$_; @@ -330,6 +332,10 @@ if (open(RCINCLUDE, "<$rcinclude")) my $fileflags = join(' | ', @fileflags); +print RCFILE qq{ +1 RT_MANIFEST "$binary.manifest" +} if !$has_manifest && $binary =~ /\.exe$/ && -e "$objdir/$binary.manifest"; + print RCFILE qq{ diff --git a/ipc/app/plugin-container.exe.manifest b/ipc/app/plugin-container.exe.manifest index e3bdc56b0818..3ccedc20c267 100644 --- a/ipc/app/plugin-container.exe.manifest +++ b/ipc/app/plugin-container.exe.manifest @@ -18,6 +18,16 @@ language="*" /> + + + + + diff --git a/js/xpconnect/shell/xpcshell.exe.manifest b/js/xpconnect/shell/xpcshell.exe.manifest index c35b77af4360..1c671f14ef98 100644 --- a/js/xpconnect/shell/xpcshell.exe.manifest +++ b/js/xpconnect/shell/xpcshell.exe.manifest @@ -12,6 +12,16 @@ type="win32" /> XPConnect Shell + + + + + diff --git a/mozglue/build/Makefile.in b/mozglue/build/Makefile.in index 0a86b3c15d73..35d101d5fe2d 100644 --- a/mozglue/build/Makefile.in +++ b/mozglue/build/Makefile.in @@ -11,6 +11,12 @@ mozglue.def: mozglue.def.in $(GLOBAL_DEPS) $(call py_action,preprocessor,$(if $(MOZ_REPLACE_MALLOC),-DMOZ_REPLACE_MALLOC) $(ACDEFINES) $< -o $@) GARBAGE += mozglue.def + +# Rebuild mozglue.dll if the manifest changes - it's included by mozglue.rc. +# (this dependency should really be just for mozglue.dll, not other targets) +# Note the manifest file exists in the tree, so we use the explicit filename +# here. +EXTRA_DEPS += mozglue.dll.manifest endif include $(topsrcdir)/mozglue/build/replace_malloc.mk diff --git a/mozglue/build/moz.build b/mozglue/build/moz.build index dacfa1a2e226..bf086fb154f7 100644 --- a/mozglue/build/moz.build +++ b/mozglue/build/moz.build @@ -35,6 +35,7 @@ if CONFIG['OS_TARGET'] == 'WINNT': DELAYLOAD_DLLS += [ 'user32.dll', ] + RCINCLUDE = 'mozglue.rc' if CONFIG['MOZ_PGO'] and CONFIG['CC_TYPE'] == 'clang-cl': SOURCES += ['cygprofile.cpp'] diff --git a/mozglue/build/mozglue.dll.manifest b/mozglue/build/mozglue.dll.manifest new file mode 100644 index 000000000000..037eae4f77fe --- /dev/null +++ b/mozglue/build/mozglue.dll.manifest @@ -0,0 +1,9 @@ + + + + + diff --git a/mozglue/build/mozglue.rc b/mozglue/build/mozglue.rc new file mode 100644 index 000000000000..a678fa3b3d4f --- /dev/null +++ b/mozglue/build/mozglue.rc @@ -0,0 +1,6 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* 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/. */ + +1 RT_MANIFEST "mozglue.dll.manifest" diff --git a/toolkit/components/telemetry/pingsender/pingsender.exe.manifest b/toolkit/components/telemetry/pingsender/pingsender.exe.manifest new file mode 100644 index 000000000000..8e4bb8749bce --- /dev/null +++ b/toolkit/components/telemetry/pingsender/pingsender.exe.manifest @@ -0,0 +1,19 @@ + + + + + + + + + diff --git a/toolkit/crashreporter/minidump-analyzer/minidump-analyzer.exe.manifest b/toolkit/crashreporter/minidump-analyzer/minidump-analyzer.exe.manifest new file mode 100644 index 000000000000..731502e805d3 --- /dev/null +++ b/toolkit/crashreporter/minidump-analyzer/minidump-analyzer.exe.manifest @@ -0,0 +1,19 @@ + + + + + + + + +