Bug 1496179 - Make mozglue.dll a private SxS assembly. r=aklotz,froydnj
authorMasatoshi Kimura <VYV03354@nifty.ne.jp>
Wed, 10 Oct 2018 22:57:53 +0900
changeset 441884 3eb04f5363eb661fa2ae544a934a7ace85b65282
parent 441883 d717af5612184b5661488184c5a41425a7d186f8
child 441885 8f709fd4aa463ecfc38deda95ac9cc68b5095356
child 441902 5b56f7a89ad4657ebc9dcc0ec444dacec3c0a69c
push id34877
push userebalazs@mozilla.com
push dateThu, 18 Oct 2018 10:21:15 +0000
treeherdermozilla-central@8f709fd4aa46 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaklotz, froydnj
bugs1496179
milestone64.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
config/version_win.pl
ipc/app/plugin-container.exe.manifest
js/xpconnect/shell/xpcshell.exe.manifest
mozglue/build/Makefile.in
mozglue/build/moz.build
mozglue/build/mozglue.dll.manifest
mozglue/build/mozglue.rc
toolkit/components/telemetry/pingsender/pingsender.exe.manifest
toolkit/crashreporter/minidump-analyzer/minidump-analyzer.exe.manifest
--- a/browser/app/firefox.exe.manifest
+++ b/browser/app/firefox.exe.manifest
@@ -14,16 +14,26 @@
                         name="Microsoft.Windows.Common-Controls"
                         version="6.0.0.0"
                         processorArchitecture="*"
                         publicKeyToken="6595b64144ccf1df"
                         language="*"
                 />
         </dependentAssembly>
 </dependency>
+<dependency>
+        <dependentAssembly>
+                <assemblyIdentity
+                        type="win32"
+                        name="mozglue"
+                        version="1.0.0.0"
+                        language="*"
+                />
+        </dependentAssembly>
+</dependency>
 <ms_asmv3:trustInfo xmlns:ms_asmv3="urn:schemas-microsoft-com:asm.v3">
   <ms_asmv3:security>
     <ms_asmv3:requestedPrivileges>
       <ms_asmv3:requestedExecutionLevel level="asInvoker" uiAccess="false" />
     </ms_asmv3:requestedPrivileges>
   </ms_asmv3:security>
 </ms_asmv3:trustInfo>
   <ms_asmv3:application xmlns:ms_asmv3="urn:schemas-microsoft-com:asm.v3">
--- a/config/version_win.pl
+++ b/config/version_win.pl
@@ -269,22 +269,24 @@ print RCFILE qq{
 // Use module.ver to explicitly set these values
 
 // Do not edit this file. Changes won't affect the build.
 
 };
 
 my $versionlevel=0;
 my $insideversion=0;
+my $has_manifest=0;
 if (open(RCINCLUDE, "<$rcinclude")) 
 {
 	print RCFILE "// From included resource $rcinclude\n";
 #	my $mstring="";
 	while (<RCINCLUDE>) 
 	{
+		$has_manifest = 1 if /^1 (24|RT_MANIFEST) "$binary.manifest"/;
 		$_ =~ s/\@MOZ_APP_DISPLAYNAME\@/$displayname/g;
 		print RCFILE $_;
 #		my $instr=$_;
 #		chomp($instr);
 #		$mstring .= "$instr\;";
 	}
 	close(RCINCLUDE);
 #	$mstring =~ s/\/\*.*\*\///g;
@@ -326,16 +328,20 @@ 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{
 
 
 /////////////////////////////////////////////////////////////////////////////
 //
 // Version
 //
 
 1 VERSIONINFO
--- a/ipc/app/plugin-container.exe.manifest
+++ b/ipc/app/plugin-container.exe.manifest
@@ -14,16 +14,26 @@
                         name="Microsoft.Windows.Common-Controls"
                         version="6.0.0.0"
                         processorArchitecture="*"
                         publicKeyToken="6595b64144ccf1df"
                         language="*"
                 />
         </dependentAssembly>
 </dependency>
+<dependency>
+        <dependentAssembly>
+                <assemblyIdentity
+                        type="win32"
+                        name="mozglue"
+                        version="1.0.0.0"
+                        language="*"
+                />
+        </dependentAssembly>
+</dependency>
   <ms_asmv3:trustInfo xmlns:ms_asmv3="urn:schemas-microsoft-com:asm.v3">
     <ms_asmv3:security>
       <ms_asmv3:requestedPrivileges>
         <ms_asmv3:requestedExecutionLevel level="asInvoker" uiAccess="false" />
       </ms_asmv3:requestedPrivileges>
     </ms_asmv3:security>
   </ms_asmv3:trustInfo>
   <ms_asmv3:application xmlns:ms_asmv3="urn:schemas-microsoft-com:asm.v3">
--- a/js/xpconnect/shell/xpcshell.exe.manifest
+++ b/js/xpconnect/shell/xpcshell.exe.manifest
@@ -7,16 +7,26 @@
 <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
 <assemblyIdentity
         version="1.0.0.0"
         processorArchitecture="*"
         name="Mozilla.xpcshell"
         type="win32"
 />
 <description>XPConnect Shell</description>
+<dependency>
+        <dependentAssembly>
+                <assemblyIdentity
+                        type="win32"
+                        name="mozglue"
+                        version="1.0.0.0"
+                        language="*"
+                />
+        </dependentAssembly>
+</dependency>
 <ms_asmv3:trustInfo xmlns:ms_asmv3="urn:schemas-microsoft-com:asm.v3">
   <ms_asmv3:security>
     <ms_asmv3:requestedPrivileges>
       <ms_asmv3:requestedExecutionLevel level="asInvoker" uiAccess="false" />
     </ms_asmv3:requestedPrivileges>
   </ms_asmv3:security>
 </ms_asmv3:trustInfo>
   <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
--- a/mozglue/build/Makefile.in
+++ b/mozglue/build/Makefile.in
@@ -6,11 +6,17 @@
 # For FORCE_SHARED_LIB
 include $(topsrcdir)/config/config.mk
 
 ifeq (WINNT,$(OS_TARGET))
 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
--- a/mozglue/build/moz.build
+++ b/mozglue/build/moz.build
@@ -30,16 +30,17 @@ if CONFIG['MOZ_UBSAN']:
     ]
 
 if CONFIG['OS_TARGET'] == 'WINNT':
     DEFFILE = '!mozglue.def'
     # We'll break the DLL blocklist if we immediately load user32.dll
     DELAYLOAD_DLLS += [
         'user32.dll',
     ]
+    RCINCLUDE = 'mozglue.rc'
 
     if CONFIG['MOZ_PGO'] and CONFIG['CC_TYPE'] == 'clang-cl':
         SOURCES += ['cygprofile.cpp']
         SOURCES['cygprofile.cpp'].pgo_generate_only = True
 
     if CONFIG['CC_TYPE'] == "msvc":
         CFLAGS += ['-guard:cf']
         CXXFLAGS += ['-guard:cf']
new file mode 100644
--- /dev/null
+++ b/mozglue/build/mozglue.dll.manifest
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+<assemblyIdentity
+    version="1.0.0.0"
+    name="mozglue"
+    type="win32"
+/>
+<file name="mozglue.dll"/>
+</assembly>
new file mode 100644
--- /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"
new file mode 100644
--- /dev/null
+++ b/toolkit/components/telemetry/pingsender/pingsender.exe.manifest
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+<assemblyIdentity
+        version="1.0.0.0"
+        processorArchitecture="*"
+        name="pingsender"
+        type="win32"
+/>
+<dependency>
+        <dependentAssembly>
+                <assemblyIdentity
+                        type="win32"
+                        name="mozglue"
+                        version="1.0.0.0"
+                        language="*"
+                />
+        </dependentAssembly>
+</dependency>
+</assembly>
new file mode 100644
--- /dev/null
+++ b/toolkit/crashreporter/minidump-analyzer/minidump-analyzer.exe.manifest
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+<assemblyIdentity
+        version="1.0.0.0"
+        processorArchitecture="*"
+        name="minidump-analyzer"
+        type="win32"
+/>
+<dependency>
+        <dependentAssembly>
+                <assemblyIdentity
+                        type="win32"
+                        name="mozglue"
+                        version="1.0.0.0"
+                        language="*"
+                />
+        </dependentAssembly>
+</dependency>
+</assembly>