summaryrefslogtreecommitdiff
path: root/www/cliqz/files/patch-bug1550891
diff options
context:
space:
mode:
Diffstat (limited to 'www/cliqz/files/patch-bug1550891')
-rw-r--r--www/cliqz/files/patch-bug155089189
1 files changed, 89 insertions, 0 deletions
diff --git a/www/cliqz/files/patch-bug1550891 b/www/cliqz/files/patch-bug1550891
new file mode 100644
index 000000000000..7a5b0741ced2
--- /dev/null
+++ b/www/cliqz/files/patch-bug1550891
@@ -0,0 +1,89 @@
+commit 965eb33c5e86
+Author: Greg V <greg@unrelenting.technology>
+Date: Wed Jan 8 15:06:00 2020 -0800
+
+ Bug 1550891 - re-add SHM_ANON support in IPC shared memory, freezing via capabilities
+---
+ config/system-headers.mozbuild | 1 +
+ ipc/chromium/src/base/shared_memory_posix.cc | 20 +++++++++++++++++---
+ 2 files changed, 18 insertions(+), 3 deletions(-)
+
+diff --git config/system-headers.mozbuild config/system-headers.mozbuild
+index 88afca1070f86..beff3e2542c9f 100644
+--- mozilla-release/config/system-headers.mozbuild
++++ mozilla-release/config/system-headers.mozbuild
+@@ -816,6 +816,7 @@ system_headers = [
+ 'sys/bitypes.h',
+ 'sys/byteorder.h',
+ 'syscall.h',
++ 'sys/capsicum.h',
+ 'sys/cdefs.h',
+ 'sys/cfgodm.h',
+ 'sys/elf.h',
+diff --git ipc/chromium/src/base/shared_memory_posix.cc ipc/chromium/src/base/shared_memory_posix.cc
+index 0be9cce0b4bed..89e67483e4c16 100644
+--- mozilla-release/ipc/chromium/src/base/shared_memory_posix.cc
++++ mozilla-release/ipc/chromium/src/base/shared_memory_posix.cc
+@@ -16,6 +16,10 @@
+ # include <linux/ashmem.h>
+ #endif
+
++#ifdef __FreeBSD__
++# include <sys/capsicum.h>
++#endif
++
+ #include "base/eintr_wrapper.h"
+ #include "base/logging.h"
+ #include "base/string_util.h"
+@@ -148,7 +152,7 @@ static int SafeShmUnlink(bool freezeable, const char* name) {
+ }
+ }
+
+-#elif !defined(ANDROID)
++#elif !defined(ANDROID) && !defined(__FreeBSD__)
+ static int SafeShmOpen(bool freezeable, const char* name, int oflag, int mode) {
+ return shm_open(name, oflag, mode);
+ }
+@@ -160,7 +164,7 @@ static int SafeShmUnlink(bool freezeable, const char* name) {
+
+ // static
+ bool SharedMemory::AppendPosixShmPrefix(std::string* str, pid_t pid) {
+-#if defined(ANDROID)
++#if defined(ANDROID) || defined(__FreeBSD__)
+ return false;
+ #else
+ *str += '/';
+@@ -186,7 +190,7 @@ bool SharedMemory::AppendPosixShmPrefix(std::string* str, pid_t pid) {
+ // enough for this.
+ StringAppendF(str, "org.mozilla.ipc.%d.", static_cast<int>(pid));
+ return true;
+-#endif // !ANDROID
++#endif // !ANDROID && !__FreeBSD__
+ }
+
+ bool SharedMemory::CreateInternal(size_t size, bool freezeable) {
+@@ -212,6 +216,9 @@ bool SharedMemory::CreateInternal(size_t size, bool freezeable) {
+ return false;
+ }
+ needs_truncate = false;
++#elif defined(__FreeBSD__)
++ // FreeBSD supports anonymous shm_open
++ fd.reset(shm_open(SHM_ANON, O_RDWR, 0600));
+ #else
+ // Generic Unix: shm_open + shm_unlink
+ do {
+@@ -277,6 +284,14 @@ bool SharedMemory::ReadOnlyCopy(SharedMemory* ro_out) {
+ return false;
+ }
+ ro_file = mapped_file_;
++#elif defined(__FreeBSD__)
++ cap_rights_t rights;
++ cap_rights_init(&rights, CAP_MMAP_R);
++ if (cap_rights_limit(mapped_file_, &rights) != 0) {
++ CHROMIUM_LOG(WARNING) << "failed to freeze shm: " << strerror(errno);
++ return false;
++ }
++ ro_file = mapped_file_;
+ #else
+ DCHECK(frozen_file_ >= 0);
+ DCHECK(mapped_file_ >= 0);