Merge mozilla-central to autoland

This commit is contained in:
Dorel Luca 2018-07-07 13:35:38 +03:00
Родитель 04dcfe28d9 979ce8a6f7
Коммит b20436cfaa
7 изменённых файлов: 126 добавлений и 57 удалений

Просмотреть файл

@ -357,21 +357,13 @@ InitializeDllBlocklistOOP(HANDLE aChildProcess)
{
mozilla::CrossProcessDllInterceptor intcpt(aChildProcess);
intcpt.Init(L"ntdll.dll");
bool ok = stub_NtMapViewOfSection.SetDetour(intcpt, "NtMapViewOfSection",
bool ok = stub_NtMapViewOfSection.SetDetour(aChildProcess, intcpt,
"NtMapViewOfSection",
&patched_NtMapViewOfSection);
if (!ok) {
return false;
}
// Set the child process's copy of stub_NtMapViewOfSection
SIZE_T bytesWritten;
ok = !!::WriteProcessMemory(aChildProcess, &stub_NtMapViewOfSection,
&stub_NtMapViewOfSection,
sizeof(stub_NtMapViewOfSection), &bytesWritten);
if (!ok) {
return false;
}
// Because aChildProcess has just been created in a suspended state, its
// dynamic linker has not yet been initialized, thus its executable has
// not yet been linked with ntdll.dll. If the blocklist hook intercepts a
@ -407,6 +399,8 @@ InitializeDllBlocklistOOP(HANDLE aChildProcess)
ptrdiff_t iatLength = (curIatThunk - firstIatThunk) * sizeof(IMAGE_THUNK_DATA);
SIZE_T bytesWritten;
{ // Scope for prot
AutoVirtualProtect prot(firstIatThunk, iatLength, PAGE_READWRITE,
aChildProcess);

Просмотреть файл

@ -65,7 +65,7 @@ skip-if = verify
[browser_favicon_firstParty.js]
[browser_favicon_userContextId.js]
[browser_firstPartyIsolation.js]
skip-if = verify
skip-if = verify || debug #Bug 1345346
[browser_firstPartyIsolation_about_newtab.js]
[browser_firstPartyIsolation_aboutPages.js]
[browser_firstPartyIsolation_blobURI.js]

Просмотреть файл

@ -313,7 +313,7 @@ uses-unsafe-cpows = true
skip-if = e10s && debug
[browser_dbg_search-symbols.js]
uses-unsafe-cpows = true
skip-if = (e10s && debug) || os == "linux" # Bug 1132375
skip-if = (e10s && debug) || os == "linux" || (os == "win" && !debug) # Bug 1132375 # Bug 1465683
[browser_dbg_searchbox-help-popup-01.js]
uses-unsafe-cpows = true
skip-if = e10s && debug

Просмотреть файл

@ -1155,8 +1155,8 @@ WebRenderBridgeParent::RecvClearCachedResources()
// Schedule generate frame to clean up Pipeline
ScheduleGenerateFrame();
// Remove animations.
for (std::unordered_set<uint64_t>::iterator iter = mActiveAnimations.begin(); iter != mActiveAnimations.end(); iter++) {
mAnimStorage->ClearById(*iter);
for (const auto& id : mActiveAnimations) {
mAnimStorage->ClearById(id);
}
mActiveAnimations.clear();
std::queue<CompositorAnimationIdsForEpoch>().swap(mCompositorAnimationsToDelete); // clear queue
@ -1680,8 +1680,8 @@ WebRenderBridgeParent::ClearResources()
mApi->SendTransaction(txn);
for (std::unordered_set<uint64_t>::iterator iter = mActiveAnimations.begin(); iter != mActiveAnimations.end(); iter++) {
mAnimStorage->ClearById(*iter);
for (const auto& id : mActiveAnimations) {
mAnimStorage->ClearById(id);
}
mActiveAnimations.clear();
std::queue<CompositorAnimationIdsForEpoch>().swap(mCompositorAnimationsToDelete); // clear queue

Просмотреть файл

@ -84,32 +84,32 @@
namespace mozilla {
namespace interceptor {
template <typename T>
struct OriginalFunctionPtrTraits;
template <typename R, typename... Args>
struct OriginalFunctionPtrTraits<R (*)(Args...)>
{
using ReturnType = R;
};
#if defined(_M_IX86)
template <typename R, typename... Args>
struct OriginalFunctionPtrTraits<R (__stdcall*)(Args...)>
{
using ReturnType = R;
};
template <typename R, typename... Args>
struct OriginalFunctionPtrTraits<R (__fastcall*)(Args...)>
{
using ReturnType = R;
};
#endif // defined(_M_IX86)
template <typename InterceptorT, typename FuncPtrT>
class FuncHook final
{
template <typename T>
struct OriginalFunctionPtrTraits;
template <typename R, typename... Args>
struct OriginalFunctionPtrTraits<R (*)(Args...)>
{
using ReturnType = R;
};
#if defined(_M_IX86)
template <typename R, typename... Args>
struct OriginalFunctionPtrTraits<R (__stdcall*)(Args...)>
{
using ReturnType = R;
};
template <typename R, typename... Args>
struct OriginalFunctionPtrTraits<R (__fastcall*)(Args...)>
{
using ReturnType = R;
};
#endif // defined(_M_IX86)
public:
using ThisType = FuncHook<InterceptorT, FuncPtrT>;
using ReturnType = typename OriginalFunctionPtrTraits<FuncPtrT>::ReturnType;
@ -221,15 +221,99 @@ private:
INIT_ONCE mInitOnce;
};
template <typename InterceptorT, typename FuncPtrT>
class MOZ_ONLY_USED_TO_AVOID_STATIC_CONSTRUCTORS FuncHookCrossProcess final
{
public:
using ThisType = FuncHookCrossProcess<InterceptorT, FuncPtrT>;
using ReturnType = typename OriginalFunctionPtrTraits<FuncPtrT>::ReturnType;
#if defined(DEBUG)
FuncHookCrossProcess() {}
#endif // defined(DEBUG)
bool Set(HANDLE aProcess, InterceptorT& aInterceptor, const char* aName,
FuncPtrT aHookDest)
{
if (!aInterceptor.AddHook(aName, reinterpret_cast<intptr_t>(aHookDest),
reinterpret_cast<void**>(&mOrigFunc))) {
return false;
}
return CopyStubToChildProcess(aProcess);
}
bool SetDetour(HANDLE aProcess, InterceptorT& aInterceptor, const char* aName,
FuncPtrT aHookDest)
{
if (!aInterceptor.AddDetour(aName, reinterpret_cast<intptr_t>(aHookDest),
reinterpret_cast<void**>(&mOrigFunc))) {
return false;
}
return CopyStubToChildProcess(aProcess);
}
explicit operator bool() const
{
return !!mOrigFunc;
}
/**
* NB: This operator is only meaningful when invoked in the target process!
*/
template <typename... ArgsType>
ReturnType operator()(ArgsType... aArgs) const
{
return mOrigFunc(std::forward<ArgsType>(aArgs)...);
}
#if defined(DEBUG)
FuncHookCrossProcess(const FuncHookCrossProcess&) = delete;
FuncHookCrossProcess(FuncHookCrossProcess&&) = delete;
FuncHookCrossProcess& operator=(const FuncHookCrossProcess&) = delete;
FuncHookCrossProcess& operator=(FuncHookCrossProcess&& aOther) = delete;
#endif // defined(DEBUG)
private:
bool CopyStubToChildProcess(HANDLE aProcess)
{
SIZE_T bytesWritten;
return !!::WriteProcessMemory(aProcess, &mOrigFunc, &mOrigFunc,
sizeof(mOrigFunc), &bytesWritten);
}
private:
FuncPtrT mOrigFunc;
};
enum
{
kDefaultTrampolineSize = 128
};
template <typename MMPolicyT, typename InterceptorT>
struct TypeResolver;
template <typename InterceptorT>
struct TypeResolver<mozilla::interceptor::MMPolicyInProcess, InterceptorT>
{
template <typename FuncPtrT>
using FuncHookType = FuncHook<InterceptorT, FuncPtrT>;
};
template <typename InterceptorT>
struct TypeResolver<mozilla::interceptor::MMPolicyOutOfProcess, InterceptorT>
{
template <typename FuncPtrT>
using FuncHookType = FuncHookCrossProcess<InterceptorT, FuncPtrT>;
};
template <typename VMPolicy =
mozilla::interceptor::VMSharingPolicyShared<
mozilla::interceptor::MMPolicyInProcess, kDefaultTrampolineSize>>
class WindowsDllInterceptor final
class WindowsDllInterceptor final : public TypeResolver<typename VMPolicy::MMPolicyT,
WindowsDllInterceptor<VMPolicy>>
{
typedef WindowsDllInterceptor<VMPolicy> ThisType;
@ -372,13 +456,12 @@ private:
return mDetourPatcher.AddHook(aProc, aHookDest, aOrigFunc);
}
public:
template <typename FuncPtrT>
using FuncHookType = FuncHook<ThisType, FuncPtrT>;
private:
template <typename InterceptorT, typename FuncPtrT>
friend class FuncHook;
template <typename InterceptorT, typename FuncPtrT>
friend class FuncHookCrossProcess;
};
} // namespace interceptor

Просмотреть файл

@ -73,22 +73,14 @@ int ParentMain()
mozilla::CrossProcessDllInterceptor intcpt(childProcess.get());
intcpt.Init("TestDllInterceptorCrossProcess.exe");
if (!gOrigReturnResult.Set(intcpt, "ReturnResult", &ReturnResultHook)) {
if (!gOrigReturnResult.Set(childProcess.get(), intcpt, "ReturnResult",
&ReturnResultHook)) {
printf("TEST-UNEXPECTED-FAIL | DllInterceptorCrossProcess | Failed to add hook\n");
return 1;
}
printf("TEST-PASS | DllInterceptorCrossProcess | Hook added\n");
// Let's save the original hook
SIZE_T bytesWritten;
if (!::WriteProcessMemory(childProcess.get(), &gOrigReturnResult,
&gOrigReturnResult, sizeof(gOrigReturnResult),
&bytesWritten)) {
printf("TEST-UNEXPECTED-FAIL | DllInterceptorCrossProcess | Failed to write original function pointer\n");
return 1;
}
if (::ResumeThread(childMainThread.get()) == static_cast<DWORD>(-1)) {
printf("TEST-UNEXPECTED-FAIL | DllInterceptorCrossProcess | Failed to resume child thread\n");
return 1;

Просмотреть файл

@ -1,10 +1,10 @@
[
{
"size": 138424593,
"size": 136616367,
"visibility": "public",
"digest": "1746b9c86d982492152567967aecdde147293f9f1d7b230821c191943fca8c39641276343ea4b1b2fc8eafb92f7b37507917ef7e2e1fd5b7f9b37d94050cec40",
"digest": "2e13e2ca795dc48ebcfe455bb1f9ec13c3d8b5095521acf94326ea44881aee8802b9021e19c93607db828ce8673fe421685c427c5cf31ced03a461f859dcd5dc",
"algorithm": "sha512",
"filename": "AVDs-armv7a-android-4.3.1_r1-build-2018-06-07.tar.gz",
"filename": "AVDs-armv7a-android-4.3.1_r1-build-2018-07-06.tar.gz",
"unpack": true
}
]