This is an automated email from the ASF dual-hosted git repository.

alexey pushed a commit to branch branch-1.18.x
in repository https://gitbox.apache.org/repos/asf/kudu.git

commit 6dacf166f50b3ea0f6a264eb062a9ca840e2440f
Author: Alexey Serbin <[email protected]>
AuthorDate: Sun Dec 29 11:26:31 2024 -0800

    [thirdparty] fix building breakpad with GCC13
    
    GCC13 (G++13) is the default system compiler on contemporary Linux OS
    flavors such as Ubuntu 24.04 LTS.  With this patch it's now possible
    to compile breakpad on Ubuntu 24.04 LTS.
    
    This patch picks up a few relevant patches from the breakpad's upstream
    repository [1].  Probably, it's time to refresh breakpad with the latest
    snapshot from [1] to bring in numerous fixes (especially for AArch64),
    but I think it's better doing so in a separate patch.
    
    [1] https://chromium.googlesource.com/breakpad/breakpad
    
    Change-Id: I95c1bb8a2361c94f40b8b76b7f57159946b15a15
    Reviewed-on: http://gerrit.cloudera.org:8080/22278
    Reviewed-by: Marton Greber <[email protected]>
    Tested-by: Marton Greber <[email protected]>
    Reviewed-by: Gabriella Lotz <[email protected]>
    (cherry picked from commit 5f977935d59b15f1b51622084ed748283f2db833)
    Reviewed-on: http://gerrit.cloudera.org:8080/22302
    Reviewed-by: Abhishek Chennaka <[email protected]>
    Tested-by: Alexey Serbin <[email protected]>
---
 thirdparty/download-thirdparty.sh                  |  8 +++--
 thirdparty/patches/breakpad-SIGSTKSZ-error.patch   | 30 +++++++++++++---
 thirdparty/patches/breakpad-fclose.patch           | 40 ++++++++++++++++++++++
 thirdparty/patches/breakpad-fread.patch            | 27 +++++++++++++++
 thirdparty/patches/breakpad-guid-creator.patch     | 23 +++++++++++++
 .../patches/breakpad-minidump-descriptor.patch     | 22 ++++++++++++
 6 files changed, 144 insertions(+), 6 deletions(-)

diff --git a/thirdparty/download-thirdparty.sh 
b/thirdparty/download-thirdparty.sh
index 93e4de518..18ce2cebb 100755
--- a/thirdparty/download-thirdparty.sh
+++ b/thirdparty/download-thirdparty.sh
@@ -369,14 +369,18 @@ fetch_and_patch \
  $BOOST_PATCHLEVEL \
  "patch -p0 < $TP_DIR/patches/boost-bootstrap.patch"
 
-BREAKPAD_PATCHLEVEL=3
+BREAKPAD_PATCHLEVEL=7
 fetch_and_patch \
  breakpad-${BREAKPAD_VERSION}.tar.gz \
  $BREAKPAD_SOURCE \
  $BREAKPAD_PATCHLEVEL \
  "patch -p1 < 
$TP_DIR/patches/breakpad-add-basic-support-for-dwz-dwarf-extension.patch" \
  "patch -p1 < $TP_DIR/patches/breakpad-syscall-rsp-clobber-fix.patch" \
- "patch -p0 < $TP_DIR/patches/breakpad-SIGSTKSZ-error.patch"
+ "patch -p1 < $TP_DIR/patches/breakpad-SIGSTKSZ-error.patch" \
+ "patch -p1 < $TP_DIR/patches/breakpad-fclose.patch" \
+ "patch -p1 < $TP_DIR/patches/breakpad-fread.patch" \
+ "patch -p1 < $TP_DIR/patches/breakpad-minidump-descriptor.patch" \
+ "patch -p1 < $TP_DIR/patches/breakpad-guid-creator.patch"
 
 SPARSEHASH_PATCHLEVEL=3
 fetch_and_patch \
diff --git a/thirdparty/patches/breakpad-SIGSTKSZ-error.patch 
b/thirdparty/patches/breakpad-SIGSTKSZ-error.patch
index 0045a4dc6..cc6448dd4 100644
--- a/thirdparty/patches/breakpad-SIGSTKSZ-error.patch
+++ b/thirdparty/patches/breakpad-SIGSTKSZ-error.patch
@@ -1,11 +1,33 @@
---- src/client/linux/handler/exception_handler.cc      2022-04-01 
18:31:33.463554421 +0200
-+++ src/client/linux/handler/exception_handler.cc      2022-04-01 
18:32:20.503739341 +0200
-@@ -138,7 +138,7 @@
+commit 605c51ed96ad44b34c457bbca320e74e194c317e
+Author: David Faure <[email protected]>
+Date:   Wed Dec 15 22:26:40 2021 +0100
+
+    Fix for non-constant SIGSTKSZ
+    
+    On glibc > 2.33, `SIGSTKSZ` might not be constant (in which case
+    it expands to a call to `sysconf` which returns a `long int`); see
+    https://sourceware.org/pipermail/libc-alpha/2020-October/118513.html
+    
+    Pass unsigned explicitly to std::max, to avoid relying on template
+    argument deduction. This works both with the old-style constant
+    `SIGSTKSZ` and the new configurable one.
+    
+    Initially based on https://chromium-review.googlesource.com/c/2776379
+    
+    Change-Id: I9fc95337f973e871b84735ce822b5e11ba73ea8c
+    Reviewed-on: 
https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3340721
+    Reviewed-by: Mark Mentovai <[email protected]>
+
+diff --git a/src/client/linux/handler/exception_handler.cc 
b/src/client/linux/handler/exception_handler.cc
+index ca353c40..499be0a9 100644
+--- a/src/client/linux/handler/exception_handler.cc
++++ b/src/client/linux/handler/exception_handler.cc
+@@ -138,7 +138,7 @@ void InstallAlternateStackLocked() {
    // SIGSTKSZ may be too small to prevent the signal handlers from overrunning
    // the alternative stack. Ensure that the size of the alternative stack is
    // large enough.
 -  static const unsigned kSigStackSize = std::max(16384, SIGSTKSZ);
-+  static const unsigned kSigStackSize = std::max(16384u, (unsigned)SIGSTKSZ);
++  const unsigned kSigStackSize = std::max<unsigned>(16384, SIGSTKSZ);
  
    // Only set an alternative stack if there isn't already one, or if the 
current
    // one is too small.
diff --git a/thirdparty/patches/breakpad-fclose.patch 
b/thirdparty/patches/breakpad-fclose.patch
new file mode 100644
index 000000000..b1cb90af4
--- /dev/null
+++ b/thirdparty/patches/breakpad-fclose.patch
@@ -0,0 +1,40 @@
+commit 30c7f3cfc11cdbf93a12efbe9d46c66d9785879e
+Author: Lei Zhang <[email protected]>
+Date:   Tue Sep 6 08:00:52 2022 -0700
+
+    Fix some Coverity defects.
+    
+    Fix a few issues Coverity detected in exploitability_linux.cc:
+    
+    CID 277681, 277682, 277683
+    
+    Change-Id: I8ad0581f075da7346b9be8100b3690555a358b16
+    Reviewed-on: 
https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3872234
+    Reviewed-by: Mike Frysinger <[email protected]>
+
+diff --git a/src/processor/exploitability_linux.cc 
b/src/processor/exploitability_linux.cc
+index d4900bb0..c54cb046 100644
+--- a/src/processor/exploitability_linux.cc
++++ b/src/processor/exploitability_linux.cc
+@@ -518,18 +518,17 @@ bool ExploitabilityLinux::DisassembleBytes(const string& 
architecture,
+            raw_bytes_tmpfile);
+   FILE* objdump_fp = popen(cmd, "r");
+   if (!objdump_fp) {
+-    fclose(objdump_fp);
+     unlink(raw_bytes_tmpfile);
+     BPLOG(ERROR) << "Failed to call objdump.";
+     return false;
+   }
+-  if (fread(objdump_output_buffer, 1, buffer_len, objdump_fp) <= 0) {
+-    fclose(objdump_fp);
++  if (fread(objdump_output_buffer, 1, buffer_len, objdump_fp) != buffer_len) {
++    pclose(objdump_fp);
+     unlink(raw_bytes_tmpfile);
+     BPLOG(ERROR) << "Failed to read objdump output.";
+     return false;
+   }
+-  fclose(objdump_fp);
++  pclose(objdump_fp);
+   unlink(raw_bytes_tmpfile);
+   return true;
+ }
diff --git a/thirdparty/patches/breakpad-fread.patch 
b/thirdparty/patches/breakpad-fread.patch
new file mode 100644
index 000000000..ef90db077
--- /dev/null
+++ b/thirdparty/patches/breakpad-fread.patch
@@ -0,0 +1,27 @@
+commit 00f76018ccb4d27265d92a993f5443ae2a8d043c
+Author: Lei Zhang <[email protected]>
+Date:   Wed Sep 7 09:38:41 2022 -0700
+
+    Fix fread() check in ExploitabilityLinux.
+    
+    This fread() call did not intend to always fill the buffer, so the
+    change in https://crrev.com/c/3872234 is incorrect. Revert that one line
+    change.
+    
+    Change-Id: I3fbe38fce11c24aa77b39dc229c7c5ed2a8d6960
+    Reviewed-on: 
https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3879289
+    Reviewed-by: Mike Frysinger <[email protected]>
+
+diff --git a/src/processor/exploitability_linux.cc 
b/src/processor/exploitability_linux.cc
+index c54cb046..bc1b0b08 100644
+--- a/src/processor/exploitability_linux.cc
++++ b/src/processor/exploitability_linux.cc
+@@ -522,7 +522,7 @@ bool ExploitabilityLinux::DisassembleBytes(const string& 
architecture,
+     BPLOG(ERROR) << "Failed to call objdump.";
+     return false;
+   }
+-  if (fread(objdump_output_buffer, 1, buffer_len, objdump_fp) != buffer_len) {
++  if (fread(objdump_output_buffer, 1, buffer_len, objdump_fp) <= 0) {
+     pclose(objdump_fp);
+     unlink(raw_bytes_tmpfile);
+     BPLOG(ERROR) << "Failed to read objdump output.";
diff --git a/thirdparty/patches/breakpad-guid-creator.patch 
b/thirdparty/patches/breakpad-guid-creator.patch
new file mode 100644
index 000000000..95e4c53e5
--- /dev/null
+++ b/thirdparty/patches/breakpad-guid-creator.patch
@@ -0,0 +1,23 @@
+commit 4beee493f626ffd6d05d8d05e603df9ff3b8717b
+Author: Mike Frysinger <[email protected]>
+Date:   Sat Aug 3 10:37:57 2019 -0400
+
+    guid_creater: include string.h for memcpy
+    
+    Bug: google-breakpad:779
+    Change-Id: If0cfb036ee924178033c89d4dc3e2ce75ddd46f2
+    Reviewed-on: 
https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1732887
+    Reviewed-by: Mark Mentovai <[email protected]>
+
+diff --git a/src/common/linux/guid_creator.cc 
b/src/common/linux/guid_creator.cc
+index f81c2911..03e3d781 100644
+--- a/src/common/linux/guid_creator.cc
++++ b/src/common/linux/guid_creator.cc
+@@ -39,6 +39,7 @@
+ #include <pthread.h>
+ #include <stdio.h>
+ #include <stdlib.h>
++#include <string.h>
+ #include <sys/stat.h>
+ #include <time.h>
+ #include <unistd.h>
diff --git a/thirdparty/patches/breakpad-minidump-descriptor.patch 
b/thirdparty/patches/breakpad-minidump-descriptor.patch
new file mode 100644
index 000000000..5bafdb824
--- /dev/null
+++ b/thirdparty/patches/breakpad-minidump-descriptor.patch
@@ -0,0 +1,22 @@
+commit 7ea7ded187b4d739239f3ab7082fcd5a2ccc1eaa
+Author: mingtaoxt xt <[email protected]>
+Date:   Wed Oct 19 19:36:13 2022 +0800
+
+    mainline version gcc-13 cannot use "uintptr_t" via "#include <string>"
+    
+    Change-Id: I0049bb92658b4226e32783ad4d8271787deef5f3
+    Reviewed-on: 
https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3964166
+    Reviewed-by: Mike Frysinger <[email protected]>
+
+diff --git a/src/client/linux/handler/minidump_descriptor.h 
b/src/client/linux/handler/minidump_descriptor.h
+index 4349b88f..d822c9d9 100644
+--- a/src/client/linux/handler/minidump_descriptor.h
++++ b/src/client/linux/handler/minidump_descriptor.h
+@@ -32,6 +32,7 @@
+ #include <assert.h>
+ #include <sys/types.h>
+ 
++#include <cstdint>
+ #include <string>
+ 
+ #include "client/linux/handler/microdump_extra_info.h"

Reply via email to