Skip to content

Fix attach_uprobe_multi_with_opts opts#1345

Merged
d-e-s-o merged 1 commit intolibbpf:masterfrom
gadol21:fix-uprobe-multi-ops
Feb 23, 2026
Merged

Fix attach_uprobe_multi_with_opts opts#1345
d-e-s-o merged 1 commit intolibbpf:masterfrom
gadol21:fix-uprobe-multi-ops

Conversation

@gadol21
Copy link
Contributor

@gadol21 gadol21 commented Feb 23, 2026

Currently func_pattern is mandatory in attach_uprobe_multi_with_opts Although in the C api it is optional, and mutually exclusive with some other options. The rust api didn't allow passing null pointer, which made it impossible to use syms/offsets/ref_ctr_offsets/cookies from opts because of the following check -
https://github.com/libbpf/libbpf/blob/3b4f0ef5a6fa247ce1958d909c0e85e760249840/src/libbpf.c#L12172

Thank you for considering a contribution!

In order to streamline review experience for contributors and reviewers, please
be sure to read and follow the Contributor's Guide. It
lays out basic best practices, which, if followed will reduce unnecessary back
and forth and, ultimately, minimize the time it takes to get your change into
the library.

@gadol21
Copy link
Contributor Author

gadol21 commented Feb 23, 2026

Fixes #1344

Currently `func_pattern` is mandatory in `attach_uprobe_multi_with_opts`
Although in the C api it is optional, and mutually exclusive with some
other options. The rust api didn't allow passing null pointer, which
made it impossible to use `syms`/`offsets`/`ref_ctr_offsets`/`cookies`
from `opts` because of the following check -
https://github.com/libbpf/libbpf/blob/3b4f0ef5a6fa247ce1958d909c0e85e760249840/src/libbpf.c#L12172

Change was intentionally made in a way that doesn't break the existing
interface - interpret empty `func_pattern` string as non-existant
pattern. A more correct fix would probably be using an `Option` as this
is truely optional value, or structuring the api in a way that won't
allow passing mutually exclusive parameters.

Signed-off-by: Omer Kattan <omer.kattan@wiz.io>
@gadol21 gadol21 force-pushed the fix-uprobe-multi-ops branch from ca75690 to 00ad9ee Compare February 23, 2026 15:53
Copy link
Collaborator

@d-e-s-o d-e-s-o left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks!

@d-e-s-o d-e-s-o merged commit d4b39f1 into libbpf:master Feb 23, 2026
18 checks passed
d-e-s-o added a commit to d-e-s-o/libbpf-rs that referenced this pull request Feb 23, 2026
Add a CHANGELOG entry for pull request libbpf#1345, which adjusted
Program::attach_uprobe_multi_with_opts() to map an empty `func_pattern`
to a NULL pointer input to the underlying libbpf API, to enable
additional use cases.

Signed-off-by: Daniel Müller <deso@posteo.net>
d-e-s-o added a commit that referenced this pull request Feb 23, 2026
Add a CHANGELOG entry for pull request #1345, which adjusted
Program::attach_uprobe_multi_with_opts() to map an empty `func_pattern`
to a NULL pointer input to the underlying libbpf API, to enable
additional use cases.

Signed-off-by: Daniel Müller <deso@posteo.net>
@gadol21 gadol21 deleted the fix-uprobe-multi-ops branch February 24, 2026 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

attach_uprobe_multi_with_opts doesn't allow passing non-default options

2 participants