mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 10:00:54 +00:00
Bug 1678445 - Crash related to Widevine playback on macOS 11 with Apples Silicon/arm64 r=jld,bryce
When using an x64 GMP child process with an arm64 parent process on arm64 Mac's, use a 16k Shmem pagesize in the child process. Differential Revision: https://phabricator.services.mozilla.com/D98241
This commit is contained in:
parent
40bf7ed8c2
commit
ba86698ecc
@ -89,6 +89,9 @@ bool GMPProcessParent::Launch(int32_t aTimeoutMs) {
|
||||
GMP_LOG_DEBUG("GMPProcessParent::Launch() mChildLaunchArch: %d",
|
||||
mChildLaunchArch);
|
||||
mLaunchOptions->arch = mChildLaunchArch;
|
||||
if (mChildLaunchArch == base::PROCESS_ARCH_X86_64) {
|
||||
mLaunchOptions->env_map["MOZ_SHMEM_PAGESIZE_16K"] = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(XP_WIN) && defined(MOZ_SANDBOX)
|
||||
|
@ -9,9 +9,17 @@
|
||||
|
||||
#include "mozilla/ipc/SharedMemory.h"
|
||||
|
||||
#if defined(XP_MACOSX) && defined(__x86_64__)
|
||||
#include "prenv.h"
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
namespace ipc {
|
||||
|
||||
#if defined(XP_MACOSX) && defined(__x86_64__)
|
||||
std::atomic<size_t> sPageSizeOverride = 0;
|
||||
#endif
|
||||
|
||||
void SharedMemory::SystemProtect(char* aAddr, size_t aSize, int aRights) {
|
||||
if (!SystemProtectFallible(aAddr, aSize, aRights)) {
|
||||
MOZ_CRASH("can't mprotect()");
|
||||
@ -28,7 +36,20 @@ bool SharedMemory::SystemProtectFallible(char* aAddr, size_t aSize,
|
||||
return 0 == mprotect(aAddr, aSize, flags);
|
||||
}
|
||||
|
||||
size_t SharedMemory::SystemPageSize() { return sysconf(_SC_PAGESIZE); }
|
||||
size_t SharedMemory::SystemPageSize() {
|
||||
#if defined(XP_MACOSX) && defined(__x86_64__)
|
||||
if (sPageSizeOverride == 0) {
|
||||
if (PR_GetEnv("MOZ_SHMEM_PAGESIZE_16K")) {
|
||||
sPageSizeOverride = 16 * 1024;
|
||||
} else {
|
||||
sPageSizeOverride = sysconf(_SC_PAGESIZE);
|
||||
}
|
||||
}
|
||||
return sPageSizeOverride;
|
||||
#else
|
||||
return sysconf(_SC_PAGESIZE);
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace ipc
|
||||
} // namespace mozilla
|
||||
|
Loading…
Reference in New Issue
Block a user