summaryrefslogtreecommitdiffstats
path: root/ipc/chromium/src/third_party/libevent/patches
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /ipc/chromium/src/third_party/libevent/patches
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'ipc/chromium/src/third_party/libevent/patches')
-rw-r--r--ipc/chromium/src/third_party/libevent/patches/android-arc4random-buf.patch32
-rw-r--r--ipc/chromium/src/third_party/libevent/patches/android64_support.patch52
-rw-r--r--ipc/chromium/src/third_party/libevent/patches/avoid-empty-sighandler.patch65
-rw-r--r--ipc/chromium/src/third_party/libevent/patches/backport-upstream-fixes.patch280
-rw-r--r--ipc/chromium/src/third_party/libevent/patches/dont-use-issetugid-on-android.patch22
-rw-r--r--ipc/chromium/src/third_party/libevent/patches/mac-arc4random-buf.patch30
-rw-r--r--ipc/chromium/src/third_party/libevent/patches/openbsd-no-arc4random_addrandom.patch66
-rw-r--r--ipc/chromium/src/third_party/libevent/patches/use-non-deprecated-syscalls.patch43
8 files changed, 590 insertions, 0 deletions
diff --git a/ipc/chromium/src/third_party/libevent/patches/android-arc4random-buf.patch b/ipc/chromium/src/third_party/libevent/patches/android-arc4random-buf.patch
new file mode 100644
index 000000000..32aa3cdc8
--- /dev/null
+++ b/ipc/chromium/src/third_party/libevent/patches/android-arc4random-buf.patch
@@ -0,0 +1,32 @@
+only in patch2:
+unchanged:
+--- a/ipc/chromium/src/third_party/libevent/evutil_rand.c
++++ b/ipc/chromium/src/third_party/libevent/evutil_rand.c
+@@ -58,7 +58,7 @@ evutil_secure_rng_global_setup_locks_(const int enable_locks)
+ static void
+ ev_arc4random_buf(void *buf, size_t n)
+ {
+-#if defined(_EVENT_HAVE_ARC4RANDOM_BUF) && !defined(__APPLE__)
++#if defined(_EVENT_HAVE_ARC4RANDOM_BUF) && !(defined(__APPLE__) || defined(__ANDROID__))
+ arc4random_buf(buf, n);
+ #else
+ unsigned char *b = buf;
+only in patch2:
+unchanged:
+--- a/ipc/chromium/src/third_party/libevent/patches/android-arc4random-buf.patch
++++ b/ipc/chromium/src/third_party/libevent/patches/android-arc4random-buf.patch
+@@ -1,14 +0,0 @@
+-e6dd814 evutil_rand.c fixup for clang
+-diff --git a/ipc/chromium/src/third_party/libevent/evutil_rand.c b/ipc/chromium/src/third_party/libevent/evutil_rand.c
+-index 86c86b2..0c41765 100644
+---- a/ipc/chromium/src/third_party/libevent/evutil_rand.c
+-+++ b/ipc/chromium/src/third_party/libevent/evutil_rand.c
+-@@ -59,7 +59,7 @@ static void
+- ev_arc4random_buf(void *buf, size_t n)
+- {
+- #if defined(_EVENT_HAVE_ARC4RANDOM_BUF) && !defined(__APPLE__)
+-- return arc4random_buf(buf, n);
+-+ arc4random_buf(buf, n);
+- #else
+- unsigned char *b = buf;
+-
diff --git a/ipc/chromium/src/third_party/libevent/patches/android64_support.patch b/ipc/chromium/src/third_party/libevent/patches/android64_support.patch
new file mode 100644
index 000000000..1f039d0d5
--- /dev/null
+++ b/ipc/chromium/src/third_party/libevent/patches/android64_support.patch
@@ -0,0 +1,52 @@
+diff --git a/ipc/chromium/src/third_party/libevent/android/event2/event-config.h b/ipc/chromium/src/third_party/libevent/android/event2/event-config.h
+--- a/ipc/chromium/src/third_party/libevent/android/event2/event-config.h
++++ b/ipc/chromium/src/third_party/libevent/android/event2/event-config.h
+@@ -397,32 +397,48 @@
+ /* Define to necessary symbol if this constant uses a non-standard name on
+ your system. */
+ /* #undef _EVENT_PTHREAD_CREATE_JOINABLE */
+
+ /* The size of `int', as computed by sizeof. */
+ #define _EVENT_SIZEOF_INT 4
+
+ /* The size of `long', as computed by sizeof. */
++#ifdef __LP64__
++#define _EVENT_SIZEOF_LONG 8
++#else
+ #define _EVENT_SIZEOF_LONG 4
++#endif
+
+ /* The size of `long long', as computed by sizeof. */
+ #define _EVENT_SIZEOF_LONG_LONG 8
+
+ /* The size of `pthread_t', as computed by sizeof. */
++#ifdef __LP64__
++#define _EVENT_SIZEOF_PTHREAD_T 8
++#else
+ #define _EVENT_SIZEOF_PTHREAD_T 4
++#endif
+
+ /* The size of `short', as computed by sizeof. */
+ #define _EVENT_SIZEOF_SHORT 2
+
+ /* The size of `size_t', as computed by sizeof. */
++#ifdef __LP64__
++#define _EVENT_SIZEOF_SIZE_T 8
++#else
+ #define _EVENT_SIZEOF_SIZE_T 4
++#endif
+
+ /* The size of `void *', as computed by sizeof. */
++#ifdef __LP64__
++#define _EVENT_SIZEOF_VOID_P 8
++#else
+ #define _EVENT_SIZEOF_VOID_P 4
++#endif
+
+ /* Define to 1 if you have the ANSI C header files. */
+ #define _EVENT_STDC_HEADERS 1
+
+ /* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+ #define _EVENT_TIME_WITH_SYS_TIME 1
+
+ /* Version number of package */
diff --git a/ipc/chromium/src/third_party/libevent/patches/avoid-empty-sighandler.patch b/ipc/chromium/src/third_party/libevent/patches/avoid-empty-sighandler.patch
new file mode 100644
index 000000000..06b946c37
--- /dev/null
+++ b/ipc/chromium/src/third_party/libevent/patches/avoid-empty-sighandler.patch
@@ -0,0 +1,65 @@
+diff --git a/ipc/chromium/src/third_party/libevent/kqueue.c b/ipc/chromium/src/third_party/libevent/kqueue.c
+--- a/ipc/chromium/src/third_party/libevent/kqueue.c
++++ b/ipc/chromium/src/third_party/libevent/kqueue.c
+@@ -158,26 +158,20 @@ kq_init(struct event_base *base)
+ base->evsigsel = &kqsigops;
+
+ return (kqueueop);
+ err:
+ if (kqueueop)
+ kqop_free(kqueueop);
+
+ return (NULL);
+ }
+
+-static void
+-kq_sighandler(int sig)
+-{
+- /* Do nothing here */
+-}
+-
+ #define ADD_UDATA 0x30303
+
+ static void
+ kq_setup_kevent(struct kevent *out, evutil_socket_t fd, int filter, short change)
+ {
+ memset(out, 0, sizeof(struct kevent));
+ out->ident = fd;
+ out->filter = filter;
+
+ if (change & EV_CHANGE_ADD) {
+@@ -431,24 +425,31 @@ kq_sig_add(struct event_base *base, int
+ kev.ident = nsignal;
+ kev.filter = EVFILT_SIGNAL;
+ kev.flags = EV_ADD;
+
+ /* Be ready for the signal if it is sent any
+ * time between now and the next call to
+ * kq_dispatch. */
+ if (kevent(kqop->kq, &kev, 1, NULL, 0, &timeout) == -1)
+ return (-1);
+
+- /* XXXX The manpage suggest we could use SIG_IGN instead of a
+- * do-nothing handler */
+- if (_evsig_set_handler(base, nsignal, kq_sighandler) == -1)
++ /* Backported from
++ * https://github.com/nmathewson/Libevent/commit/148458e0a1fd25e167aa2ef229d1c9a70b27c3e9 */
++ /* We can set the handler for most signals to SIG_IGN and
++ * still have them reported to us in the queue. However,
++ * if the handler for SIGCHLD is SIG_IGN, the system reaps
++ * zombie processes for us, and we don't get any notification.
++ * This appears to be the only signal with this quirk. */
++ if (_evsig_set_handler(base, nsignal,
++ nsignal == SIGCHLD ? SIG_DFL : SIG_IGN) == -1) {
+ return (-1);
++ }
+
+ return (0);
+ }
+
+ static int
+ kq_sig_del(struct event_base *base, int nsignal, short old, short events, void *p)
+ {
+ struct kqop *kqop = base->evbase;
+ struct kevent kev;
+
diff --git a/ipc/chromium/src/third_party/libevent/patches/backport-upstream-fixes.patch b/ipc/chromium/src/third_party/libevent/patches/backport-upstream-fixes.patch
new file mode 100644
index 000000000..2334d814b
--- /dev/null
+++ b/ipc/chromium/src/third_party/libevent/patches/backport-upstream-fixes.patch
@@ -0,0 +1,280 @@
+Bug 1343453 - Backport fixes for upstream issues #317, #318, #332, and #335.
+
+diff --git a/ipc/chromium/src/third_party/libevent/README.mozilla b/ipc/chromium/src/third_party/libevent/README.mozilla
+--- a/ipc/chromium/src/third_party/libevent/README.mozilla
++++ b/ipc/chromium/src/third_party/libevent/README.mozilla
+@@ -36,8 +36,11 @@ ipc/chromium/src/third_party/libevent/pa
+ architecture (which does not provide deprecated syscalls).
+
+ - "dont-use-issetugid-on-android.patch". This fixes the build on Android L
+ preview.
+
+ - "avoid-empty-sighandler.patch". This fixes some OS X crashes.
+
+ - "android64_support.patch". This fixes Android 64-bit support.
++
++- "backport-upstream-fixes.patch". Backports a few upstream fixes from 2.1.x
++ to our in-tree copy of 2.0.21.
+diff --git a/ipc/chromium/src/third_party/libevent/buffer.c b/ipc/chromium/src/third_party/libevent/buffer.c
+--- a/ipc/chromium/src/third_party/libevent/buffer.c
++++ b/ipc/chromium/src/third_party/libevent/buffer.c
+@@ -1539,17 +1539,21 @@ evbuffer_add(struct evbuffer *buf, const
+ int result = -1;
+
+ EVBUFFER_LOCK(buf);
+
+ if (buf->freeze_end) {
+ goto done;
+ }
+
+- chain = buf->last;
++ if (*buf->last_with_datap == NULL) {
++ chain = buf->last;
++ } else {
++ chain = *buf->last_with_datap;
++ }
+
+ /* If there are no chains allocated for this buffer, allocate one
+ * big enough to hold all the data. */
+ if (chain == NULL) {
+ chain = evbuffer_chain_new(datlen);
+ if (!chain)
+ goto done;
+ evbuffer_chain_insert(buf, chain);
+diff --git a/ipc/chromium/src/third_party/libevent/evdns.c b/ipc/chromium/src/third_party/libevent/evdns.c
+--- a/ipc/chromium/src/third_party/libevent/evdns.c
++++ b/ipc/chromium/src/third_party/libevent/evdns.c
+@@ -947,17 +947,16 @@ name_parse(u8 *packet, int length, int *
+ /* Normally, names are a series of length prefixed strings terminated */
+ /* with a length of 0 (the lengths are u8's < 63). */
+ /* However, the length can start with a pair of 1 bits and that */
+ /* means that the next 14 bits are a pointer within the current */
+ /* packet. */
+
+ for (;;) {
+ u8 label_len;
+- if (j >= length) return -1;
+ GET8(label_len);
+ if (!label_len) break;
+ if (label_len & 0xc0) {
+ u8 ptr_low;
+ GET8(ptr_low);
+ if (name_end < 0) name_end = j;
+ j = (((int)label_len & 0x3f) << 8) + ptr_low;
+ /* Make sure that the target offset is in-bounds. */
+@@ -968,16 +967,17 @@ name_parse(u8 *packet, int length, int *
+ continue;
+ }
+ if (label_len > 63) return -1;
+ if (cp != name_out) {
+ if (cp + 1 >= end) return -1;
+ *cp++ = '.';
+ }
+ if (cp + label_len >= end) return -1;
++ if (j + label_len > length) return -1;
+ memcpy(cp, packet + j, label_len);
+ cp += label_len;
+ j += label_len;
+ }
+ if (cp >= end) return -1;
+ *cp = '\0';
+ if (name_end < 0)
+ *idx = j;
+@@ -3102,19 +3102,22 @@ search_set_from_hostname(struct evdns_ba
+ if (!domainname) return;
+ search_postfix_add(base, domainname);
+ }
+
+ /* warning: returns malloced string */
+ static char *
+ search_make_new(const struct search_state *const state, int n, const char *const base_name) {
+ const size_t base_len = strlen(base_name);
+- const char need_to_append_dot = base_name[base_len - 1] == '.' ? 0 : 1;
++ char need_to_append_dot;
+ struct search_domain *dom;
+
++ if (!base_len) return NULL;
++ need_to_append_dot = base_name[base_len - 1] == '.' ? 0 : 1;
++
+ for (dom = state->head; dom; dom = dom->next) {
+ if (!n--) {
+ /* this is the postfix we want */
+ /* the actual postfix string is kept at the end of the structure */
+ const u8 *const postfix = ((u8 *) dom) + sizeof(struct search_domain);
+ const int postfix_len = dom->len;
+ char *const newname = (char *) mm_malloc(base_len + need_to_append_dot + postfix_len + 1);
+ if (!newname) return NULL;
+diff --git a/ipc/chromium/src/third_party/libevent/evutil.c b/ipc/chromium/src/third_party/libevent/evutil.c
+--- a/ipc/chromium/src/third_party/libevent/evutil.c
++++ b/ipc/chromium/src/third_party/libevent/evutil.c
+@@ -1803,22 +1803,22 @@ evutil_parse_sockaddr_port(const char *i
+ * ipv6
+ * [ipv6]
+ * ipv4:port
+ * ipv4
+ */
+
+ cp = strchr(ip_as_string, ':');
+ if (*ip_as_string == '[') {
+- int len;
++ size_t len;
+ if (!(cp = strchr(ip_as_string, ']'))) {
+ return -1;
+ }
+- len = (int) ( cp-(ip_as_string + 1) );
+- if (len > (int)sizeof(buf)-1) {
++ len = ( cp-(ip_as_string + 1) );
++ if (len > sizeof(buf)-1) {
+ return -1;
+ }
+ memcpy(buf, ip_as_string+1, len);
+ buf[len] = '\0';
+ addr_part = buf;
+ if (cp[1] == ':')
+ port_part = cp+2;
+ else
+diff --git a/ipc/chromium/src/third_party/libevent/patches/backport-upstream-fixes.patch b/ipc/chromium/src/third_party/libevent/patches/backport-upstream-fixes.patch
+new file mode 100644
+--- /dev/null
++++ b/ipc/chromium/src/third_party/libevent/patches/backport-upstream-fixes.patch
+@@ -0,0 +1,140 @@
++Bug 1343453 - Backport fixes for upstream issues #317, #318, #332, #335, and #340.
++
++diff --git a/ipc/chromium/src/third_party/libevent/buffer.c b/ipc/chromium/src/third_party/libevent/buffer.c
++--- a/ipc/chromium/src/third_party/libevent/buffer.c
+++++ b/ipc/chromium/src/third_party/libevent/buffer.c
++@@ -1553,17 +1553,21 @@ evbuffer_add(struct evbuffer *buf, const
++ if (buf->freeze_end) {
++ goto done;
++ }
++ /* Prevent buf->total_len overflow */
++ if (datlen > EV_SIZE_MAX - buf->total_len) {
++ goto done;
++ }
++
++- chain = buf->last;
+++ if (*buf->last_with_datap == NULL) {
+++ chain = buf->last;
+++ } else {
+++ chain = *buf->last_with_datap;
+++ }
++
++ /* If there are no chains allocated for this buffer, allocate one
++ * big enough to hold all the data. */
++ if (chain == NULL) {
++ chain = evbuffer_chain_new(datlen);
++ if (!chain)
++ goto done;
++ evbuffer_chain_insert(buf, chain);
++@@ -1795,18 +1799,17 @@ evbuffer_expand_singlechain(struct evbuf
++ * it, use the next chunk after it, or If we add a new chunk, we waste
++ * CHAIN_SPACE_LEN(chain) bytes in the former last chunk. If we
++ * resize, we have to copy chain->off bytes.
++ */
++
++ /* Would expanding this chunk be affordable and worthwhile? */
++ if (CHAIN_SPACE_LEN(chain) < chain->buffer_len / 8 ||
++ chain->off > MAX_TO_COPY_IN_EXPAND ||
++- (datlen < EVBUFFER_CHAIN_MAX &&
++- EVBUFFER_CHAIN_MAX - datlen >= chain->off)) {
+++ datlen >= (EVBUFFER_CHAIN_MAX - chain->off)) {
++ /* It's not worth resizing this chain. Can the next one be
++ * used? */
++ if (chain->next && CHAIN_SPACE_LEN(chain->next) >= datlen) {
++ /* Yes, we can just use the next chain (which should
++ * be empty. */
++ result = chain->next;
++ goto ok;
++ } else {
++diff --git a/ipc/chromium/src/third_party/libevent/evdns.c b/ipc/chromium/src/third_party/libevent/evdns.c
++--- a/ipc/chromium/src/third_party/libevent/evdns.c
+++++ b/ipc/chromium/src/third_party/libevent/evdns.c
++@@ -955,17 +955,16 @@ name_parse(u8 *packet, int length, int *
++ /* Normally, names are a series of length prefixed strings terminated */
++ /* with a length of 0 (the lengths are u8's < 63). */
++ /* However, the length can start with a pair of 1 bits and that */
++ /* means that the next 14 bits are a pointer within the current */
++ /* packet. */
++
++ for (;;) {
++ u8 label_len;
++- if (j >= length) return -1;
++ GET8(label_len);
++ if (!label_len) break;
++ if (label_len & 0xc0) {
++ u8 ptr_low;
++ GET8(ptr_low);
++ if (name_end < 0) name_end = j;
++ j = (((int)label_len & 0x3f) << 8) + ptr_low;
++ /* Make sure that the target offset is in-bounds. */
++@@ -976,16 +975,17 @@ name_parse(u8 *packet, int length, int *
++ continue;
++ }
++ if (label_len > 63) return -1;
++ if (cp != name_out) {
++ if (cp + 1 >= end) return -1;
++ *cp++ = '.';
++ }
++ if (cp + label_len >= end) return -1;
+++ if (j + label_len > length) return -1;
++ memcpy(cp, packet + j, label_len);
++ cp += label_len;
++ j += label_len;
++ }
++ if (cp >= end) return -1;
++ *cp = '\0';
++ if (name_end < 0)
++ *idx = j;
++@@ -3117,19 +3117,22 @@ search_set_from_hostname(struct evdns_ba
++ if (!domainname) return;
++ search_postfix_add(base, domainname);
++ }
++
++ /* warning: returns malloced string */
++ static char *
++ search_make_new(const struct search_state *const state, int n, const char *const base_name) {
++ const size_t base_len = strlen(base_name);
++- const char need_to_append_dot = base_name[base_len - 1] == '.' ? 0 : 1;
+++ char need_to_append_dot;
++ struct search_domain *dom;
++
+++ if (!base_len) return NULL;
+++ need_to_append_dot = base_name[base_len - 1] == '.' ? 0 : 1;
+++
++ for (dom = state->head; dom; dom = dom->next) {
++ if (!n--) {
++ /* this is the postfix we want */
++ /* the actual postfix string is kept at the end of the structure */
++ const u8 *const postfix = ((u8 *) dom) + sizeof(struct search_domain);
++ const int postfix_len = dom->len;
++ char *const newname = (char *) mm_malloc(base_len + need_to_append_dot + postfix_len + 1);
++ if (!newname) return NULL;
++diff --git a/ipc/chromium/src/third_party/libevent/evutil.c b/ipc/chromium/src/third_party/libevent/evutil.c
++--- a/ipc/chromium/src/third_party/libevent/evutil.c
+++++ b/ipc/chromium/src/third_party/libevent/evutil.c
++@@ -1803,22 +1803,22 @@ evutil_parse_sockaddr_port(const char *i
++ * ipv6
++ * [ipv6]
++ * ipv4:port
++ * ipv4
++ */
++
++ cp = strchr(ip_as_string, ':');
++ if (*ip_as_string == '[') {
++- int len;
+++ size_t len;
++ if (!(cp = strchr(ip_as_string, ']'))) {
++ return -1;
++ }
++- len = (int) ( cp-(ip_as_string + 1) );
++- if (len > (int)sizeof(buf)-1) {
+++ len = ( cp-(ip_as_string + 1) );
+++ if (len > sizeof(buf)-1) {
++ return -1;
++ }
++ memcpy(buf, ip_as_string+1, len);
++ buf[len] = '\0';
++ addr_part = buf;
++ if (cp[1] == ':')
++ port_part = cp+2;
++ else
diff --git a/ipc/chromium/src/third_party/libevent/patches/dont-use-issetugid-on-android.patch b/ipc/chromium/src/third_party/libevent/patches/dont-use-issetugid-on-android.patch
new file mode 100644
index 000000000..f003a8cb4
--- /dev/null
+++ b/ipc/chromium/src/third_party/libevent/patches/dont-use-issetugid-on-android.patch
@@ -0,0 +1,22 @@
+diff --git a/ipc/chromium/src/third_party/libevent/android/event2/event-config.h b/ipc/chromium/src/third_party/libevent/android/event2/event-config.h
+--- a/ipc/chromium/src/third_party/libevent/android/event2/event-config.h
++++ b/ipc/chromium/src/third_party/libevent/android/event2/event-config.h
+@@ -119,17 +119,17 @@
+
+ /* Define to 1 if you have the `inet_pton' function. */
+ #define _EVENT_HAVE_INET_PTON 1
+
+ /* Define to 1 if you have the <inttypes.h> header file. */
+ #define _EVENT_HAVE_INTTYPES_H 1
+
+ /* Define to 1 if you have the `issetugid' function. */
+-#define _EVENT_HAVE_ISSETUGID 1
++/* #undef _EVENT_HAVE_ISSETUGID */
+
+ /* Define to 1 if you have the `kqueue' function. */
+ /* #undef _EVENT_HAVE_KQUEUE */
+
+ /* Define if the system has zlib */
+ #define _EVENT_HAVE_LIBZ 1
+
+ /* Define to 1 if you have the <memory.h> header file. */
diff --git a/ipc/chromium/src/third_party/libevent/patches/mac-arc4random-buf.patch b/ipc/chromium/src/third_party/libevent/patches/mac-arc4random-buf.patch
new file mode 100644
index 000000000..d611585ae
--- /dev/null
+++ b/ipc/chromium/src/third_party/libevent/patches/mac-arc4random-buf.patch
@@ -0,0 +1,30 @@
+--- a/evutil_rand.c 2012-08-02 10:36:53.000000000 -0500
++++ b/evutil_rand.c 2013-02-20 13:01:45.000000000 -0600
+@@ -58,27 +58,16 @@ evutil_secure_rng_global_setup_locks_(co
+ static void
+ ev_arc4random_buf(void *buf, size_t n)
+ {
+ #if defined(_EVENT_HAVE_ARC4RANDOM_BUF) && !defined(__APPLE__)
+ return arc4random_buf(buf, n);
+ #else
+ unsigned char *b = buf;
+
+-#if defined(_EVENT_HAVE_ARC4RANDOM_BUF)
+- /* OSX 10.7 introducd arc4random_buf, so if you build your program
+- * there, you'll get surprised when older versions of OSX fail to run.
+- * To solve this, we can check whether the function pointer is set,
+- * and fall back otherwise. (OSX does this using some linker
+- * trickery.)
+- */
+- if (arc4random_buf != NULL) {
+- return arc4random_buf(buf, n);
+- }
+-#endif
+ /* Make sure that we start out with b at a 4-byte alignment; plenty
+ * of CPUs care about this for 32-bit access. */
+ if (n >= 4 && ((ev_uintptr_t)b) & 3) {
+ ev_uint32_t u = arc4random();
+ int n_bytes = 4 - (((ev_uintptr_t)b) & 3);
+ memcpy(b, &u, n_bytes);
+ b += n_bytes;
+ n -= n_bytes;
diff --git a/ipc/chromium/src/third_party/libevent/patches/openbsd-no-arc4random_addrandom.patch b/ipc/chromium/src/third_party/libevent/patches/openbsd-no-arc4random_addrandom.patch
new file mode 100644
index 000000000..6a8062ba2
--- /dev/null
+++ b/ipc/chromium/src/third_party/libevent/patches/openbsd-no-arc4random_addrandom.patch
@@ -0,0 +1,66 @@
+# HG changeset patch
+# User Landry Breuil <landry@openbsd.org>
+# Date 1384377262 -3600
+# Wed Nov 13 22:14:22 2013 +0100
+# Node ID 026009b2c94dc564413d48df824fabec98e2c631
+# Parent f2b602a5ee27b2e05abe84ea7cbd358dadd2ffb5
+Bug 931354: OpenBSD doesn't provide arc4random_addrandom anymore, fix libevent accordingly by #ifndef'ing out its caller evutil_secure_rng_add_bytes() (which isnt called anywhere) r=joshaas
+
+See also bug 1259218 for why we remove it for Android.
+
+diff --git a/ipc/chromium/src/third_party/libevent/evutil_rand.c b/ipc/chromium/src/third_party/libevent/evutil_rand.c
+--- a/ipc/chromium/src/third_party/libevent/evutil_rand.c
++++ b/ipc/chromium/src/third_party/libevent/evutil_rand.c
+@@ -134,15 +134,16 @@ ev_arc4random_buf(void *buf, size_t n)
+ #endif /* } !_EVENT_HAVE_ARC4RANDOM */
+
+ void
+ evutil_secure_rng_get_bytes(void *buf, size_t n)
+ {
+ ev_arc4random_buf(buf, n);
+ }
+
++#if !defined(__OpenBSD__) && !defined(ANDROID)
+ void
+ evutil_secure_rng_add_bytes(const char *buf, size_t n)
+ {
+ arc4random_addrandom((unsigned char*)buf,
+ n>(size_t)INT_MAX ? INT_MAX : (int)n);
+ }
+-
++#endif
+diff --git a/ipc/chromium/src/third_party/libevent/include/event2/util.h b/ipc/chromium/src/third_party/libevent/include/event2/util.h
+--- a/ipc/chromium/src/third_party/libevent/include/event2/util.h
++++ b/ipc/chromium/src/third_party/libevent/include/event2/util.h
+@@ -667,29 +667,31 @@ void evutil_secure_rng_get_bytes(void *b
+ * numbers. You only need to call it if (a) you want to double-check
+ * that one of the seeding methods did succeed, or (b) you plan to drop
+ * the capability to seed (by chrooting, or dropping capabilities, or
+ * whatever), and you want to make sure that seeding happens before your
+ * program loses the ability to do it.
+ */
+ int evutil_secure_rng_init(void);
+
++#if !defined(__OpenBSD__) && !defined(ANDROID)
+ /** Seed the random number generator with extra random bytes.
+
+ You should almost never need to call this function; it should be
+ sufficient to invoke evutil_secure_rng_init(), or let Libevent take
+ care of calling evutil_secure_rng_init() on its own.
+
+ If you call this function as a _replacement_ for the regular
+ entropy sources, then you need to be sure that your input
+ contains a fairly large amount of strong entropy. Doing so is
+ notoriously hard: most people who try get it wrong. Watch out!
+
+ @param dat a buffer full of a strong source of random numbers
+ @param datlen the number of bytes to read from datlen
+ */
+ void evutil_secure_rng_add_bytes(const char *dat, size_t datlen);
++#endif
+
+ #ifdef __cplusplus
+ }
+ #endif
+
+ #endif /* _EVUTIL_H_ */
diff --git a/ipc/chromium/src/third_party/libevent/patches/use-non-deprecated-syscalls.patch b/ipc/chromium/src/third_party/libevent/patches/use-non-deprecated-syscalls.patch
new file mode 100644
index 000000000..17319a19b
--- /dev/null
+++ b/ipc/chromium/src/third_party/libevent/patches/use-non-deprecated-syscalls.patch
@@ -0,0 +1,43 @@
+---
+ ipc/chromium/src/third_party/libevent/epoll_sub.c | 13 +++++++++++++
+ 1 file changed, 13 insertions(+)
+
+--- mozilla-central.orig/ipc/chromium/src/third_party/libevent/epoll_sub.c
++++ mozilla-central/ipc/chromium/src/third_party/libevent/epoll_sub.c
+@@ -29,15 +29,24 @@
+ #include <sys/param.h>
+ #include <sys/types.h>
+ #include <sys/syscall.h>
+ #include <sys/epoll.h>
+ #include <unistd.h>
++#include <errno.h>
+
+ int
+ epoll_create(int size)
+ {
++#if !defined(__NR_epoll_create) && defined(__NR_epoll_create1)
++ if (size <= 0) {
++ errno = EINVAL;
++ return -1;
++ }
++ return (syscall(__NR_epoll_create1, 0));
++#else
+ return (syscall(__NR_epoll_create, size));
++#endif
+ }
+
+ int
+ epoll_ctl(int epfd, int op, int fd, struct epoll_event *event)
+ {
+@@ -46,7 +55,11 @@ epoll_ctl(int epfd, int op, int fd, stru
+ }
+
+ int
+ epoll_wait(int epfd, struct epoll_event *events, int maxevents, int timeout)
+ {
++#if !defined(__NR_epoll_wait) && defined(__NR_epoll_pwait)
++ return (syscall(__NR_epoll_pwait, epfd, events, maxevents, timeout, NULL, 0));
++#else
+ return (syscall(__NR_epoll_wait, epfd, events, maxevents, timeout));
++#endif
+ }