Skip to contentSkip to conversation

mongodb: Do not use MINSIGSTKSZ

PATCH New Khem Raj 1 participant 3 messages May 12, 2021

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/3 mongodb: Do not use MINSIGSTKSZ

glibc 2.34 has made MINSIGSTKSZ non-constant

---
 .../mongodb/0001-Do-not-use-MINSIGSTKSZ.patch | 34 +++++++++++++++++++
 .../recipes-dbs/mongodb/mongodb_git.bb        |  1 +
 2 files changed, 35 insertions(+)
 create mode 100644 meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-Do-not-use-MINSIGSTKSZ.patch
meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-Do-not-use-MINSIGSTKSZ.patch new file +34 -0
new file mode 100644
index 0000000000..0ee64e9c6c
@@ -0,0 +1,34 @@
+From 027044a692b588ef586d495f65eb58b07cc711a3 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Tue, 11 May 2021 10:15:51 -0700
+Subject: [PATCH] Do not use MINSIGSTKSZ
+
+Since glibc 2.34+ MINSIGSTKSZ is no more a constant.  So,
+let's hardwire this for now until better fix is found.
+64Kb should be good anyway
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <[email protected]>
+---
+ src/mongo/stdx/thread.h | 5 +----
+ 1 file changed, 1 insertion(+), 4 deletions(-)
+
+diff --git a/src/mongo/stdx/thread.h b/src/mongo/stdx/thread.h
+index f8058279e3..f31f309959 100644
+--- a/src/mongo/stdx/thread.h
++++ b/src/mongo/stdx/thread.h
+@@ -104,10 +104,7 @@ private:
+     //   .                     N   Y :      4,344 |  13,048 |     7,352
+     //   .                     Y   Y :      4,424 |  13,672 |     8,392
+     //   ( https://jira.mongodb.org/secure/attachment/233569/233569_stacktrace-writeup.txt )
+-    static constexpr std::size_t kMongoMinSignalStackSize = std::size_t{64} << 10;
+-
+-    static constexpr std::size_t kStackSize =
+-        std::max(kMongoMinSignalStackSize, std::size_t{MINSIGSTKSZ});
++    static constexpr std::size_t kStackSize = std::size_t{64} << 10;
+     std::unique_ptr<std::byte[]> _stackStorage = std::make_unique<std::byte[]>(kStackSize);
+ 
+ #else   // !MONGO_HAS_SIGALTSTACK
+-- 
+2.31.1
+
meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb_git.bb +1 -0
index 54178bf75a..cfa2bc18c2 100644
@@ -29,6 +29,7 @@ SRC_URI = "git://github.com/mongodb/mongo.git;branch=v4.4 \
            file://0001-include-needed-c-header.patch \
            file://disable_runtime_check.patch \
            file://ppc64_ARCH_BITS.patch \
+           file://0001-Do-not-use-MINSIGSTKSZ.patch \
            "
 SRC_URI_append_libc-musl ="\
            file://0001-Mark-one-of-strerror_r-implementation-glibc-specific.patch \
Signature · 1 line
2.31.1
author
#1 lore raw

PATCH 2/3 tbb: Fix build with GCC 11

---
 ...f_input-Use-an-arbitrary-but-valid-p.patch | 37 +++++++++++++++++++
 meta-oe/recipes-support/tbb/tbb_2021.2.0.bb   |  1 +
 2 files changed, 38 insertions(+)
 create mode 100644 meta-oe/recipes-support/tbb/tbb/0001-set_my_tls_end_of_input-Use-an-arbitrary-but-valid-p.patch
meta-oe/recipes-support/tbb/tbb/0001-set_my_tls_end_of_input-Use-an-arbitrary-but-valid-p.patch new file +37 -0
new file mode 100644
index 0000000000..caa68e64c5
@@ -0,0 +1,37 @@
+From a996fd451bbd7be93cff5f466bff7282ae972fe1 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Tue, 11 May 2021 10:52:51 -0700
+Subject: [PATCH] set_my_tls_end_of_input: Use an arbitrary but valid pointer
+ as value
+
+Pass a valid pointer to pthread_setspecific to avoid GCC 11 warning.
+Fixes
+
+src/tbb/tls.h:44:46: error: 'int pthread_setspecific(pthread_key_t, const void*)' expecting 1 byte in a region of size 0 [-Werror=stringop-overread]
+|    44 |     void set( T value ) { pthread_setspecific(my_key, (void*)value); }
+|       |                           ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
+| compilation terminated due to -Wfatal-errors.
+
+Upstream-Status: Submitted [https://github.com/oneapi-src/oneTBB/pull/394]
+Signed-off-by: Khem Raj <[email protected]>
+---
+ src/tbb/parallel_pipeline.cpp | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/tbb/parallel_pipeline.cpp b/src/tbb/parallel_pipeline.cpp
+index b7655c6b..ca518b5b 100644
+--- a/src/tbb/parallel_pipeline.cpp
++++ b/src/tbb/parallel_pipeline.cpp
+@@ -243,7 +243,8 @@ public:
+         return end_of_input_tls.get() != 0;
+     }
+     void set_my_tls_end_of_input() {
+-        end_of_input_tls.set(1);
++	// Use an arbitrary but valid pointer as value.
++        end_of_input_tls.set(array_size);
+     }
+ };
+ 
+-- 
+2.31.1
+
meta-oe/recipes-support/tbb/tbb_2021.2.0.bb +1 -0
index 771ddd49b8..f4c52daf41 100644
@@ -18,6 +18,7 @@ SRC_URI = "git://github.com/oneapi-src/oneTBB.git;protocol=https;branch=${BRANCH
             file://GLIBC-PREREQ-is-not-defined-on-musl.patch \
             file://0001-CMakeLists.txt-exclude-riscv64-riscv32.patch \
             file://0001-Disable-use-of-_tpause-instruction.patch \
+            file://0001-set_my_tls_end_of_input-Use-an-arbitrary-but-valid-p.patch \
 "
 
 S = "${WORKDIR}/git"
Signature · 1 line
2.31.1
author
#2 lore raw

PATCH 3/3 breakpad: Fix type mismatch for SIGSTKSZ

In reply to Khem Raj
---
 ...dler.cc-Match-the-types-for-SIGSTKSZ.patch | 34 +++++++++++++++++++
 .../recipes-devtools/breakpad/breakpad_git.bb |  1 +
 2 files changed, 35 insertions(+)
 create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0001-exception_handler.cc-Match-the-types-for-SIGSTKSZ.patch
meta-oe/recipes-devtools/breakpad/breakpad/0001-exception_handler.cc-Match-the-types-for-SIGSTKSZ.patch new file +34 -0
new file mode 100644
index 0000000000..afe8a61b29
@@ -0,0 +1,34 @@
+From 66a2b6e4ba8e2b49115043127ce4aa0fcd71ad1e Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Tue, 11 May 2021 11:12:35 -0700
+Subject: [PATCH] exception_handler.cc: Match the types for SIGSTKSZ
+
+In glibc 2.34, SIGSTKSZ is a syscall which returns a long int, therefore
+current check fails
+
+| ../git/src/client/linux/handler/exception_handler.cc:141:49: error: no matching function for call to 'max(int, long int)'
+|   141 |   static const unsigned kSigStackSize = std::max(16384, SIGSTKSZ);
+|       |                                         ~~~~~~~~^~~~~~~~~~~~~~~~~
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <[email protected]>
+---
+ 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..dc0fc4a9 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);
+ 
+   // Only set an alternative stack if there isn't already one, or if the current
+   // one is too small.
+-- 
+2.31.1
+
meta-oe/recipes-devtools/breakpad/breakpad_git.bb +1 -0
index 81955f450d..4756ef772d 100644
@@ -40,6 +40,7 @@ SRC_URI = "git://github.com/google/breakpad;name=breakpad;branch=main \
            file://0004-elf_reader.cc-include-sys-reg.h-to-get-__WORDSIZE-on.patch \
            file://mcontext.patch \
            file://0001-Remove-HAVE_GETCONTEXT-check-to-add-local-implementa.patch \
+           file://0001-exception_handler.cc-Match-the-types-for-SIGSTKSZ.patch \
            file://0001-lss-Match-syscalls-to-match-musl.patch;patchdir=src/third_party/lss \
            file://mips_asm_sgidefs.patch;patchdir=src/third_party/lss \
            file://0001-Do-not-add-stack-pointer-to-clobber-list.patch;patchdir=src/third_party/lss \
Signature · 1 line
2.31.1