bpfman / bpfman/bpfman-operator

`offset` field doc is wrong when `function` is omitted

Open Beginner friendly
#533 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
38
Forks
27
PR merge metrics
No merged PRs in 30d

Description

The `offset` field on the uprobe attach types is documented as relative to the attach function:

```
// offset is an optional field and the value is added to the address of the
// attachment point function.
```

(`apis/v1alpha1/cluster_uprobe_program_types.go:50`, and the same in `uprobe_program_types.go`.)

But `function` right above it is `+optional`:

```go
// function is an optional field ...
// +optional
Function string `json:"function,omitempty"`
```

So a perfectly valid CR is `offset` set, `function` omitted -- and then there is no "attachment point function" for the offset to be added to. In that case bpfman (via aya) treats `offset` as an absolute file offset into the target binary, not a delta from a symbol. The doc describes only the with-function case and quietly misleads anyone doing an offset-only attach.

You can see the two meanings without a cluster -- they go down different aya paths depending on whether a symbol is present: with a function, the offset is added to the resolved symbol address; with no function, it's the raw file offset. The CRD comment only covers the first.

Suggested reword, something like:

> offset is an optional field. When `function` is set, it is added to that function's address. When `function` is omitted, it is an absolute file offset into the target.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the offset comments at apis/v1alpha1/cluster_uprobe_program_types.go:50 and the corresponding comment in uprobe_program_types.go. Update both descriptions to distinguish offsets used with a function from absolute file offsets when function is omitted; done means the two CRD comments consistently document both valid cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
88/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.