diff options
author | Paul Lawrence <paullawrence@google.com> | 2017-03-08 10:29:51 -0800 |
---|---|---|
committer | Paul Lawrence <paullawrence@google.com> | 2017-03-14 15:32:02 -0700 |
commit | 1a370139d15a12580e66cbf3c594b554e8ba801c (patch) | |
tree | a0e359ac06de085ee6ef7050ea7e0c4f7477ee1b | |
parent | 609352cc3a45ead8b6f9d85b39c7ab9c998c7caa (diff) | |
download | seccomp-tests-1a370139d15a12580e66cbf3c594b554e8ba801c.tar.gz |
Fix CTS test
The FIXTURE_TEARDOWN joins even though the tests join, which with
https://android-review.googlesource.com/#/c/338029/ is a fatal error.
Mark the threads joined in the tests.
Bug: 35809266
Test: SeccompTest#testKernelTSYNCTests now passes
Change-Id: I28f926a3cc8f14fe8e11ef7c378723f916bcdf93
-rw-r--r-- | README.google | 1 | ||||
-rw-r--r-- | linux/seccomp_bpf.c | 8 |
2 files changed, 9 insertions, 0 deletions
diff --git a/README.google b/README.google index 1f0ac50..54ffc04 100644 --- a/README.google +++ b/README.google @@ -10,3 +10,4 @@ Local Modifications: - Use __android_log_print() instead of fprintf() - Rename main() to seccomp_test_main() - Add get_seccomp_test_list() +- Fix pthread_join bug (https://android-review.googlesource.com/#/c/349407) diff --git a/linux/seccomp_bpf.c b/linux/seccomp_bpf.c index e0558fd..6f5b786 100644 --- a/linux/seccomp_bpf.c +++ b/linux/seccomp_bpf.c @@ -1845,8 +1845,10 @@ TEST_F(TSYNC, two_siblings_with_ancestor) /* Ensure they are both killed and don't exit cleanly. */ pthread_join(self->sibling[0].tid, &status); EXPECT_EQ(0x0, (long)status); + self->sibling[0].tid = 0; pthread_join(self->sibling[1].tid, &status); EXPECT_EQ(0x0, (long)status); + self->sibling[1].tid = 0; } TEST_F(TSYNC, two_sibling_want_nnp) @@ -1911,8 +1913,10 @@ TEST_F(TSYNC, two_siblings_with_no_filter) /* Ensure they are both killed and don't exit cleanly. */ pthread_join(self->sibling[0].tid, &status); EXPECT_EQ(0x0, (long)status); + self->sibling[0].tid = 0; pthread_join(self->sibling[1].tid, &status); EXPECT_EQ(0x0, (long)status); + self->sibling[1].tid = 0; } TEST_F(TSYNC, two_siblings_with_one_divergence) @@ -1956,8 +1960,10 @@ TEST_F(TSYNC, two_siblings_with_one_divergence) /* Ensure they are both unkilled. */ pthread_join(self->sibling[0].tid, &status); EXPECT_EQ(SIBLING_EXIT_UNKILLED, (long)status); + self->sibling[0].tid = 0; pthread_join(self->sibling[1].tid, &status); EXPECT_EQ(SIBLING_EXIT_UNKILLED, (long)status); + self->sibling[1].tid = 0; } TEST_F(TSYNC, two_siblings_not_under_filter) @@ -2015,6 +2021,7 @@ TEST_F(TSYNC, two_siblings_not_under_filter) pthread_mutex_unlock(&self->mutex); pthread_join(self->sibling[sib].tid, &status); EXPECT_EQ(SIBLING_EXIT_UNKILLED, (long)status); + self->sibling[sib].tid = 0; /* Poll for actual task death. pthread_join doesn't guarantee it. */ while (!kill(self->sibling[sib].system_tid, 0)) sleep(0.1); @@ -2040,6 +2047,7 @@ TEST_F(TSYNC, two_siblings_not_under_filter) pthread_mutex_unlock(&self->mutex); pthread_join(self->sibling[sib].tid, &status); EXPECT_EQ(0, (long)status); + self->sibling[sib].tid = 0; /* Poll for actual task death. pthread_join doesn't guarantee it. */ while (!kill(self->sibling[sib].system_tid, 0)) sleep(0.1); |