Date: Friday, April 15, 2022 @ 00:59:00 Author: foutrelis Revision: 1186414
Fix build with glibc 2.34 Added: electron11/trunk/breakpad-fix-for-non-constant-SIGSTKSZ.patch electron11/trunk/sandbox-build-if-glibc-2.34-dynamic-stack-size-is-en.patch electron11/trunk/std-max-fix.patch Modified: electron11/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:44:54 UTC (rev 1186413) +++ PKGBUILD 2022-04-15 00:59:00 UTC (rev 1186414) @@ -28,6 +28,7 @@ 'icu68.patch' 'v8-icu68.patch' 'v8-call-new-ListFormatter-createInstance.patch' + 'breakpad-fix-for-non-constant-SIGSTKSZ.patch' 'chromium-glibc-2.33.patch' 'chromium-harfbuzz-3.0.0.patch' 'skia-harfbuzz-3.0.0.patch' @@ -35,7 +36,9 @@ 'chromium-include-limits.patch' 'chromium-include-stddef.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' 'd62de64e2fd20a4811593cb2248bb476aebfadf5.patch' ) @@ -47,6 +50,7 @@ '38fb5218331d6e03915490dab64f7b8bf26833a581d1aaa02090437c67e9439c' '6e919c9712d8fe6c2918778df1f8c2ee0675a87a48be5d2aaa54e320703ced4b' '44ebcff050a1c849819d66399c14bd711801d0eb64f518d292d3d6efedce3b3a' + 'b4d28867c1fabde6c50a2cfa3f784730446c4d86e5191e0f0000fbf7b0f91ecf' '2fccecdcd4509d4c36af873988ca9dbcba7fdb95122894a9fdf502c33a1d7a4b' '7ce947944a139e66774dfc7249bf7c3069f07f83a0f1b2c1a1b14287a7e15928' 'c9ed1dbadaf4be6097e25bc5577b91751799befc2d0376b143e1bd10def5754e' @@ -54,7 +58,9 @@ 'de7090b3f449372dd721b64eb10a02d15a1018961def0b4f35d2c90167ded524' '2c76f4b2572ec9f065433199e0cfaf58a5cfc869920c6c851150e9bcfe4d6d2a' '771292942c0901092a402cc60ee883877a99fb804cb54d568c8c6c94565a48e1' + 'f910be9370c880de6e1d61cc30383c069e421d7acf406166e4fbfad324fc7d61' 'dd317f85e5abfdcfc89c6f23f4c8edbcdebdd5e083dcec770e5da49ee647d150' + 'c315dd56b354cf5ad3458e1edf397cc7b492fefe82138135a881206a82b9d9dc' '4f32b815349357ef1f17b36059cee588c994472b9754a194fff41ec21a93826b' '6aa5b18ae8fcc9c5bacf28dc5cb8bd06f04574087c951ec3bc3ae795a2cd696c' ) @@ -145,12 +151,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 ../icu68.patch patch -Np1 -d v8 <../v8-icu68.patch patch -Np1 -d v8 <../v8-call-new-ListFormatter-createInstance.patch @@ -161,7 +163,9 @@ patch -Np1 -d third_party/skia <../skia-harfbuzz-3.0.0.patch patch -Np1 -i ../chromium-include-limits.patch patch -Np1 -i ../chromium-include-stddef.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 -i ../std-max-fix.patch patch -Np1 -i ../d62de64e2fd20a4811593cb2248bb476aebfadf5.patch patch -Np1 -i ../use-system-libraries-in-node.patch patch -Np1 -i ../default_app-icon.patch # Icon from .desktop file 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:00 UTC (rev 1186414) @@ -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:00 UTC (rev 1186414) @@ -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:00 UTC (rev 1186414) @@ -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.