Increase the stack size afforded to clone#1274
Closed
Peter-Levine wants to merge 2 commits intogoogle:masterfrom
Closed
Increase the stack size afforded to clone#1274Peter-Levine wants to merge 2 commits intogoogle:masterfrom
Peter-Levine wants to merge 2 commits intogoogle:masterfrom
Conversation
Increases the stack size in case the execve system call is wrapped in an environment requiring more stack than a single page.
Contributor
|
Sincere aplogies for the long wait. I see that the parent issues are closed now |
Contributor
Author
|
@gennadiycivil commit message for 4a09774 is |
|
The original version of this pull request contains this change: This change was never merged to master branch. As of now, the relevant line of code in master branch is: I assume that the forward-ported version of fix from this pull request would be: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When building googletest on Gentoo Linux,
gtest-death-test_testfails and causes a segfault in libsandbox, a sandbox environment used by the Gentoo portage build system. libsandbox works by being loaded through LD_PRELOAD and providing wrappers around potentially insecure system calls such asexecve. The segfault is caused because available stack space is exhausted in the wrapper's environment, causing a stack overflow.In 'googletest/src/gtest-death-test.cc', in
ExecDeathTestSpawnChild, only a page of memory is granted to clone() as stack space, presumably because it only has to executeExecDeathTestChildMainwhich contains the call toexecve. But because that call is wrapped in a library function offered by libsandbox, the stack gets exhausted before the actual call to the realexecveever occurs.Testing with a stack size equal to that of the parent process (139264 on my end; roughly 34 times the page size on my end) succeeded but is likely overkill. Testing with a stack size that is 5 times the page size still segfaulted. Testing with a stack size that is 10 times the pagesize succeeded.
See https://bugs.gentoo.org/629620 for details.