Backed out changeset 9f34b95fa1d0 (bug 1240977) and changeset a786af9186eb (bug 1240848) for suspicion of causing the topcrashes in bug 1241921. a=topcrash
authorRyan VanderMeulen <ryanvm@gmail.com>
Fri, 22 Jan 2016 18:27:10 -0500
changeset 281200 5f7c184ccd800b2ed512c23fb609007efd198eaf
parent 281199 7104d650a97d895cbbc64d53462bf86a04658abe
child 281201 1d759b1bdf8adc61032353a977b2649a3cba50e2
push id29931
push userryanvm@gmail.com
push dateFri, 22 Jan 2016 23:27:37 +0000
treeherdermozilla-central@5f7c184ccd80 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstopcrash
bugs1240977, 1240848, 1241921
milestone46.0a1
backs out9f34b95fa1d029c7eae575190efed6e2536547ad
first release with
nightly linux32
5f7c184ccd80 / 46.0a1 / 20160123030348 / files
nightly linux64
5f7c184ccd80 / 46.0a1 / 20160123030348 / files
nightly mac
5f7c184ccd80 / 46.0a1 / 20160123030348 / files
nightly win32
5f7c184ccd80 / 46.0a1 / 20160123030348 / files
nightly win64
5f7c184ccd80 / 46.0a1 / 20160123030348 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset 9f34b95fa1d0 (bug 1240977) and changeset a786af9186eb (bug 1240848) for suspicion of causing the topcrashes in bug 1241921. a=topcrash
toolkit/xre/test/win/TestDllInterceptor.cpp
xpcom/build/nsWindowsDllInterceptor.h
--- a/toolkit/xre/test/win/TestDllInterceptor.cpp
+++ b/toolkit/xre/test/win/TestDllInterceptor.cpp
@@ -157,18 +157,15 @@ int main()
       TestHook("kernel32.dll", "VirtualAlloc") &&
       TestHook("kernel32.dll", "MapViewOfFile") &&
       TestHook("gdi32.dll", "CreateDIBSection") &&
       TestHook("kernel32.dll", "CreateFileW") &&
 #endif
       TestHook("imm32.dll", "ImmGetContext") &&
       TestHook("imm32.dll", "ImmGetCompositionStringW") &&
       TestHook("imm32.dll", "ImmSetCandidateWindow") &&
-#ifdef _M_X64
-      TestHook("user32.dll", "CreateWindowExW") &&
-#endif
       TestDetour("ntdll.dll", "LdrLoadDll")) {
     printf("TEST-PASS | WindowsDllInterceptor | all checks passed\n");
     return 0;
   }
 
   return 1;
 }
--- a/xpcom/build/nsWindowsDllInterceptor.h
+++ b/xpcom/build/nsWindowsDllInterceptor.h
@@ -463,79 +463,16 @@ protected:
   const static int kPageSize = 4096;
   const static int kHookSize = 128;
 
   HMODULE mModule;
   byteptr_t mHookPage;
   int mMaxHooks;
   int mCurHooks;
 
-  // rex bits
-  static const BYTE kMaskHighNibble = 0xF0;
-  static const BYTE kRexOpcode = 0x40;
-  static const BYTE kMaskRexW = 0x08;
-  static const BYTE kMaskRexR = 0x04;
-  static const BYTE kMaskRexX = 0x02;
-  static const BYTE kMaskRexB = 0x01;
-
-  // mod r/m bits
-  static const BYTE kRegFieldShift = 3;
-  static const BYTE kMaskMod = 0xC0;
-  static const BYTE kMaskReg = 0x38;
-  static const BYTE kMaskRm = 0x07;
-  static const BYTE kRmNeedSib = 0x04;
-  static const BYTE kModReg = 0xC0;
-  static const BYTE kModDisp32 = 0x80;
-  static const BYTE kModDisp8 = 0x40;
-  static const BYTE kModNoRegDisp = 0x00;
-  static const BYTE kRmNoRegDispDisp32 = 0x05;
-
-  // sib bits
-  static const BYTE kMaskSibScale = 0xC0;
-  static const BYTE kMaskSibIndex = 0x38;
-  static const BYTE kMaskSibBase = 0x07;
-  static const BYTE kSibBaseEbp = 0x05;
-
-  int CountModRmSib(const BYTE *aModRm, BYTE* aSubOpcode)
-  {
-    if (!aModRm) {
-      return -1;
-    }
-    int numBytes = 1; // Start with 1 for mod r/m byte itself
-    switch (*aModRm & kMaskMod) {
-      case kModReg:
-        return numBytes;
-      case kModDisp8:
-        numBytes += 1;
-        break;
-      case kModDisp32:
-        numBytes += 4;
-        break;
-      case kModNoRegDisp:
-        if ((*aModRm & kMaskRm) == kRmNoRegDispDisp32 ||
-            ((*aModRm & kMaskRm) == kRmNeedSib &&
-             (*(aModRm + 1) & kMaskSibBase) == kSibBaseEbp)) {
-          numBytes += 4;
-        }
-        break;
-      default:
-        // This should not be reachable
-        MOZ_ASSERT_UNREACHABLE("Impossible value for modr/m byte mod bits");
-        return -1;
-    }
-    if ((*aModRm & kMaskRm) == kRmNeedSib) {
-      // SIB byte
-      numBytes += 1;
-    }
-    if (aSubOpcode) {
-      *aSubOpcode = (*aModRm & kMaskReg) >> kRegFieldShift;
-    }
-    return numBytes;
-  }
-
 #if defined(_M_X64)
   // To patch for JMP and JE
 
   enum JumpType {
    Je,
    Jmp
   };
 
@@ -796,64 +733,25 @@ protected:
           } else {
             // not support yet!
             return;
           }
         } else {
           // not support yet!
           return;
         }
-      } else if (origBytes[nBytes] == 0x66) {
-        // operand override prefix
-        nBytes += 1;
-        // This is the same as the x86 version
-        if (origBytes[nBytes] >= 0x88 && origBytes[nBytes] <= 0x8B) {
-          // various MOVs
-          unsigned char b = origBytes[nBytes + 1];
-          if (((b & 0xc0) == 0xc0) ||
-              (((b & 0xc0) == 0x00) &&
-               ((b & 0x07) != 0x04) && ((b & 0x07) != 0x05))) {
-            // REG=r, R/M=r or REG=r, R/M=[r]
-            nBytes += 2;
-          } else if ((b & 0xc0) == 0x40) {
-            if ((b & 0x07) == 0x04) {
-              // REG=r, R/M=[SIB + disp8]
-              nBytes += 4;
-            } else {
-              // REG=r, R/M=[r + disp8]
-              nBytes += 3;
-            }
-          } else {
-            // complex MOV, bail
-            return;
-          }
-        }
       } else if ((origBytes[nBytes] & 0xf0) == 0x50) {
         // 1-byte push/pop
         nBytes++;
       } else if (origBytes[nBytes] == 0x90) {
         // nop
         nBytes++;
       } else if (origBytes[nBytes] == 0xb8) {
         // MOV 0xB8: http://ref.x86asm.net/coder32.html#xB8
         nBytes += 5;
-      } else if (origBytes[nBytes] == 0x33) {
-        // xor r32, r/m32
-        nBytes += 2;
-      } else if (origBytes[nBytes] == 0xf6) {
-        // test r/m8, imm8 (used by ntdll on Windows 10 x64)
-        // (no flags are affected by near jmp since there is no task switch,
-        // so it is ok for a jmp to be written immediately after a test)
-        BYTE subOpcode = 0;
-        int nModRmSibBytes = CountModRmSib(&origBytes[nBytes + 1], &subOpcode);
-        if (nModRmSibBytes < 0 || subOpcode != 0) {
-          // Unsupported
-          return;
-        }
-        nBytes += 2 + nModRmSibBytes;
       } else if (origBytes[nBytes] == 0xc3) {
         // ret
         nBytes++;
       } else if (origBytes[nBytes] == 0xcc) {
         // int 3
         nBytes++;
       } else if (origBytes[nBytes] == 0xe9) {
         // jmp 32bit offset