-
Notifications
You must be signed in to change notification settings - Fork 685
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implement BPF_PROG_BIND_MAP #485
Conversation
Signed-off-by: Florian Lehner <dev@der-flo.net>
Signed-off-by: Florian Lehner <dev@der-flo.net>
Signed-off-by: Florian Lehner <dev@der-flo.net>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What has to happen to pick up the metadata from an ELF in libbpf style? Is it just "find a map with a specific name and bind it"? If yes, could you implement that? I'm asking because right now this is an API without a user inside the library itself, so I find it harder to evaluate.
The checks and limitations in
The above shown code results in two metadata entries from one eBPF map entry:
and the corresponding
While the |
Makes sense. Follow up question: should we always bind |
maybe a personal opinion but I don't think its a good idea to do so. E.g. to show the metadata |
No, but having the map bound is a prerequisite for metadata to work if there is only metadata in the section. Thinking about it that will probably fail for other reasons though. |
This PR implements the BPF_PROG_BIND_MAP functionality. While in general every map can be bind to a program,
bpftool
will only output and interpret data as metadata if the map meets some criteria:https://github.com/torvalds/linux/blob/66f4beaa6c1d28161f534471484b2daa2de1dce0/tools/bpf/bpftool/prog.c#L212-L219