diff --git a/.bazelrc b/.bazelrc index 7e53a5806..15173a48b 100644 --- a/.bazelrc +++ b/.bazelrc @@ -87,14 +87,17 @@ build:clang-tsan --linkopt -fuse-ld=lld # Needed due to https://github.com/libevent/libevent/issues/777 build:clang-tsan --copt -DEVENT__DISABLE_DEBUG_MODE -# Clang MSAN - broken today since we need to rebuild lib[std]c++ and external deps with MSAN -# support (see https://github.com/envoyproxy/envoy/issues/443). +# Clang MSAN - this is the base config for remote-msan and docker-msan. To run this config without +# our build image, follow https://github.com/google/sanitizers/wiki/MemorySanitizerLibcxxHowTo +# with libc++ instruction and provide corresponding `--copt` and `--linkopt` as well. build:clang-msan --action_env=ENVOY_MSAN=1 build:clang-msan --config=sanitizer build:clang-msan --define ENVOY_CONFIG_MSAN=1 build:clang-msan --copt -fsanitize=memory build:clang-msan --linkopt -fsanitize=memory build:clang-msan --copt -fsanitize-memory-track-origins=2 +# MSAN needs -O1 to get reasonable performance. +build:clang-msan --copt -O1 # Clang with libc++ build:libc++ --config=clang @@ -128,6 +131,10 @@ build:rbe-toolchain-clang-libc++ --action_env=CXXFLAGS=-stdlib=libc++ build:rbe-toolchain-clang-libc++ --action_env=LDFLAGS=-stdlib=libc++ build:rbe-toolchain-clang-libc++ --define force_libcpp=enabled +build:rbe-toolchain-msan --linkopt=-L/opt/libcxx_msan/lib +build:rbe-toolchain-msan --linkopt=-Wl,-rpath,/opt/libcxx_msan/lib +build:rbe-toolchain-msan --config=clang-msan + build:rbe-toolchain-gcc --config=rbe-toolchain build:rbe-toolchain-gcc --crosstool_top=@rbe_ubuntu_gcc//cc:toolchain build:rbe-toolchain-gcc --extra_toolchains=@rbe_ubuntu_gcc//config:cc-toolchain @@ -136,7 +143,7 @@ build:remote --spawn_strategy=remote,sandboxed,local build:remote --strategy=Javac=remote,sandboxed,local build:remote --strategy=Closure=remote,sandboxed,local build:remote --strategy=Genrule=remote,sandboxed,local -build:remote --remote_timeout=3600 +build:remote --remote_timeout=7200 build:remote --auth_enabled=true build:remote --remote_download_toplevel @@ -149,9 +156,13 @@ build:remote-clang-libc++ --config=rbe-toolchain-clang-libc++ build:remote-gcc --config=remote build:remote-gcc --config=rbe-toolchain-gcc +build:remote-msan --config=remote +build:remote-msan --config=rbe-toolchain-clang-libc++ +build:remote-msan --config=rbe-toolchain-msan + # Docker sandbox # NOTE: Update this from https://github.com/envoyproxy/envoy-build-tools/blob/master/toolchains/rbe_toolchains_config.bzl#L7 -build:docker-sandbox --experimental_docker_image=envoyproxy/envoy-build-ubuntu@sha256:3ca8acc35fdb57ab26e1bb5f9488f37095f45acd77a12602510410dbefa00b58 +build:docker-sandbox --experimental_docker_image=envoyproxy/envoy-build-ubuntu@sha256:f0b2453c3587e3297f5caf5e97fbf57c97592c96136209ec13fe2795aae2c896 build:docker-sandbox --spawn_strategy=docker build:docker-sandbox --strategy=Javac=docker build:docker-sandbox --strategy=Closure=docker @@ -169,6 +180,10 @@ build:docker-clang-libc++ --config=rbe-toolchain-clang-libc++ build:docker-gcc --config=docker-sandbox build:docker-gcc --config=rbe-toolchain-gcc +build:docker-msan --config=docker-sandbox +build:docker-msan --config=rbe-toolchain-clang-libc++ +build:docker-msan --config=rbe-toolchain-msan + # CI configurations build:remote-ci --remote_cache=grpcs://remotebuildexecution.googleapis.com build:remote-ci --remote_executor=grpcs://remotebuildexecution.googleapis.com @@ -182,4 +197,4 @@ build:asan-fuzzer --copt=-fsanitize=fuzzer-no-link build:asan-fuzzer --test_env=UBSAN_OPTIONS=print_stacktrace=1 try-import %workspace%/clang.bazelrc -try-import %workspace%/user.bazelrc \ No newline at end of file +try-import %workspace%/user.bazelrc diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl index 2b36c120f..722b43c7a 100644 --- a/bazel/repositories.bzl +++ b/bazel/repositories.bzl @@ -1,7 +1,7 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -ENVOY_COMMIT = "18911483b5c88e53c6ca2592a8eced3d747c968b" # December 2dn, 2019 -ENVOY_SHA = "9f1871031c61549bf7072510a68f922a8c9011b1989c9dc20d98233b0cb0b33c" +ENVOY_COMMIT = "a78311faf214bb9216f92407102b547b6fcd14a3" # December 13th, 2019 +ENVOY_SHA = "2e65ed67b3413e5c177321360ae6e15bf78dac24f65336a252bd59c1f6bb5a08" RULES_PYTHON_COMMIT = "fdbb17a4118a1728d19e638a5291b4c4266ea5b8" RULES_PYTHON_SHA = "9a3d71e348da504a9c4c5e8abd4cb822f7afb32c613dc6ee8b8535333a81a938" diff --git a/source/client/factories_impl.cc b/source/client/factories_impl.cc index a35d8959b..1de8de741 100644 --- a/source/client/factories_impl.cc +++ b/source/client/factories_impl.cc @@ -115,15 +115,14 @@ RequestSourcePtr RequestSourceFactoryImpl::create() const { UriImpl uri(options_.uri()); Envoy::Http::HeaderMapPtr header = std::make_unique(); - header->insertMethod().value(envoy::api::v2::core::RequestMethod_Name(options_.requestMethod())); - header->insertPath().value(uri.path()); - header->insertHost().value(uri.hostAndPort()); - header->insertScheme().value(uri.scheme() == "https" - ? Envoy::Http::Headers::get().SchemeValues.Https - : Envoy::Http::Headers::get().SchemeValues.Http); + header->setMethod(envoy::api::v2::core::RequestMethod_Name(options_.requestMethod())); + header->setPath(uri.path()); + header->setHost(uri.hostAndPort()); + header->setScheme(uri.scheme() == "https" ? Envoy::Http::Headers::get().SchemeValues.Https + : Envoy::Http::Headers::get().SchemeValues.Http); const uint32_t content_length = options_.requestBodySize(); if (content_length > 0) { - header->insertContentLength().value(content_length); + header->setContentLength(content_length); } auto request_options = options_.toCommandLineOptions()->request_options(); diff --git a/source/client/process_impl.cc b/source/client/process_impl.cc index 29b03de0c..d1b5e7725 100644 --- a/source/client/process_impl.cc +++ b/source/client/process_impl.cc @@ -355,7 +355,7 @@ bool ProcessImpl::run(OutputCollector& collector) { std::make_unique(time_system_); cluster_manager_factory_ = std::make_unique( admin_, Envoy::Runtime::LoaderSingleton::get(), store_root_, tls_, generator_, - dispatcher_->createDnsResolver({}), *ssl_context_manager_, *dispatcher_, *local_info_, + dispatcher_->createDnsResolver({}, true), *ssl_context_manager_, *dispatcher_, *local_info_, secret_manager_, validation_context_, *api_, http_context_, access_log_manager_, *singleton_manager_); cluster_manager_factory_->setPrefetchConnections(options_.prefetchConnections()); diff --git a/source/client/stream_decoder.cc b/source/client/stream_decoder.cc index ebfc2d841..bc2cd3a60 100644 --- a/source/client/stream_decoder.cc +++ b/source/client/stream_decoder.cc @@ -131,10 +131,9 @@ void StreamDecoder::finalizeActiveSpan() { void StreamDecoder::setupForTracing(std::string& x_request_id) { auto headers_copy = std::make_unique(*request_headers_); Envoy::Tracing::Decision tracing_decision = {Envoy::Tracing::Reason::ClientForced, true}; - headers_copy->insertClientTraceId(); RELEASE_ASSERT(Envoy::UuidUtils::setTraceableUuid(x_request_id, Envoy::UuidTraceStatus::Client), "setTraceableUuid failed"); - headers_copy->ClientTraceId()->value(x_request_id); + headers_copy->setClientTraceId(x_request_id); active_span_ = http_tracer_->startSpan(config_, *headers_copy, stream_info_, tracing_decision); active_span_->injectContext(*headers_copy); request_headers_.reset(headers_copy.release()); diff --git a/source/common/uri_impl.cc b/source/common/uri_impl.cc index c01c99aea..c611bb2c7 100644 --- a/source/common/uri_impl.cc +++ b/source/common/uri_impl.cc @@ -53,7 +53,7 @@ UriImpl::UriImpl(absl::string_view uri) : scheme_("http") { bool UriImpl::performDnsLookup(Envoy::Event::Dispatcher& dispatcher, const Envoy::Network::DnsLookupFamily dns_lookup_family) { - auto dns_resolver = dispatcher.createDnsResolver({}); + auto dns_resolver = dispatcher.createDnsResolver({}, true); std::string hostname = std::string(hostWithoutPort()); if (!hostname.empty() && hostname[0] == '[' && hostname[hostname.size() - 1] == ']') { diff --git a/test/benchmark_http_client_test.cc b/test/benchmark_http_client_test.cc index 4bc97ec3c..f7f928e73 100644 --- a/test/benchmark_http_client_test.cc +++ b/test/benchmark_http_client_test.cc @@ -192,23 +192,21 @@ TEST_F(BenchmarkClientHttpTest, StatusTrackingInOnComplete) { request_generator_, true); Envoy::Http::HeaderMapImpl header; - auto& status = header.insertStatus(); - - status.value(1); + header.setStatus(1); client_->onComplete(true, header); - status.value(100); + header.setStatus(100); client_->onComplete(true, header); - status.value(200); + header.setStatus(200); client_->onComplete(true, header); - status.value(300); + header.setStatus(300); client_->onComplete(true, header); - status.value(400); + header.setStatus(400); client_->onComplete(true, header); - status.value(500); + header.setStatus(500); client_->onComplete(true, header); - status.value(600); + header.setStatus(600); client_->onComplete(true, header); - status.value(200); + header.setStatus(200); // Shouldn't be counted by status, should add to stream reset. client_->onComplete(false, header); diff --git a/test/server/http_test_server_filter_integration_test.cc b/test/server/http_test_server_filter_integration_test.cc index 7bdf0a20b..5817977d5 100644 --- a/test/server/http_test_server_filter_integration_test.cc +++ b/test/server/http_test_server_filter_integration_test.cc @@ -59,12 +59,12 @@ class HttpTestServerIntegrationTestBase : public Envoy::HttpIntegrationTest, encoder.getStream().addCallbacks(*response); Envoy::Http::HeaderMapImpl headers; - headers.insertMethod().value(method); - headers.insertPath().value(url); - headers.insertHost().value(host); - headers.insertScheme().value(Envoy::Http::Headers::get().SchemeValues.Http); + headers.setMethod(method); + headers.setPath(url); + headers.setHost(host); + headers.setScheme(Envoy::Http::Headers::get().SchemeValues.Http); if (!content_type.empty()) { - headers.insertContentType().value(content_type); + headers.setContentType(content_type); } request_header_delegate(headers); encoder.encodeHeaders(headers, body.empty());