Skip to content

Commit

Permalink
fix #10
Browse files Browse the repository at this point in the history
AddHook passes a lock by the value: type Probe contains sync.RWMutex which is sync.Locker

Signed-off-by: CFC4N <cfc4n.cs@gmail.com>
  • Loading branch information
cfc4n committed Jun 15, 2022
1 parent edda171 commit db35a1a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,7 @@ func (m *Manager) ClonePerfRing(name string, newName string, options MapOptions,
// eBPF TC classifier to the newly created interface of a container. Make sure to specify a unique uid in the new probe,
// you will need it if you want to detach the program later. The original program is selected using the provided UID and
// the section provided in the new probe.
func (m *Manager) AddHook(UID string, newProbe Probe) error {
func (m *Manager) AddHook(UID string, newProbe *Probe) error {
oldID := ProbeIdentificationPair{UID, newProbe.EbpfFuncName}
// Look for the eBPF program
progs, found, err := m.GetProgram(oldID)
Expand Down Expand Up @@ -829,7 +829,7 @@ func (m *Manager) AddHook(UID string, newProbe Probe) error {
}

// Add probe to the list of probes
m.Probes = append(m.Probes, &newProbe)
m.Probes = append(m.Probes, newProbe)
return nil
}

Expand Down Expand Up @@ -876,7 +876,7 @@ func (m *Manager) DetachHook(section string, UID string) error {
// first create the new maps you need, then clone the program you're interested in and rewrite it with the new maps,
// using a MapEditor. The original program is selected using the provided UID and the section provided in the new probe.
// Note that the BTF based constant edition will note work with this method.
func (m *Manager) CloneProgram(UID string, newProbe Probe, constantsEditors []ConstantEditor, mapEditors map[string]*ebpf.Map) error {
func (m *Manager) CloneProgram(UID string, newProbe *Probe, constantsEditors []ConstantEditor, mapEditors map[string]*ebpf.Map) error {
oldID := ProbeIdentificationPair{UID, newProbe.EbpfFuncName}
// Find the program specs
progSpecs, found, err := m.GetProgramSpec(oldID)
Expand Down Expand Up @@ -933,7 +933,7 @@ func (m *Manager) CloneProgram(UID string, newProbe Probe, constantsEditors []Co
}

// Add probe to the list of probes
m.Probes = append(m.Probes, &newProbe)
m.Probes = append(m.Probes, newProbe)
return nil
}

Expand Down

0 comments on commit db35a1a

Please sign in to comment.