dev-cpp/gtest: Fix test failure on sparc64
authorPeter Levine <plevine457@gmail.com>
Tue, 20 Aug 2019 05:56:41 +0000 (01:56 -0400)
committerJoonas Niilola <juippis@gentoo.org>
Wed, 21 Aug 2019 05:06:55 +0000 (08:06 +0300)
sparc64 exhibits the same usersandbox stack overflow bug and its stack can
apparently grow upwards in memory.  Revert back to allocating 10 pages of
mapped memory for the offending call to clone().

Bug: https://bugs.gentoo.org/692464
Reported-by: Rolf Eike Beer <gentoo-bug@opensource.sf-tec.de>
Package-Manager: Portage-2.3.71, Repoman-2.3.17
Signed-off-by: Peter Levine <plevine457@gmail.com>
Signed-off-by: Joonas Niilola <juippis@gentoo.org>
dev-cpp/gtest/files/gtest-1.9.0_pre20190607-add-mmap-stack-flag.patch [deleted file]
dev-cpp/gtest/files/gtest-1.9.0_pre20190607-increase-clone-stack-size.patch [new file with mode: 0755]
dev-cpp/gtest/gtest-1.9.0_pre20190607.ebuild
dev-cpp/gtest/gtest-9999.ebuild

diff --git a/dev-cpp/gtest/files/gtest-1.9.0_pre20190607-add-mmap-stack-flag.patch b/dev-cpp/gtest/files/gtest-1.9.0_pre20190607-add-mmap-stack-flag.patch
deleted file mode 100644 (file)
index 9a840aa..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-Bug: https://bugs.gentoo.org/688162
-Upstream PR: https://github.com/google/googletest/pull/2276
-
---- a/googletest/src/gtest-death-test.cc
-+++ b/googletest/src/gtest-death-test.cc
-@@ -1357,6 +1357,9 @@ static pid_t ExecDeathTestSpawnChild(char* const* argv, int close_fd) {
-     const auto stack_size = static_cast<size_t>(getpagesize());
-     // MMAP_ANONYMOUS is not defined on Mac, so we use MAP_ANON instead.
-     void* const stack = mmap(nullptr, stack_size, PROT_READ | PROT_WRITE,
-+#    if GTEST_OS_LINUX
-+                             (stack_grows_down ? MAP_GROWSDOWN : 0) | // Needed for stack auto-resizing
-+#    endif
-                              MAP_ANON | MAP_PRIVATE, -1, 0);
-     GTEST_DEATH_TEST_CHECK_(stack != MAP_FAILED);
diff --git a/dev-cpp/gtest/files/gtest-1.9.0_pre20190607-increase-clone-stack-size.patch b/dev-cpp/gtest/files/gtest-1.9.0_pre20190607-increase-clone-stack-size.patch
new file mode 100755 (executable)
index 0000000..38d515a
--- /dev/null
@@ -0,0 +1,13 @@
+Bug: https://bugs.gentoo.org/692464
+
+--- a/googletest/src/gtest-death-test.cc
++++ b/googletest/src/gtest-death-test.cc
+@@ -1070,7 +1070,7 @@
+   if (!use_fork) {
+     static const bool stack_grows_down = StackGrowsDown();
+-    const auto stack_size = static_cast<size_t>(getpagesize());
++    const auto stack_size = static_cast<size_t>(getpagesize()* 10);
+     // MMAP_ANONYMOUS is not defined on Mac, so we use MAP_ANON instead.
+     void* const stack = mmap(NULL, stack_size, PROT_READ | PROT_WRITE,
+                              MAP_ANON | MAP_PRIVATE, -1, 0);
index 923d9a16c2210807a83c2e0589089b2336ab9660..d79d6b7dd5829207a7357ac58ec96f26e0826148 100644 (file)
@@ -35,7 +35,7 @@ DEPEND="test? ( ${PYTHON_DEPS} )"
 RDEPEND="!dev-cpp/gmock"
 
 PATCHES=(
-       "${FILESDIR}"/${PN}-1.9.0_pre20190607-add-mmap-stack-flag.patch
+       "${FILESDIR}"/${PN}-1.9.0_pre20190607-increase-clone-stack-size.patch
 )
 
 pkg_setup() {
index bd677dc0bd1db674df9fcd5be8e3258cce01104b..02ca3c039b1a34bafbc0390232bb5b66242df467 100644 (file)
@@ -33,7 +33,7 @@ DEPEND="test? ( ${PYTHON_DEPS} )"
 RDEPEND="!dev-cpp/gmock"
 
 PATCHES=(
-       "${FILESDIR}"/${PN}-1.9.0_pre20190607-add-mmap-stack-flag.patch
+       "${FILESDIR}"/${PN}-1.9.0_pre20190607-increase-clone-stack-size.patch
 )
 
 pkg_setup() {