diff options
author | Ryan Prichard <rprichard@google.com> | 2018-04-03 20:46:11 -0700 |
---|---|---|
committer | Ryan Prichard <rprichard@google.com> | 2018-04-03 21:57:24 -0700 |
commit | a1bc826c375c25a4b385fa724c580838635fa262 (patch) | |
tree | 19a43e95d30d81634330cd8cb9c6138ca427c3a6 /tests/spawn_test.cpp | |
parent | 6c3f97d2360ba1a2b2be160003fa3b4dd7b33ae1 (diff) |
Fix race in spawn.signal_stress test
The default behavior for a real-time signal is to terminate the process.
If the child we fork sends a SIGRTMIN signal before we've set up the
ScopedSignalHandler for it, then the parent is terminated.
Test: adb shell /data/nativetest64/bionic-unit-tests-static/bionic-unit-tests-static --gtest_filter=spawn.signal_stress --gtest_repeat=1000
Bug: b/77554047
Change-Id: Ib44cbea8ccf506644405d8f426d9ad24e77cfa33
Diffstat (limited to 'tests/spawn_test.cpp')
-rw-r--r-- | tests/spawn_test.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/spawn_test.cpp b/tests/spawn_test.cpp index 86175f927..7e45ec3d1 100644 --- a/tests/spawn_test.cpp +++ b/tests/spawn_test.cpp @@ -433,12 +433,12 @@ TEST(spawn, signal_stress) { static pid_t parent = getpid(); setpgid(0, 0); + signal(SIGRTMIN, SIG_IGN); pid_t pid = fork(); ASSERT_NE(-1, pid); if (pid == 0) { - signal(SIGRTMIN, SIG_IGN); for (size_t i = 0; i < 1024; ++i) { kill(0, SIGRTMIN); usleep(10); |