diff options
author | Craig Tiller <ctiller@google.com> | 2016-03-21 09:27:40 -0700 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2016-03-21 09:27:40 -0700 |
commit | 3c3763b8b67a580b51023178ec78fe152df742d4 (patch) | |
tree | e130357e62bbdc62ceb54ea1ce32755cbd0d8ce2 | |
parent | 255bbfdbe21a984d3629e594d7514736364f9549 (diff) | |
parent | f4e25643665f139ad8abd05d066f313e4f16a743 (diff) |
Merge branch 'make_clang_great_again_v2' of github.com:vjpai/grpc into fuzzy-bits
-rw-r--r-- | Makefile | 8 | ||||
-rw-r--r-- | build.yaml | 12 | ||||
-rw-r--r-- | src/core/iomgr/fd_posix.c | 9 | ||||
-rw-r--r-- | tools/run_tests/tests.json | 8 |
4 files changed, 18 insertions, 19 deletions
@@ -188,8 +188,8 @@ CC_tsan = clang CXX_tsan = clang++ LD_tsan = clang LDXX_tsan = clang++ -CPPFLAGS_tsan = -O0 -fsanitize=thread -fno-omit-frame-pointer -Wno-unused-command-line-argument -fPIE -pie -DGPR_NO_DIRECT_SYSCALLS -LDFLAGS_tsan = -fsanitize=thread -fPIE -pie +CPPFLAGS_tsan = -O0 -fsanitize=thread -fno-omit-frame-pointer -Wno-unused-command-line-argument -DGPR_NO_DIRECT_SYSCALLS +LDFLAGS_tsan = -fsanitize=thread DEFINES_tsan += GRPC_TEST_SLOWDOWN_BUILD_FACTOR=5 VALID_CONFIG_stapprof = 1 @@ -225,8 +225,8 @@ CC_etsan = clang CXX_etsan = clang++ LD_etsan = clang LDXX_etsan = clang++ -CPPFLAGS_etsan = -O0 -fsanitize=thread -fno-omit-frame-pointer -Wno-unused-command-line-argument -fPIE -pie -DGPR_NO_DIRECT_SYSCALLS -LDFLAGS_etsan = -fsanitize=thread -fPIE -pie +CPPFLAGS_etsan = -O0 -fsanitize=thread -fno-omit-frame-pointer -Wno-unused-command-line-argument -DGPR_NO_DIRECT_SYSCALLS +LDFLAGS_etsan = -fsanitize=thread DEFINES_etsan = _DEBUG DEBUG GRPC_EXECUTION_CONTEXT_SANITIZER DEFINES_etsan += GRPC_TEST_SLOWDOWN_BUILD_FACTOR=5 diff --git a/build.yaml b/build.yaml index db7b6562c9..d53fc4153f 100644 --- a/build.yaml +++ b/build.yaml @@ -2519,8 +2519,6 @@ targets: - gpr_test_util - gpr - grpc++_test_config - exclude_configs: - - tsan platforms: - mac - linux @@ -2540,8 +2538,6 @@ targets: - gpr_test_util - gpr - grpc++_test_config - exclude_configs: - - tsan platforms: - mac - linux @@ -2874,11 +2870,11 @@ configs: etsan: CC: clang CPPFLAGS: -O0 -fsanitize=thread -fno-omit-frame-pointer -Wno-unused-command-line-argument - -fPIE -pie -DGPR_NO_DIRECT_SYSCALLS + -DGPR_NO_DIRECT_SYSCALLS CXX: clang++ DEFINES: _DEBUG DEBUG GRPC_EXECUTION_CONTEXT_SANITIZER LD: clang - LDFLAGS: -fsanitize=thread -fPIE -pie + LDFLAGS: -fsanitize=thread LDXX: clang++ compile_the_world: true test_environ: @@ -2930,10 +2926,10 @@ configs: tsan: CC: clang CPPFLAGS: -O0 -fsanitize=thread -fno-omit-frame-pointer -Wno-unused-command-line-argument - -fPIE -pie -DGPR_NO_DIRECT_SYSCALLS + -DGPR_NO_DIRECT_SYSCALLS CXX: clang++ LD: clang - LDFLAGS: -fsanitize=thread -fPIE -pie + LDFLAGS: -fsanitize=thread LDXX: clang++ compile_the_world: true test_environ: diff --git a/src/core/iomgr/fd_posix.c b/src/core/iomgr/fd_posix.c index 4ba7c5df94..3edafa0b07 100644 --- a/src/core/iomgr/fd_posix.c +++ b/src/core/iomgr/fd_posix.c @@ -72,6 +72,9 @@ static grpc_fd *fd_freelist = NULL; static gpr_mu fd_freelist_mu; static void freelist_fd(grpc_fd *fd) { + // Note that this function must be called after a release store (or + // full-barrier operation) on refst so that prior actions on the fd are + // ordered before the fd becomes visible to the freelist gpr_mu_lock(&fd_freelist_mu); fd->freelist_next = fd_freelist; fd_freelist = fd; @@ -92,7 +95,6 @@ static grpc_fd *alloc_fd(int fd) { gpr_mu_init(&r->mu); } - gpr_atm_rel_store(&r->refst, 1); r->shutdown = 0; r->read_closure = CLOSURE_NOT_READY; r->write_closure = CLOSURE_NOT_READY; @@ -104,6 +106,11 @@ static grpc_fd *alloc_fd(int fd) { r->on_done_closure = NULL; r->closed = 0; r->released = 0; + // The last operation on r before returning it should be a release-store + // so that all the above fields are globally visible before the value of + // r could escape to another thread. Our refcount itself needs a release-store + // so use this + gpr_atm_rel_store(&r->refst, 1); return r; } diff --git a/tools/run_tests/tests.json b/tools/run_tests/tests.json index 6c6de6a594..bd652f2aa7 100644 --- a/tools/run_tests/tests.json +++ b/tools/run_tests/tests.json @@ -2317,9 +2317,7 @@ "posix" ], "cpu_cost": 0.5, - "exclude_configs": [ - "tsan" - ], + "exclude_configs": [], "flaky": false, "gtest": false, "language": "c++", @@ -2338,9 +2336,7 @@ "posix" ], "cpu_cost": 10, - "exclude_configs": [ - "tsan" - ], + "exclude_configs": [], "flaky": false, "gtest": false, "language": "c++", |