mozilla-glibc236.patch
author Wolfgang Rosenauer <wr@rosenauer.org>
Sun, 21 Aug 2022 12:40:43 +0200
branchfirefox103
changeset 1177 4bb6d80fcc64
permissions -rw-r--r--
Firefox 103.0.2


# HG changeset patch
# User Mike Hommey <mh+mozilla@glandium.org>
# Date 1660077764 0
# Node ID 970ebbe54477a0e518bfee8aeddf487ad9bd4365
# Parent  caca601f2f5e87dd660434f3db2156e950151adb
Bug 1782988 - Avoid build bustage when building against glibc 2.36 or newer. r=RyanVM

Differential Revision: https://phabricator.services.mozilla.com/D153716

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
@@ -17,11 +17,15 @@ evconfig-private.h can be found in the r
 
 You then need to modify the EVENT__SIZEOF_* constants in the generated Linux,
 Android, and BSD headers to be appropriate for both 32-bit and 64-bit platforms.
 Mac doesn't need this since only 64-bit is supported. Use __LP64__ to
 distinguish the two cases. If you get something wrong, the CHECK_EVENT_SIZEOF
 static assertions in message_pump_libevent.cc will fail. If a new constant is
 added, also add a static assertion for it to message_pump_libevent.cc.
 
+You also need to modify the EVENT__HAVE_ARC4RANDOM and EVENT__HAVE_ARC4RANDOM_BUF
+constants in the generated Linux header to account for the results of the arc4random
+and arc4random_buf configure checks.
+
 2. No additional patches are needed at this time, but be careful to avoid
 clobbering changes to the various event-config.h files which have been customized
 over time to avoid various build bustages.
diff --git a/ipc/chromium/src/third_party/libevent/linux/event2/event-config.h b/ipc/chromium/src/third_party/libevent/linux/event2/event-config.h
--- a/ipc/chromium/src/third_party/libevent/linux/event2/event-config.h
+++ b/ipc/chromium/src/third_party/libevent/linux/event2/event-config.h
@@ -24,24 +24,28 @@
 /* #undef EVENT__DISABLE_THREAD_SUPPORT */
 
 /* Define to 1 if you have the `accept4' function. */
 #define EVENT__HAVE_ACCEPT4 1
 
 /* Define to 1 if you have the <afunix.h> header file. */
 /* #undef EVENT__HAVE_AFUNIX_H 1 */
 
+#ifdef HAVE_ARC4RANDOM
 /* Define to 1 if you have the `arc4random' function. */
-/* #undef EVENT__HAVE_ARC4RANDOM */
+#define EVENT__HAVE_ARC4RANDOM 1
+#endif
 
 /* Define to 1 if you have the `arc4random_addrandom' function. */
 /* #undef EVENT__HAVE_ARC4RANDOM_ADDRANDOM */
 
+#ifdef HAVE_ARC4RANDOM_BUF
 /* Define to 1 if you have the `arc4random_buf' function. */
-/* #undef EVENT__HAVE_ARC4RANDOM_BUF */
+#define EVENT__HAVE_ARC4RANDOM_BUF 1
+#endif
 
 /* Define to 1 if you have the <arpa/inet.h> header file. */
 #define EVENT__HAVE_ARPA_INET_H 1
 
 /* Define to 1 if you have the `clock_gettime' function. */
 #define EVENT__HAVE_CLOCK_GETTIME 1
 
 /* Define to 1 if you have the declaration of `CTL_KERN', and to 0 if you


# HG changeset patch
# User Mike Hommey <mh+mozilla@glandium.org>
# Date 1660077764 0
# Node ID a61813bd9f0a0048b84a2c56a77a06eb5e269ab2
# Parent  970ebbe54477a0e518bfee8aeddf487ad9bd4365
Bug 1782988 - Fix use of arc4random_buf use in ping.cpp. r=gsvelto

The code was probably never built before glibc 2.36, because before
that, only Android and some BSDs had arc4random_buf, but none of those
actually built this code.

Differential Revision: https://phabricator.services.mozilla.com/D154024

diff --git a/toolkit/crashreporter/client/ping.cpp b/toolkit/crashreporter/client/ping.cpp
--- a/toolkit/crashreporter/client/ping.cpp
+++ b/toolkit/crashreporter/client/ping.cpp
@@ -48,17 +48,17 @@ static string GenerateUUID() {
     return "";
   }
 
   CFUUIDBytes bytes = CFUUIDGetUUIDBytes(uuid);
   memcpy(&id, &bytes, sizeof(UUID));
 
   CFRelease(uuid);
 #elif defined(HAVE_ARC4RANDOM_BUF)  // Android, BSD, ...
-  arc4random_buf(id, sizeof(UUID));
+  arc4random_buf(&id, sizeof(UUID));
 #else                               // Linux
   int fd = open("/dev/urandom", O_RDONLY);
 
   if (fd == -1) {
     return "";
   }
 
   if (read(fd, &id, sizeof(UUID)) != sizeof(UUID)) {