Skip to content

Commit

Permalink
Update docker images.
Browse files Browse the repository at this point in the history
GCC detects some intentional memory errors that we use for testing GWP-ASan.
Suppress these since we want to test our detection.

PiperOrigin-RevId: 705645758
Change-Id: I725562d054028b8692b2129819b363bc21e441bb
  • Loading branch information
ckennelly authored and copybara-github committed Dec 12, 2024
1 parent 00319f1 commit 96771f5
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 12 deletions.
10 changes: 5 additions & 5 deletions ci/linux_clang-latest_libcxx_bazel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand All @@ -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 \
Expand Down
6 changes: 3 additions & 3 deletions ci/linux_clang-latest_libstdcxx_bazel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand All @@ -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 \
Expand Down
6 changes: 3 additions & 3 deletions ci/linux_gcc-latest_libstdcxx_bazel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand All @@ -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 \
Expand Down
4 changes: 4 additions & 0 deletions tcmalloc/testing/memory_errors_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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<char*>(buf)[access_offset];
benchmark::DoNotOptimize(sink);
Expand Down Expand Up @@ -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(),
Expand Down
3 changes: 2 additions & 1 deletion tcmalloc/testing/tcmalloc_large_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 96771f5

Please sign in to comment.