summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Levine <plevine457@gmail.com>2019-06-16 19:55:31 -0400
committerMichał Górny <mgorny@gentoo.org>2019-06-17 08:25:05 +0200
commitfac747ad8938ce04897dfe1d188260f42ce8b6cb (patch)
treec59b5e1bbb9153d6a17943504b437ab7d02e1823 /dev-cpp/gtest/files
parentdev-ruby/rmagick: install docs in correct location (diff)
downloadgentoo-fac747ad8938ce04897dfe1d188260f42ce8b6cb.tar.gz
gentoo-fac747ad8938ce04897dfe1d188260f42ce8b6cb.tar.bz2
gentoo-fac747ad8938ce04897dfe1d188260f42ce8b6cb.zip
dev-cpp/gtest: Fix segfault in googletest-death-test
Fixes call to mmap to include MAP_GROWSDOWN flag for stack auto-resizing. Reported-by: tka <tka@kamph.org> Tested-by: Arfrever Frehtes Taifersar Arahesis <arfrever.fta@gmail.com> Closes: https://bugs.gentoo.org/688162 Closes: https://github.com/gentoo/gentoo/pull/12271 Package-Manager: Portage-2.3.67, Repoman-2.3.14 Signed-off-by: Peter Levine <plevine457@gmail.com> Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-cpp/gtest/files')
-rw-r--r--dev-cpp/gtest/files/gtest-1.9.0_pre20190607-add-mmap-stack-flag.patch15
-rw-r--r--dev-cpp/gtest/files/gtest-9999-increase-clone-stack-size.patch14
2 files changed, 15 insertions, 14 deletions
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
new file mode 100644
index 00000000000..9a840aa5876
--- /dev/null
+++ b/dev-cpp/gtest/files/gtest-1.9.0_pre20190607-add-mmap-stack-flag.patch
@@ -0,0 +1,15 @@
+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-9999-increase-clone-stack-size.patch b/dev-cpp/gtest/files/gtest-9999-increase-clone-stack-size.patch
deleted file mode 100644
index 5e4dc47f704..00000000000
--- a/dev-cpp/gtest/files/gtest-9999-increase-clone-stack-size.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-Bug: https://bugs.gentoo.org/629620
-Upstream PR: https://github.com/google/googletest/pull/2276
-
---- a/googletest/src/gtest-death-test.cc
-+++ b/googletest/src/gtest-death-test.cc
-@@ -1354,7 +1354,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() * 8);
- // MMAP_ANONYMOUS is not defined on Mac, so we use MAP_ANON instead.
- void* const stack = mmap(nullptr, stack_size, PROT_READ | PROT_WRITE,
- MAP_ANON | MAP_PRIVATE, -1, 0);