-
Notifications
You must be signed in to change notification settings - Fork 652
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
program: retrieve xlated Instructions from Program #538
Conversation
Move things around so other similar info can be retrieved later. Adding xlated instructions in a follow-up commit. Signed-off-by: Timo Beckers <timo@isovalent.com>
a7c75e4
to
4833142
Compare
4833142
to
9c06a48
Compare
Add Instructions.Unmarshal() to unmarshal a binary instruction stream into an Instructions. Signed-off-by: Timo Beckers <timo@isovalent.com>
9c06a48
to
60f4b91
Compare
Allow introspecting instructions after they have been translated by and loaded into the kernel. Signed-off-by: Timo Beckers <timo@isovalent.com>
60f4b91
to
db0edcb
Compare
I see the comment that the instructions read out cannot be written back in. My original use case from #444 was to do exactly this (i.e. read out, prepend to, write back). Is there someway to retrieve the original stream of instructions to accomplish what I need from what’s been added here? |
@klueska I think this implementation does what you asked for, at least it provides the API for you to build your use case on top of. xlated instructions have BPF map IDs where map FDs used to be during load time. Walking the insns, calling At least now, you can also diff your ProgramSpec insns with the loaded Program insns and see what changed. Good luck! |
I have verified that moving from my custom code to this implementation works identically. The diff is fairly small: https://gitlab.com/nvidia/container-toolkit/libnvidia-container/-/merge_requests/127/diffs?commit_id=d21ac33cb0459e9277f61622ef99fc8d8fa91ca5 |
Allow introspecting instructions after they have been translated by and loaded into the kernel.
Just putting this up here for discussion, I remember there being some prior discussion around this a while back.
There's also the following cosmetic bug:
226 is the map's BPF ID, not its fd. Not sure if this needs to be taken into account.