ebpf icon indicating copy to clipboard operation
ebpf copied to clipboard

deprecation of directive `//go:linkname`

Open florianl opened this issue 1 year ago • 3 comments

Describe the bug

This package makes use of the directive //go:linkname: https://github.com/cilium/ebpf/blob/79b6759e76cbab4522f496f1dd680cce3232f1a2/internal/auxv.go#L20-L21

With go.dev/issue/67401 an initiative was started to limited this directive. cilium/ebpf is already named as user of the runtime.getAuxv.

I'm not sure if there will be an exception for the use of runtime.getAuxv. Therefore an alternative approach should be investigated.

How to reproduce

The use of //go:linkname was introduced with https://github.com/cilium/ebpf/commit/fbff7dbd617fccbf0bea0ea8c383f162088c9df5.

florianl avatar May 23 '24 11:05 florianl

I think it's really funny that x/sys/cpu gets to poke into the runtime just fine but we get put into the hall of shame xD Matter of fact is that auxv is useful on unix platforms, and the Go runtime doesn't give us access to it. Using the linkname is a lot better than the cruft we had before.

I'd be happy to migrate to some exported function if one existed (maybe via x/sys/unix?)

lmb avatar May 23 '24 11:05 lmb

@florianl are you interested in opening an upstream proposal for this?

lmb avatar May 23 '24 12:05 lmb

Proposal was created with https://github.com/golang/go/issues/68089. Follow up in https://github.com/golang/go/issues/67839.

florianl avatar Jun 20 '24 16:06 florianl

This issue got resolved with the merge of https://github.com/cilium/ebpf/pull/1665.

florianl avatar Feb 04 '25 15:02 florianl

Also removing the github.com/cilium/ebpf package from the "hall of shame" upstream here: https://go.dev/cl/646535

tklauser avatar Feb 05 '25 09:02 tklauser