diff --git a/WORKSPACE b/WORKSPACE index 587271dd5d3..884603e315b 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -33,7 +33,7 @@ pl_go_overrides() go_download_sdk( name = "go_sdk", - version = "1.20.2", + version = "1.20.4", ) go_rules_dependencies() @@ -231,12 +231,12 @@ go_download_sdk( go_download_sdk( name = "go_sdk_1_19", - version = "1.19.7", + version = "1.19.9", ) go_download_sdk( name = "go_sdk_1_20", - version = "1.20.2", + version = "1.20.4", ) pip_parse( diff --git a/docker.properties b/docker.properties index d23ad43472b..8260a3e417c 100644 --- a/docker.properties +++ b/docker.properties @@ -1,4 +1,4 @@ -DOCKER_IMAGE_TAG=202305050100 -LINTER_IMAGE_DIGEST=9d37b36e898e9e056126854689649c884d7751f3abe7d377d9cb6acb39bcf97e -DEV_IMAGE_DIGEST=c211563cf1163e740fcab8f385226c9bf80f4eabf061a739b0aaa7fcd5fce6f4 -DEV_IMAGE_WITH_EXTRAS_DIGEST=b5c273d4d9766d05c7c092b212bda379b6125c45112b167bd3144c083889cb77 +DOCKER_IMAGE_TAG=202305092241 +LINTER_IMAGE_DIGEST=e931f126300a52976e8a64898cff1e10c4208e4bbe99e0b393df359ba4374b53 +DEV_IMAGE_DIGEST=19bdb2ec8d50e2c8640641a70fe3c8cf3c9099cfb2ef19011c920e38cf4d0e93 +DEV_IMAGE_WITH_EXTRAS_DIGEST=e4a2fa72a7d23d91096d34ea61f4f56b77842ee8afe4d79fc0c9158ec5287a93 diff --git a/src/stirling/obj_tools/go_syms.cc b/src/stirling/obj_tools/go_syms.cc index e30f5fd2473..42f3b46e65c 100644 --- a/src/stirling/obj_tools/go_syms.cc +++ b/src/stirling/obj_tools/go_syms.cc @@ -27,6 +27,7 @@ namespace obj_tools { // This symbol points to a static string variable that describes the Golang tool-chain version used // to build the executable. This symbol is embedded in a Golang executable's data section. constexpr std::string_view kGoBuildVersionSymbol = "runtime.buildVersion"; +constexpr std::string_view kGoBuildVersionStrSymbol = "runtime.buildVersion.str"; namespace { @@ -43,7 +44,30 @@ bool IsGoExecutable(ElfReader* elf_reader) { return elf_reader->SearchTheOnlySymbol(obj_tools::kGoBuildVersionSymbol).ok(); } +// TODO(ddelnano): Between Go 1.20.2 and 1.20.4 our build version detection started failing. +// Our version detection's assumptions is very different from how Go does this internally +// and needs a signficant rehaul. That is being tracked in +// https://github.com/pixie-io/pixie/issues/1318 but in the meantime optimisitcally read the +// runtime.buildVersion.str before following our previous heuristic. +StatusOr ReadBuildVersionDirect(ElfReader* elf_reader) { + auto str_symbol_status = elf_reader->SearchTheOnlySymbol(kGoBuildVersionStrSymbol); + if (!str_symbol_status.ok()) { + return error::NotFound("Unable to find runtime.buildVersion.str"); + } + auto str_symbol = str_symbol_status.ValueOrDie(); + PX_ASSIGN_OR_RETURN(auto symbol_bytecode, elf_reader->SymbolByteCode(".rodata", str_symbol)); + return std::string(reinterpret_cast(symbol_bytecode.data()), + symbol_bytecode.size() - 1); +} + StatusOr ReadBuildVersion(ElfReader* elf_reader) { + auto direct_version_str = ReadBuildVersionDirect(elf_reader); + if (!direct_version_str.ok()) { + LOG(INFO) << absl::Substitute( + "Falling back to the runtime.buildVersion symbol for go version detection"); + } else { + return direct_version_str; + } PX_ASSIGN_OR_RETURN(ElfReader::SymbolInfo symbol, elf_reader->SearchTheOnlySymbol(kGoBuildVersionSymbol)); diff --git a/src/stirling/obj_tools/go_syms_test.cc b/src/stirling/obj_tools/go_syms_test.cc index 07e6ca527e7..0c8c2ee7bc5 100644 --- a/src/stirling/obj_tools/go_syms_test.cc +++ b/src/stirling/obj_tools/go_syms_test.cc @@ -36,7 +36,7 @@ TEST(ReadBuildVersionTest, WorkingOnBasicGoBinary) { const std::string kPath = px::testing::BazelRunfilePath(kTestGoBinaryPath); ASSERT_OK_AND_ASSIGN(std::unique_ptr elf_reader, ElfReader::Create(kPath)); ASSERT_OK_AND_ASSIGN(std::string version, ReadBuildVersion(elf_reader.get())); - EXPECT_THAT(version, StrEq("go1.19.7")); + EXPECT_THAT(version, StrEq("go1.19.9")); } TEST(IsGoExecutableTest, WorkingOnBasicGoBinary) { diff --git a/tools/chef/cookbooks/px_dev/attributes/linux.rb b/tools/chef/cookbooks/px_dev/attributes/linux.rb index fd7ee372265..ae9a5704219 100644 --- a/tools/chef/cookbooks/px_dev/attributes/linux.rb +++ b/tools/chef/cookbooks/px_dev/attributes/linux.rb @@ -33,9 +33,9 @@ '648b599397548e4bb92429eec6391374c2cbb0edb835e3b3f03d4281c011f401' default['golang']['download_path'] = - 'https://go.dev/dl/go1.20.2.linux-amd64.tar.gz' + 'https://go.dev/dl/go1.20.4.linux-amd64.tar.gz' default['golang']['sha256'] = - '4eaea32f59cde4dc635fbc42161031d13e1c780b87097f4b4234cfce671f1768' + '698ef3243972a51ddb4028e4a1ac63dc6d60821bf18e59a807e051fee0a385bd' default['golangci-lint']['download_path'] = 'https://github.com/golangci/golangci-lint/releases/download/v1.51.1/golangci-lint-1.51.1-linux-amd64.tar.gz' diff --git a/tools/chef/cookbooks/px_dev/attributes/mac_os_x.rb b/tools/chef/cookbooks/px_dev/attributes/mac_os_x.rb index e9ed961fef6..8bbc63b8ac1 100644 --- a/tools/chef/cookbooks/px_dev/attributes/mac_os_x.rb +++ b/tools/chef/cookbooks/px_dev/attributes/mac_os_x.rb @@ -34,9 +34,9 @@ '8d3709d957c7115610e764621569728be102d213fee15bc1d1aa9d465eb2c258' default['golang']['download_path'] = - 'https://go.dev/dl/go1.20.2.darwin-amd64.tar.gz' + 'https://go.dev/dl/go1.20.4.darwin-amd64.tar.gz' default['golang']['sha256'] = - 'c93b8ced9517d07e1cd4c362c6e2d5242cb139e29b417a328fbf19aded08764c' + '242b099b5b9bd9c5d4d25c041216bc75abcdf8e0541aec975eeabcbce61ad47f' default['golangci-lint']['download_path'] = 'https://github.com/golangci/golangci-lint/releases/download/v1.51.1/golangci-lint-1.51.1-darwin-amd64.tar.gz'