mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-03 10:11:03 +00:00
bump tcptracer-bpf version and use it to fix race
We defer starting the ebpf tracer until we've set the global var which is referenced by the callback functions. Previously the var could be unset when the callbacks are invoked, resulting in a segfault. Fixes #2687.
This commit is contained in:
@@ -97,6 +97,9 @@ func newEbpfTracker() (eventTracker, error) {
|
||||
}
|
||||
|
||||
ebpfTracker = tracker
|
||||
|
||||
t.Start()
|
||||
|
||||
return tracker, nil
|
||||
}
|
||||
|
||||
|
||||
8
vendor/github.com/weaveworks/tcptracer-bpf/pkg/tracer/tracer.go
generated
vendored
8
vendor/github.com/weaveworks/tcptracer-bpf/pkg/tracer/tracer.go
generated
vendored
@@ -101,9 +101,6 @@ func NewTracer(tcpEventCbV4 func(TcpV4), tcpEventCbV6 func(TcpV6), lostCb func(l
|
||||
}
|
||||
}()
|
||||
|
||||
perfMapIPV4.PollStart()
|
||||
perfMapIPV6.PollStart()
|
||||
|
||||
return &Tracer{
|
||||
m: m,
|
||||
perfMapIPV4: perfMapIPV4,
|
||||
@@ -112,6 +109,11 @@ func NewTracer(tcpEventCbV4 func(TcpV4), tcpEventCbV6 func(TcpV6), lostCb func(l
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (t *Tracer) Start() {
|
||||
t.perfMapIPV4.PollStart()
|
||||
t.perfMapIPV6.PollStart()
|
||||
}
|
||||
|
||||
func (t *Tracer) AddFdInstallWatcher(pid uint32) (err error) {
|
||||
var one uint32 = 1
|
||||
mapFdInstall := t.m.Map("fdinstall_pids")
|
||||
|
||||
3
vendor/github.com/weaveworks/tcptracer-bpf/pkg/tracer/tracer_unsupported.go
generated
vendored
3
vendor/github.com/weaveworks/tcptracer-bpf/pkg/tracer/tracer_unsupported.go
generated
vendored
@@ -15,12 +15,13 @@ func TracerAsset() ([]byte, error) {
|
||||
func NewTracer(tcpEventCbV4 func(TcpV4), tcpEventCbV6 func(TcpV6), lostCb func(lost uint64)) (*Tracer, error) {
|
||||
return nil, fmt.Errorf("not supported on non-Linux systems")
|
||||
}
|
||||
func (t *Tracer) Start() {
|
||||
}
|
||||
func (t *Tracer) AddFdInstallWatcher(pid uint32) (err error) {
|
||||
return fmt.Errorf("not supported on non-Linux systems")
|
||||
}
|
||||
func (t *Tracer) RemoveFdInstallWatcher(pid uint32) (err error) {
|
||||
return fmt.Errorf("not supported on non-Linux systems")
|
||||
}
|
||||
|
||||
func (t *Tracer) Stop() {
|
||||
}
|
||||
|
||||
1
vendor/github.com/weaveworks/tcptracer-bpf/tcptracer-bpf.c
generated
vendored
1
vendor/github.com/weaveworks/tcptracer-bpf/tcptracer-bpf.c
generated
vendored
@@ -11,6 +11,7 @@
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wtautological-compare"
|
||||
#pragma clang diagnostic ignored "-Wgnu-variable-sized-type-not-at-end"
|
||||
#include <net/sock.h>
|
||||
#pragma clang diagnostic pop
|
||||
#include <net/inet_sock.h>
|
||||
|
||||
2
vendor/github.com/weaveworks/tcptracer-bpf/tests/tracer.go
generated
vendored
2
vendor/github.com/weaveworks/tcptracer-bpf/tests/tracer.go
generated
vendored
@@ -67,6 +67,8 @@ func main() {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
t.Start()
|
||||
|
||||
for _, p := range strings.Split(watchFdInstallPids, ",") {
|
||||
if p == "" {
|
||||
continue
|
||||
|
||||
2
vendor/manifest
vendored
2
vendor/manifest
vendored
@@ -1038,7 +1038,7 @@
|
||||
"importpath": "github.com/weaveworks/tcptracer-bpf",
|
||||
"repository": "https://github.com/weaveworks/tcptracer-bpf",
|
||||
"vcs": "git",
|
||||
"revision": "a616ebc6c5ac196af743e5dfc621a52fce030f87",
|
||||
"revision": "fc80d1659bf07dabebbb42c5507578440103d66f",
|
||||
"branch": "master",
|
||||
"notests": true
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user