-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
loader: do ELF substitutions in memory #32059
Conversation
/test |
06da300
to
4a2b8a8
Compare
/test |
4a2b8a8
to
73bf363
Compare
/test |
73bf363
to
7fe560f
Compare
/ci-clustermesh |
7fe560f
to
3d6b5a5
Compare
/ci-clustermesh |
3d6b5a5
to
e7e252b
Compare
/ci-clustermesh |
/test |
2ef558c
to
5f456b0
Compare
/test |
5f456b0
to
9e99b7c
Compare
/ci-gingko |
/ci-ginkgo |
9e99b7c
to
69f37e7
Compare
/ci-ginkgo |
69f37e7
to
0765300
Compare
/test |
0765300
to
30a1c65
Compare
/test |
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.
👍
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.
@lmb Nice work and clean up!
Putting this back into draft. #32439 needs to go in first, so that I can add a debug tool. |
34f8451
to
7ee9341
Compare
7ee9341
to
63a5e4d
Compare
/test |
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.
🚀 Left a few nits
63a5e4d
to
2ef17ee
Compare
Signed-off-by: Lorenz Bauer <[email protected]>
Seems like a needless abstraction, remove it. Signed-off-by: Lorenz Bauer <[email protected]>
Compilation of an endpoint program creates a template.o symlink in the endpoint state directory. This is problematic since we really should be creating the file in the "next" state directory. Overall, the loader should not fiddle around in the endpoints state directory. Replace the symlink with template.txt in the endpoint state directory, which contains the hash of the used template. Importantly, we write this file from the endpoint code, not from the loader. Move the only user of template.o to template.txt. Signed-off-by: Lorenz Bauer <[email protected]>
In theory, we need to recompile the BPF for an endpoint any time its configuration changes. Compiling is fairly expensive, so a mechanism called ELF templating / substitution was developed to avoid recompilation in the most common cases. 1. bpf_lxc.c or bpf_host.c are compiled with a "generic" ep_config.h that contains placeholders into template.o. 2. For each endpoint, we replace all the placeholders in template.o and write a bpf_lxc.o, etc. 3. Each time we need to reload the datapath bpf_lxc.o is read from disk. Replacing the placeholders in step (2) works by parsing the ELF and manipulating the string table and data sections directly. I believe that this approach was chosen when the loader still relied on iproute2 to do all the loading. Now we use cilium/ebpf and the templating mechanism is becoming a problem. It is very hard to follow how it works and it impedes other refactoring. Replace ELF templating with manipulation of ebpf.CollectionSpec directly. Signed-off-by: Lorenz Bauer <[email protected]>
There are no users of the package left in the code base. Remove it. Signed-off-by: Lorenz Bauer <[email protected]>
2ef17ee
to
348cd86
Compare
/test |
@christarazi @qmonnet could you take a look please? This is finally ready! |
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.
ci-structure LGTM
pkg/bpf: allow overriding constants during load
loader: remove loader.ELFSubstitutions
loader: make EndpointHash infallible
loader: stop linking template.o into ep.StateDir()
loader: remove ELF substitution logic
remove pkg/elf