Fix attach_uprobe_multi_with_opts opts#1345
Merged
d-e-s-o merged 1 commit intolibbpf:masterfrom Feb 23, 2026
Merged
Conversation
Contributor
Author
|
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>
ca75690 to
00ad9ee
Compare
d-e-s-o
approved these changes
Feb 23, 2026
Collaborator
d-e-s-o
left a comment
There was a problem hiding this comment.
Looks good to me, thanks!
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently
func_patternis mandatory inattach_uprobe_multi_with_optsAlthough 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 usesyms/offsets/ref_ctr_offsets/cookiesfromoptsbecause 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.