-
Notifications
You must be signed in to change notification settings - Fork 699
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
btf: fix some split BTF shortcomings #861
Conversation
API changes:
|
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.
Ack overall, but this needs to take the changes of #855 into account, I think there's some overlap with btf_spec.go:vmlinux{,Spec}
.
No other source code changes intended.
The kernel's BTF is currently cached in package ebpf, since there are some users that don't want to keep the cached types around. This is a problem if we want to this data from package btf. Move caching into the btf package, but provide a helper to remove the cached copy. Internal users of the package can also tell whether the kernel BTF comes from /sys or from parsing a vmlinux ELF. This is useful when parsing kmod split BTF.
We currently punt on the user to provide us with a base spec to parse kmod BTF via a Handle. This isn't very ergonomic, and also unnecessary. If kmod / split BTF is present, we can also rely on /sys/... being available. We can therefore automatically use the (cached) kernel types when retrieving a Spec from a Handle.
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.
Thanks! Would like some clarification around the changes to TypeByID.
TypeByID currently assumes that the first ID in s.types is 0, which is not correct when dealing with split BTF.
Fix some outright bugs and some annoyances with split BTF support. It's still not entirely great, but this is better than nothing.
Requirement for #859.