Skip to content

Commit

Permalink
Fixed gRPC 1.61 offsets and updated go.mod versions (#609)
Browse files Browse the repository at this point in the history
* updated go.mod versions

* Fixed offset detection

* regenerating bpf probes

* Fixed conflicts between gprc and http2

* updated bpf2go

* Update bpf

* Use the clamp_umax helper

* Update bpfs to make sure ubuntu compiled works

---------

Co-authored-by: Nikola Grcevski <[email protected]>
Co-authored-by: Nikola Grcevski <[email protected]>
  • Loading branch information
3 people authored Feb 9, 2024
1 parent 41c0b76 commit 19b91e8
Show file tree
Hide file tree
Showing 1,537 changed files with 67,462 additions and 47,472 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ prereqs:
@echo "### Check if prerequisites are met, and installing missing dependencies"
mkdir -p $(TEST_OUTPUT)/run
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/[email protected])
$(call go-install-tool,$(BPF2GO),github.com/cilium/ebpf/cmd/bpf2go@v0.10.0)
$(call go-install-tool,$(BPF2GO),github.com/cilium/ebpf/cmd/bpf2go@v0.12.3)
$(call go-install-tool,$(GO_OFFSETS_TRACKER),github.com/grafana/go-offsets-tracker/cmd/[email protected])
$(call go-install-tool,$(GOIMPORTS_REVISER),github.com/incu6us/goimports-reviser/[email protected])
$(call go-install-tool,$(GO_LICENSES),github.com/google/[email protected])
Expand Down
10 changes: 5 additions & 5 deletions bpf/go_grpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,14 @@ int uprobe_server_handleStream_return(struct pt_regs *ctx) {
void *remote_addr = 0;
void *local_addr = 0;

if (grpc_st_remoteaddr_ptr_pos != (u64)(-1)) {
bpf_dbg_printk("pre 1.60 grpc peer info");
remote_addr = (void *)(st_ptr + grpc_st_remoteaddr_ptr_pos + sizeof(void *));
local_addr = (void *)(st_ptr + grpc_st_localaddr_ptr_pos + sizeof(void *));
} else if (grpc_st_peer_ptr_pos != (u64)(-1)) {
if (grpc_st_peer_ptr_pos != (u64)(-1)) {
bpf_dbg_printk("1.60 grpc or later peer info");
remote_addr = (void *)(st_ptr + grpc_st_peer_ptr_pos + grpc_peer_addr_pos + sizeof(void *));
local_addr = (void *)(st_ptr + grpc_st_peer_ptr_pos + grpc_peer_localaddr_pos + sizeof(void *));
} else if (grpc_st_remoteaddr_ptr_pos != (u64)(-1)) {
bpf_dbg_printk("pre 1.60 grpc peer info");
remote_addr = (void *)(st_ptr + grpc_st_remoteaddr_ptr_pos + sizeof(void *));
local_addr = (void *)(st_ptr + grpc_st_localaddr_ptr_pos + sizeof(void *));
}

if (remote_addr != 0 && local_addr != 0) {
Expand Down
7 changes: 2 additions & 5 deletions bpf/trace_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,8 @@ static __always_inline void get_or_create_trace_info(http_connection_metadata_t

unsigned char *buf = tp_char_buf();
if (buf) {
s64 buf_len = (s64)bytes_len;
if (buf_len >= TRACE_BUF_SIZE) {
buf_len = TRACE_BUF_SIZE - 1;
}
buf_len &= (TRACE_BUF_SIZE - 1);
int buf_len = (int)bytes_len;
bpf_clamp_umax(buf_len, TRACE_BUF_SIZE-1);

bpf_probe_read(buf, buf_len, u_buf);
unsigned char *res = bpf_strstr_tp_loop(buf, buf_len);
Expand Down
113 changes: 56 additions & 57 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,46 +5,46 @@ go 1.21
require (
github.com/AlessandroPomponio/go-gibberish v0.0.0-20191004143433-a2d4156f0396
github.com/caarlos0/env/v9 v9.0.0
github.com/cilium/ebpf v0.11.0
github.com/cilium/ebpf v0.12.3
github.com/gavv/monotime v0.0.0-20190418164738-30dba4353424
github.com/gin-gonic/gin v1.9.1
github.com/go-logr/logr v1.2.4
github.com/go-logr/logr v1.4.1
github.com/goccy/go-json v0.10.2
github.com/gorilla/mux v1.8.0
github.com/grafana/go-offsets-tracker v0.1.5
github.com/hashicorp/golang-lru/v2 v2.0.2
github.com/gorilla/mux v1.8.1
github.com/grafana/go-offsets-tracker v0.1.7
github.com/hashicorp/golang-lru/v2 v2.0.7
github.com/mariomac/guara v0.0.0-20230621100729-42bd7716e524
github.com/mariomac/pipes v0.9.0
github.com/prometheus/client_golang v1.15.1
github.com/prometheus/client_model v0.3.0
github.com/prometheus/common v0.42.0
github.com/prometheus/procfs v0.9.0
github.com/prometheus/client_golang v1.18.0
github.com/prometheus/client_model v0.5.0
github.com/prometheus/common v0.46.0
github.com/prometheus/procfs v0.12.0
github.com/shirou/gopsutil v3.21.11+incompatible
github.com/stretchr/testify v1.8.4
github.com/vladimirvivien/gexe v0.2.0
github.com/xwb1989/sqlparser v0.0.0-20180606152119-120387863bf2
go.opentelemetry.io/collector/pdata v0.66.0
go.opentelemetry.io/otel v1.19.0
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v0.41.0
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v0.41.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.18.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.18.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.18.0
go.opentelemetry.io/otel/metric v1.19.0
go.opentelemetry.io/otel/sdk v1.18.0
go.opentelemetry.io/otel/sdk/metric v0.41.0
go.opentelemetry.io/otel/trace v1.19.0
golang.org/x/arch v0.3.0
golang.org/x/mod v0.8.0
golang.org/x/net v0.12.0
golang.org/x/sys v0.12.0
google.golang.org/grpc v1.58.3
google.golang.org/protobuf v1.31.0
go.opentelemetry.io/collector/pdata v1.1.0
go.opentelemetry.io/otel v1.23.1
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.23.1
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.23.1
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.23.1
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.23.1
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.23.1
go.opentelemetry.io/otel/metric v1.23.1
go.opentelemetry.io/otel/sdk v1.23.1
go.opentelemetry.io/otel/sdk/metric v1.23.1
go.opentelemetry.io/otel/trace v1.23.1
golang.org/x/arch v0.7.0
golang.org/x/mod v0.15.0
golang.org/x/net v0.21.0
golang.org/x/sys v0.17.0
google.golang.org/grpc v1.61.0
google.golang.org/protobuf v1.32.0
gopkg.in/yaml.v3 v3.0.1
k8s.io/api v0.27.4
k8s.io/apimachinery v0.27.4
k8s.io/client-go v0.27.4
sigs.k8s.io/e2e-framework v0.2.0
k8s.io/api v0.29.1
k8s.io/apimachinery v0.29.1
k8s.io/client-go v0.29.1
sigs.k8s.io/e2e-framework v0.3.0
)

require (
Expand All @@ -54,68 +54,67 @@ require (
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emicklei/go-restful/v3 v3.9.0 // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.1 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.14.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect
github.com/google/uuid v1.4.0 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 // indirect
github.com/hashicorp/go-version v1.6.0 // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/imdario/mergo v0.3.15 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
github.com/leodido/go-urn v1.2.4 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/moby/spdystream v0.2.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/tklauser/go-sysconf v0.3.11 // indirect
github.com/tklauser/numcpus v0.6.0 // indirect
github.com/tklauser/go-sysconf v0.3.13 // indirect
github.com/tklauser/numcpus v0.7.0 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.11 // indirect
github.com/yusufpapurcu/wmi v1.2.2 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.41.0 // indirect
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
golang.org/x/crypto v0.11.0 // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
go.opentelemetry.io/proto/otlp v1.1.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.19.0 // indirect
golang.org/x/exp v0.0.0-20230224173230-c95f2b4c22f2 // indirect
golang.org/x/oauth2 v0.10.0 // indirect
golang.org/x/term v0.10.0 // indirect
golang.org/x/text v0.11.0 // indirect
golang.org/x/oauth2 v0.16.0 // indirect
golang.org/x/term v0.17.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.3.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
k8s.io/klog/v2 v2.90.1 // indirect
k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f // indirect
k8s.io/utils v0.0.0-20230209194617-a36077c30491 // indirect
sigs.k8s.io/controller-runtime v0.14.5 // indirect
k8s.io/klog/v2 v2.110.1 // indirect
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect
k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
sigs.k8s.io/controller-runtime v0.15.1 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)
Loading

0 comments on commit 19b91e8

Please sign in to comment.