summaryrefslogtreecommitdiff
path: root/www/librewolf/files/patch-bug1948776
diff options
context:
space:
mode:
Diffstat (limited to 'www/librewolf/files/patch-bug1948776')
-rw-r--r--www/librewolf/files/patch-bug194877650
1 files changed, 50 insertions, 0 deletions
diff --git a/www/librewolf/files/patch-bug1948776 b/www/librewolf/files/patch-bug1948776
new file mode 100644
index 000000000000..86953f4e4472
--- /dev/null
+++ b/www/librewolf/files/patch-bug1948776
@@ -0,0 +1,50 @@
+commit 43b044fe8adaccb46868ac00c70a4e7a5d354a9c
+Author: Christoph Moench-Tegeder <cmt@burggraben.net>
+
+ Bug 1948776 - handle non-existence of MAP_NORESERVE for FreeBSD, r=afranchuk,jld,nika
+
+ The MAP_NORESERVE flag does not exist in FreeBSD. As the minimally-
+ invasive workaround, I decided to remove that flag directly in the
+ mmap() calls, instead of defining our own MAP_NORESERVE as 0
+ possibly far away and not obviously connected to these places.
+
+ Differential Revision: https://phabricator.services.mozilla.com/D238531
+
+diff --git ipc/glue/SharedMemoryPlatform_posix.cpp ipc/glue/SharedMemoryPlatform_posix.cpp
+index 61121bcbaf8d..b31f2200e8e6 100644
+--- ipc/glue/SharedMemoryPlatform_posix.cpp
++++ ipc/glue/SharedMemoryPlatform_posix.cpp
+@@ -447,8 +447,12 @@ bool Platform::Protect(char* aAddr, size_t aSize, Access aAccess) {
+ }
+
+ void* Platform::FindFreeAddressSpace(size_t aSize) {
+- void* memory = mmap(nullptr, aSize, PROT_NONE,
+- MAP_ANONYMOUS | MAP_NORESERVE | MAP_PRIVATE, -1, 0);
++#ifndef __FreeBSD__
++ int flags = MAP_ANONYMOUS | MAP_NORESERVE | MAP_PRIVATE;
++#else
++ int flags = MAP_ANONYMOUS | MAP_PRIVATE;
++#endif
++ void* memory = mmap(nullptr, aSize, PROT_NONE, flags, -1, 0);
+ if (memory == MAP_FAILED) {
+ return nullptr;
+ }
+diff --git ipc/glue/SharedMemory_posix.cpp ipc/glue/SharedMemory_posix.cpp
+index da279f469237..9ed83af4b1f2 100644
+--- ipc/glue/SharedMemory_posix.cpp
++++ ipc/glue/SharedMemory_posix.cpp
+@@ -61,8 +61,12 @@ SharedMemory::Handle SharedMemory::CloneHandle(const Handle& aHandle) {
+ }
+
+ void* SharedMemory::FindFreeAddressSpace(size_t size) {
+- void* memory = mmap(nullptr, size, PROT_NONE,
+- MAP_ANONYMOUS | MAP_NORESERVE | MAP_PRIVATE, -1, 0);
++#ifndef __FreeBSD__
++ int flags = MAP_ANONYMOUS | MAP_NORESERVE | MAP_PRIVATE;
++#else
++ int flags = MAP_ANONYMOUS | MAP_PRIVATE;
++#endif
++ void* memory = mmap(nullptr, size, PROT_NONE, flags, -1, 0);
+ if (memory == MAP_FAILED) {
+ return nullptr;
+ }