diff --git a/ci/linux_clang-latest_libcxx_bazel.sh b/ci/linux_clang-latest_libcxx_bazel.sh index 7073cf6f7..7bb85dbe3 100755 --- a/ci/linux_clang-latest_libcxx_bazel.sh +++ b/ci/linux_clang-latest_libcxx_bazel.sh @@ -36,7 +36,7 @@ if [ -z ${EXCEPTIONS_MODE:-} ]; then EXCEPTIONS_MODE="-fno-exceptions -fexceptions" fi -readonly DOCKER_CONTAINER="gcr.io/google.com/absl-177019/linux_hybrid-latest:20230217" +readonly DOCKER_CONTAINER="gcr.io/google.com/absl-177019/linux_hybrid-latest:20240523" # USE_BAZEL_CACHE=1 only works on Kokoro. # Without access to the credentials this won't work. @@ -47,7 +47,7 @@ if [[ ${USE_BAZEL_CACHE:-0} -ne 0 ]]; then # remote_http_cache url, we make changes to the container part of # the cache key. Hashing the key is to make it shorter and url-safe. container_key=$(echo ${DOCKER_CONTAINER} | sha256sum | head -c 16) - BAZEL_EXTRA_ARGS="--remote_http_cache=https://storage.googleapis.com/absl-bazel-remote-cache/${container_key} --google_credentials=/keystore/73103_absl-bazel-remote-cache ${BAZEL_EXTRA_ARGS:-}" + BAZEL_EXTRA_ARGS="--remote_cache=https://storage.googleapis.com/absl-bazel-remote-cache/${container_key} --google_credentials=/keystore/73103_absl-bazel-remote-cache ${BAZEL_EXTRA_ARGS:-}" fi for std in ${STD}; do @@ -61,14 +61,14 @@ for std in ${STD}; do --rm \ -e CC="/opt/llvm/clang/bin/clang" \ -e BAZEL_CXXOPTS="-std=${std}:-nostdinc++" \ - -e BAZEL_LINKOPTS="-L/opt/llvm/libcxx/lib/x86_64-unknown-linux-gnu:-lc++:-lc++abi:-lm:-Wl,-rpath=/opt/llvm/libcxx/lib/x86_64-unknown-linux-gnu" \ - -e CPLUS_INCLUDE_PATH="/opt/llvm/libcxx/include/x86_64-unknown-linux-gnu/c++/v1:/opt/llvm/libcxx/include/c++/v1" \ + -e BAZEL_LINKOPTS="-L/opt/llvm/libcxx/lib:-lc++:-lc++abi:-lm:-Wl,-rpath=/opt/llvm/libcxx/lib" \ + -e CPLUS_INCLUDE_PATH="/opt/llvm/libcxx/include/c++/v1" \ ${DOCKER_EXTRA_ARGS:-} \ ${DOCKER_CONTAINER} \ /usr/local/bin/bazel test ... \ --compilation_mode="${compilation_mode}" \ --copt="${exceptions_mode}" \ - --distdir="/bazel-distdir" \ + --enable_bzlmod=false \ --keep_going \ --show_timestamps \ --test_output=errors \ diff --git a/ci/linux_clang-latest_libstdcxx_bazel.sh b/ci/linux_clang-latest_libstdcxx_bazel.sh index b5b599f5c..cf634195e 100755 --- a/ci/linux_clang-latest_libstdcxx_bazel.sh +++ b/ci/linux_clang-latest_libstdcxx_bazel.sh @@ -36,7 +36,7 @@ if [ -z ${EXCEPTIONS_MODE:-} ]; then EXCEPTIONS_MODE="-fno-exceptions -fexceptions" fi -readonly DOCKER_CONTAINER="gcr.io/google.com/absl-177019/linux_hybrid-latest:20230217" +readonly DOCKER_CONTAINER="gcr.io/google.com/absl-177019/linux_hybrid-latest:20240523" # USE_BAZEL_CACHE=1 only works on Kokoro. # Without access to the credentials this won't work. @@ -47,7 +47,7 @@ if [ ${USE_BAZEL_CACHE:-0} -ne 0 ]; then # remote_http_cache url, we make changes to the container part of # the cache key. Hashing the key is to make it shorter and url-safe. container_key=$(echo ${DOCKER_CONTAINER} | sha256sum | head -c 16) - BAZEL_EXTRA_ARGS="--remote_http_cache=https://storage.googleapis.com/absl-bazel-remote-cache/${container_key} --google_credentials=/keystore/73103_absl-bazel-remote-cache ${BAZEL_EXTRA_ARGS:-}" + BAZEL_EXTRA_ARGS="--remote_cache=https://storage.googleapis.com/absl-bazel-remote-cache/${container_key} --google_credentials=/keystore/73103_absl-bazel-remote-cache ${BAZEL_EXTRA_ARGS:-}" fi for std in ${STD}; do @@ -67,7 +67,7 @@ for std in ${STD}; do --compilation_mode="${compilation_mode}" \ --copt="--gcc-toolchain=/usr/local" \ --copt="${exceptions_mode}" \ - --distdir="/bazel-distdir" \ + --enable_bzlmod=false \ --keep_going \ --linkopt="--gcc-toolchain=/usr/local" \ --show_timestamps \ diff --git a/ci/linux_gcc-latest_libstdcxx_bazel.sh b/ci/linux_gcc-latest_libstdcxx_bazel.sh index 35de0dcd1..0b28ebf5d 100755 --- a/ci/linux_gcc-latest_libstdcxx_bazel.sh +++ b/ci/linux_gcc-latest_libstdcxx_bazel.sh @@ -36,7 +36,7 @@ if [ -z ${EXCEPTIONS_MODE:-} ]; then EXCEPTIONS_MODE="-fno-exceptions -fexceptions" fi -readonly DOCKER_CONTAINER="gcr.io/google.com/absl-177019/linux_hybrid-latest:20230217" +readonly DOCKER_CONTAINER="gcr.io/google.com/absl-177019/linux_hybrid-latest:20240523" # USE_BAZEL_CACHE=1 only works on Kokoro. # Without access to the credentials this won't work. @@ -47,7 +47,7 @@ if [[ ${USE_BAZEL_CACHE:-0} -ne 0 ]]; then # remote_http_cache url, we make changes to the container part of # the cache key. Hashing the key is to make it shorter and url-safe. container_key=$(echo ${DOCKER_CONTAINER} | sha256sum | head -c 16) - BAZEL_EXTRA_ARGS="--remote_http_cache=https://storage.googleapis.com/absl-bazel-remote-cache/${container_key} --google_credentials=/keystore/73103_absl-bazel-remote-cache ${BAZEL_EXTRA_ARGS:-}" + BAZEL_EXTRA_ARGS="--remote_cache=https://storage.googleapis.com/absl-bazel-remote-cache/${container_key} --google_credentials=/keystore/73103_absl-bazel-remote-cache ${BAZEL_EXTRA_ARGS:-}" fi for std in ${STD}; do @@ -66,7 +66,7 @@ for std in ${STD}; do /usr/local/bin/bazel test ... \ --compilation_mode="${compilation_mode}" \ --copt="${exceptions_mode}" \ - --distdir="/bazel-distdir" \ + --enable_bzlmod=false \ --keep_going \ --experimental_ui_max_stdouterr_bytes=-1 \ --show_timestamps \ diff --git a/tcmalloc/testing/memory_errors_test.cc b/tcmalloc/testing/memory_errors_test.cc index 8fdfa8fdf..a1d2feffa 100644 --- a/tcmalloc/testing/memory_errors_test.cc +++ b/tcmalloc/testing/memory_errors_test.cc @@ -235,6 +235,7 @@ TEST_F(TcMallocTest, DoubleFreeDetected) { for (int i = 0; i < 1000000; i++) { void* buf = ::operator new(kPageSize); ::operator delete(buf); + benchmark::DoNotOptimize(buf); // TCMalloc often SEGVs on double free (without GWP-ASan report). Make // sure we have a guarded allocation before double-freeing. if (tc_globals.guardedpage_allocator().PointerIsMine(buf)) { @@ -285,6 +286,7 @@ TEST_F(TcMallocTest, OffsetAndLength) { ::operator delete(buf); // TCMalloc may crash without a GWP-ASan report if we overflow a regular // allocation. Make sure we have a guarded allocation. + benchmark::DoNotOptimize(buf); if (tc_globals.guardedpage_allocator().PointerIsMine(buf)) { volatile char sink = static_cast(buf)[access_offset]; benchmark::DoNotOptimize(sink); @@ -344,7 +346,9 @@ TEST_F(TcMallocTest, DoubleFree) { ScopedProfileSamplingInterval s(1); auto DoubleFree = []() { void* buf = ::operator new(42); + benchmark::DoNotOptimize(buf); ::operator delete(buf); + benchmark::DoNotOptimize(buf); ::operator delete(buf); }; EXPECT_DEATH(DoubleFree(), diff --git a/tcmalloc/testing/tcmalloc_large_test.cc b/tcmalloc/testing/tcmalloc_large_test.cc index c2cdd8b4d..a1f617a8e 100644 --- a/tcmalloc/testing/tcmalloc_large_test.cc +++ b/tcmalloc/testing/tcmalloc_large_test.cc @@ -43,10 +43,11 @@ void TryAllocExpectFail(size_t size) { void* p2 = malloc(1); ASSERT_NE(p2, nullptr); + void* volatile stashed_p2 = p2; void* p3 = realloc(p2, size); ASSERT_EQ(p3, nullptr); - free(p2); + free(stashed_p2); } // Alloc a size that might work and might fail.