mozilla-glibc236.patch
branchfirefox103
changeset 1177 4bb6d80fcc64
equal deleted inserted replaced
1176:f871aac89885 1177:4bb6d80fcc64
       
     1 
       
     2 # HG changeset patch
       
     3 # User Mike Hommey <mh+mozilla@glandium.org>
       
     4 # Date 1660077764 0
       
     5 # Node ID 970ebbe54477a0e518bfee8aeddf487ad9bd4365
       
     6 # Parent  caca601f2f5e87dd660434f3db2156e950151adb
       
     7 Bug 1782988 - Avoid build bustage when building against glibc 2.36 or newer. r=RyanVM
       
     8 
       
     9 Differential Revision: https://phabricator.services.mozilla.com/D153716
       
    10 
       
    11 diff --git a/ipc/chromium/src/third_party/libevent/README.mozilla b/ipc/chromium/src/third_party/libevent/README.mozilla
       
    12 --- a/ipc/chromium/src/third_party/libevent/README.mozilla
       
    13 +++ b/ipc/chromium/src/third_party/libevent/README.mozilla
       
    14 @@ -17,11 +17,15 @@ evconfig-private.h can be found in the r
       
    15  
       
    16  You then need to modify the EVENT__SIZEOF_* constants in the generated Linux,
       
    17  Android, and BSD headers to be appropriate for both 32-bit and 64-bit platforms.
       
    18  Mac doesn't need this since only 64-bit is supported. Use __LP64__ to
       
    19  distinguish the two cases. If you get something wrong, the CHECK_EVENT_SIZEOF
       
    20  static assertions in message_pump_libevent.cc will fail. If a new constant is
       
    21  added, also add a static assertion for it to message_pump_libevent.cc.
       
    22  
       
    23 +You also need to modify the EVENT__HAVE_ARC4RANDOM and EVENT__HAVE_ARC4RANDOM_BUF
       
    24 +constants in the generated Linux header to account for the results of the arc4random
       
    25 +and arc4random_buf configure checks.
       
    26 +
       
    27  2. No additional patches are needed at this time, but be careful to avoid
       
    28  clobbering changes to the various event-config.h files which have been customized
       
    29  over time to avoid various build bustages.
       
    30 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
       
    31 --- a/ipc/chromium/src/third_party/libevent/linux/event2/event-config.h
       
    32 +++ b/ipc/chromium/src/third_party/libevent/linux/event2/event-config.h
       
    33 @@ -24,24 +24,28 @@
       
    34  /* #undef EVENT__DISABLE_THREAD_SUPPORT */
       
    35  
       
    36  /* Define to 1 if you have the `accept4' function. */
       
    37  #define EVENT__HAVE_ACCEPT4 1
       
    38  
       
    39  /* Define to 1 if you have the <afunix.h> header file. */
       
    40  /* #undef EVENT__HAVE_AFUNIX_H 1 */
       
    41  
       
    42 +#ifdef HAVE_ARC4RANDOM
       
    43  /* Define to 1 if you have the `arc4random' function. */
       
    44 -/* #undef EVENT__HAVE_ARC4RANDOM */
       
    45 +#define EVENT__HAVE_ARC4RANDOM 1
       
    46 +#endif
       
    47  
       
    48  /* Define to 1 if you have the `arc4random_addrandom' function. */
       
    49  /* #undef EVENT__HAVE_ARC4RANDOM_ADDRANDOM */
       
    50  
       
    51 +#ifdef HAVE_ARC4RANDOM_BUF
       
    52  /* Define to 1 if you have the `arc4random_buf' function. */
       
    53 -/* #undef EVENT__HAVE_ARC4RANDOM_BUF */
       
    54 +#define EVENT__HAVE_ARC4RANDOM_BUF 1
       
    55 +#endif
       
    56  
       
    57  /* Define to 1 if you have the <arpa/inet.h> header file. */
       
    58  #define EVENT__HAVE_ARPA_INET_H 1
       
    59  
       
    60  /* Define to 1 if you have the `clock_gettime' function. */
       
    61  #define EVENT__HAVE_CLOCK_GETTIME 1
       
    62  
       
    63  /* Define to 1 if you have the declaration of `CTL_KERN', and to 0 if you
       
    64 
       
    65 
       
    66 # HG changeset patch
       
    67 # User Mike Hommey <mh+mozilla@glandium.org>
       
    68 # Date 1660077764 0
       
    69 # Node ID a61813bd9f0a0048b84a2c56a77a06eb5e269ab2
       
    70 # Parent  970ebbe54477a0e518bfee8aeddf487ad9bd4365
       
    71 Bug 1782988 - Fix use of arc4random_buf use in ping.cpp. r=gsvelto
       
    72 
       
    73 The code was probably never built before glibc 2.36, because before
       
    74 that, only Android and some BSDs had arc4random_buf, but none of those
       
    75 actually built this code.
       
    76 
       
    77 Differential Revision: https://phabricator.services.mozilla.com/D154024
       
    78 
       
    79 diff --git a/toolkit/crashreporter/client/ping.cpp b/toolkit/crashreporter/client/ping.cpp
       
    80 --- a/toolkit/crashreporter/client/ping.cpp
       
    81 +++ b/toolkit/crashreporter/client/ping.cpp
       
    82 @@ -48,17 +48,17 @@ static string GenerateUUID() {
       
    83      return "";
       
    84    }
       
    85  
       
    86    CFUUIDBytes bytes = CFUUIDGetUUIDBytes(uuid);
       
    87    memcpy(&id, &bytes, sizeof(UUID));
       
    88  
       
    89    CFRelease(uuid);
       
    90  #elif defined(HAVE_ARC4RANDOM_BUF)  // Android, BSD, ...
       
    91 -  arc4random_buf(id, sizeof(UUID));
       
    92 +  arc4random_buf(&id, sizeof(UUID));
       
    93  #else                               // Linux
       
    94    int fd = open("/dev/urandom", O_RDONLY);
       
    95  
       
    96    if (fd == -1) {
       
    97      return "";
       
    98    }
       
    99  
       
   100    if (read(fd, &id, sizeof(UUID)) != sizeof(UUID)) {
       
   101