diff --git a/bpf/kprobe_pwru.c b/bpf/kprobe_pwru.c index 1cb0a8dc..6d41f848 100644 --- a/bpf/kprobe_pwru.c +++ b/bpf/kprobe_pwru.c @@ -30,7 +30,7 @@ const static bool TRUE = true; const static u32 ZERO = 0; -volatile const static __u64 BPF_PROG_ADDR = 0; +volatile const __u64 BPF_PROG_ADDR = 0; enum { TRACKED_BY_FILTER = (1 << 0), diff --git a/internal/pwru/tracing.go b/internal/pwru/tracing.go index 0ebdd1cc..1c33d142 100644 --- a/internal/pwru/tracing.go +++ b/internal/pwru/tracing.go @@ -92,10 +92,8 @@ func (t *tracing) traceProg(spec *ebpf.CollectionSpec, } spec = spec.Copy() - if err := spec.RewriteConstants(map[string]any{ - "BPF_PROG_ADDR": addr, - }); err != nil { - return fmt.Errorf("failed to rewrite bpf prog addr: %w", err) + if err := spec.Variables["BPF_PROG_ADDR"].Set(addr); err != nil { + return fmt.Errorf("failed to set bpf prog addr: %w", err) } spec.Programs[tracingName].AttachTarget = prog