Date: Friday, April 15, 2022 @ 00:59:02 Author: foutrelis Revision: 1186416
Fix build with glibc 2.34 Added: electron9/trunk/breakpad-fix-for-non-constant-SIGSTKSZ.patch electron9/trunk/sandbox-build-if-glibc-2.34-dynamic-stack-size-is-en.patch electron9/trunk/std-max-fix.patch Modified: electron9/trunk/PKGBUILD ------------------------------------------------------------+ PKGBUILD | 14 ++- breakpad-fix-for-non-constant-SIGSTKSZ.patch | 35 +++++++++ sandbox-build-if-glibc-2.34-dynamic-stack-size-is-en.patch | 39 +++++++++++ std-max-fix.patch | 11 +++ 4 files changed, 94 insertions(+), 5 deletions(-) Modified: PKGBUILD =================================================================== --- PKGBUILD 2022-04-15 00:59:01 UTC (rev 1186415) +++ PKGBUILD 2022-04-15 00:59:02 UTC (rev 1186416) @@ -27,6 +27,7 @@ 'use-system-libraries-in-node.patch' 'add-missing-algorithm-header-in-crx_install_error.cc.patch' 'avoid-double-destruction-of-ServiceWorkerObjectHost.patch' + 'breakpad-fix-for-non-constant-SIGSTKSZ.patch' 'chromium-83-gcc-10.patch' 'chromium-ffmpeg-4.3.patch' 'qt5-webengine-glibc-2.33.patch' @@ -34,7 +35,9 @@ 'skia-harfbuzz-3.0.0.patch' 'chromium-include-limits.patch' 'chromium-skia-harmony.patch' + 'sandbox-build-if-glibc-2.34-dynamic-stack-size-is-en.patch' 'sql-make-VirtualCursor-standard-layout-type.patch' + 'std-max-fix.patch' 'ffmpeg5.patch' 'disk_data_allocator-Metadata-constructor.patch' 'clean-up-a-call-to-set_utf8.patch' @@ -52,6 +55,7 @@ 'c7eadac877179e586d0cce7f898aa1462b4c207733e68ecc17de9754b691713a' '0e2a78e4aa7272ab0ff4a4c467750e01bad692a026ad9828aaf06d2a9418b9d8' 'd793842e9584bf75e3779918297ba0ffa6dd05394ef5b2bf5fb73aa9c86a7e2f' + 'b4d28867c1fabde6c50a2cfa3f784730446c4d86e5191e0f0000fbf7b0f91ecf' '3e5ba8c0a70a4bc673deec0c61eb2b58f05a4c784cbdb7c8118be1eb6580db6d' '5390304b5f544868985ce00a3ec082d4ece2dacb1c73cdb35dd4facfea12449a' '5600cfa40254fa3fa2cb541d3b55cc8f7a9231de8d2830c25a7651aa392de16f' @@ -59,7 +63,9 @@ 'fffbdd7479292462a1b4e3846c610ee5a0f0d409ded11426f21dd47051604dfd' 'cb8e4c347169f145d2f08329e25125eb2a3682bfc3530c674cf1ffad89431bdf' '771292942c0901092a402cc60ee883877a99fb804cb54d568c8c6c94565a48e1' + 'f910be9370c880de6e1d61cc30383c069e421d7acf406166e4fbfad324fc7d61' 'dd317f85e5abfdcfc89c6f23f4c8edbcdebdd5e083dcec770e5da49ee647d150' + 'c315dd56b354cf5ad3458e1edf397cc7b492fefe82138135a881206a82b9d9dc' '4f32b815349357ef1f17b36059cee588c994472b9754a194fff41ec21a93826b' '52a63a84a10dc501a0712a76170cfa12abc02ed4efe93486a1e6139b1670f90c' '58c41713eb6fb33b6eef120f4324fa1fb8123b1fbc4ecbe5662f1f9779b9b6af' @@ -151,12 +157,8 @@ echo "Applying local patches..." + patch -Np1 -d third_party/breakpad/breakpad < ../breakpad-fix-for-non-constant-SIGSTKSZ.patch patch -Np1 -i ../ffmpeg5.patch - # Patches to build with ffmpeg 4.4; remove when ffmpeg 5.0 moves to stable - if ! pkg-config --atleast-version 59 libavformat; then - patch -Rp1 -i ../ffmpeg5.patch - fi - patch -Np1 -i ../add-missing-algorithm-header-in-crx_install_error.cc.patch patch -Np1 -i ../avoid-double-destruction-of-ServiceWorkerObjectHost.patch patch -Np1 -i ../chromium-83-gcc-10.patch @@ -163,7 +165,9 @@ patch -Np1 -i ../chromium-ffmpeg-4.3.patch patch -Np1 -i ../chromium-include-limits.patch patch -Np0 -i ../chromium-skia-harmony.patch + patch -Np1 -i ../sandbox-build-if-glibc-2.34-dynamic-stack-size-is-en.patch patch -Np1 -i ../sql-make-VirtualCursor-standard-layout-type.patch + patch -Np1 -F3 -i ../std-max-fix.patch patch -Np0 -i ../disk_data_allocator-Metadata-constructor.patch patch -Np4 -i ../qt5-webengine-glibc-2.33.patch patch -Np1 -i ../chromium-harfbuzz-3.0.0.patch Added: breakpad-fix-for-non-constant-SIGSTKSZ.patch =================================================================== --- breakpad-fix-for-non-constant-SIGSTKSZ.patch (rev 0) +++ breakpad-fix-for-non-constant-SIGSTKSZ.patch 2022-04-15 00:59:02 UTC (rev 1186416) @@ -0,0 +1,35 @@ +From 605c51ed96ad44b34c457bbca320e74e194c317e Mon Sep 17 00:00:00 2001 +From: David Faure <david.fa...@kdab.com> +Date: Wed, 15 Dec 2021 22:26:40 +0100 +Subject: [PATCH] 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 <m...@chromium.org> +--- + src/client/linux/handler/exception_handler.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +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); ++ 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. Added: sandbox-build-if-glibc-2.34-dynamic-stack-size-is-en.patch =================================================================== --- sandbox-build-if-glibc-2.34-dynamic-stack-size-is-en.patch (rev 0) +++ sandbox-build-if-glibc-2.34-dynamic-stack-size-is-en.patch 2022-04-15 00:59:02 UTC (rev 1186416) @@ -0,0 +1,39 @@ +From 28ac6a15411d01301e171b8a8b0019abd57589b9 Mon Sep 17 00:00:00 2001 +From: Stephan Hartmann <sth...@googlemail.com> +Date: Mon, 7 Feb 2022 20:09:57 +0000 +Subject: [PATCH] sandbox: build if glibc 2.34+ dynamic stack size is enabled +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Compilation of sandbox fails when using dynamic stack size in glibc +2.34 or newer. This is because the value is not a literal anymore but +obtained through sysconf. + +To avoid this, use memset to put zeros in the buffer. + +Change-Id: Ia479e0f799b77a10a00197aaaa0500e62546f458 +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3436947 +Reviewed-by: Jorge Lucangeli Obes <jorg...@chromium.org> +Commit-Queue: José Dapena Paz <jdap...@igalia.com> +Cr-Commit-Position: refs/heads/main@{#967943} +--- + sandbox/linux/services/credentials.cc | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/sandbox/linux/services/credentials.cc b/sandbox/linux/services/credentials.cc +index ca6b5954798..c933eafd163 100644 +--- a/sandbox/linux/services/credentials.cc ++++ b/sandbox/linux/services/credentials.cc +@@ -100,7 +100,10 @@ bool ChrootToSafeEmptyDir() { + // TODO(crbug.com/1247458) Broken in MSan builds after LLVM f1bb30a4956f. + clone_flags |= CLONE_VM | CLONE_VFORK | CLONE_SETTLS; + +- char tls_buf[PTHREAD_STACK_MIN] = {0}; ++ // PTHREAD_STACK_MIN can be dynamic in glibc2.34+, so it is not possible to ++ // zeroify tls_buf assigning { 0 } ++ char tls_buf[PTHREAD_STACK_MIN]; ++ memset(tls_buf, 0, PTHREAD_STACK_MIN); + tls = tls_buf; + #endif + Added: std-max-fix.patch =================================================================== --- std-max-fix.patch (rev 0) +++ std-max-fix.patch 2022-04-15 00:59:02 UTC (rev 1186416) @@ -0,0 +1,11 @@ +--- a/third_party/abseil-cpp/absl/debugging/failure_signal_handler.cc ++++ b/third_party/abseil-cpp/absl/debugging/failure_signal_handler.cc +@@ -136,7 +136,7 @@ + #else + const size_t page_mask = sysconf(_SC_PAGESIZE) - 1; + #endif +- size_t stack_size = (std::max(SIGSTKSZ, 65536) + page_mask) & ~page_mask; ++ size_t stack_size = (std::max<unsigned>(SIGSTKSZ, 65536) + page_mask) & ~page_mask; + #if defined(ABSL_HAVE_ADDRESS_SANITIZER) || \ + defined(ABSL_HAVE_MEMORY_SANITIZER) || defined(ABSL_HAVE_THREAD_SANITIZER) + // Account for sanitizer instrumentation requiring additional stack space.