Skip to content
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

Fix ebpf_program_batch_end_invoke_function_t definition and clean up NPI #2329

Merged
merged 2 commits into from
Apr 17, 2023

Conversation

mtfriesen
Copy link
Collaborator

@mtfriesen mtfriesen commented Apr 14, 2023

Description

The _ebpf_link_instance_invoke_batch_end definition in the eBPF implementation diverged from the ebpf_program_batch_end_invoke_function_t definition in the extension header: a state parameter was added to the implementation, but not the header.

  • Update the header to match the implementation.
  • To let the compiler catch this error, both in the eBPF project and in extension projects, explicitly define the dispatch table used to invoke programs.
  • Remove redundant (and erroneous) definitions throughout the eBPF test and sample codebase.

Resolves #2310

Testing

Builds locally. CI/CD should cover the rest.
Note: the batch begin/invoke/end routines do not appear to be tested via NPI dispatch tables in the eBPF project.

Documentation

Documentation updated.

dthaler
dthaler previously approved these changes Apr 14, 2023
@dthaler dthaler added the bug Something isn't working label Apr 14, 2023
docs/eBpfExtensions.md Outdated Show resolved Hide resolved
include/ebpf_extension.h Outdated Show resolved Hide resolved
shankarseal
shankarseal previously approved these changes Apr 17, 2023
@mtfriesen mtfriesen added this pull request to the merge queue Apr 17, 2023
@mtfriesen mtfriesen removed this pull request from the merge queue due to a manual request Apr 17, 2023
@Alan-Jowett Alan-Jowett added this pull request to the merge queue Apr 17, 2023
@mtfriesen mtfriesen dismissed stale reviews from shankarseal and dthaler via 94d20ac April 17, 2023 20:28
@@ -31,7 +24,7 @@ typedef struct _net_ebpf_extension_hook_client
GUID client_module_id; ///< NMR module Id.
const void* client_binding_context; ///< Client supplied context to be passed when invoking eBPF program.
const ebpf_extension_data_t* client_data; ///< Client supplied attach parameters.
ebpf_invoke_program_function_t invoke_program; ///< Pointer to function to invoke eBPF program.
ebpf_program_invoke_function_t invoke_program; ///< Pointer to function to invoke eBPF program.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the type rename? Previously "invoke_program" was an aptly named member because it was of type "invoke_program_function". But with this PR it no longer matches, and would be renamed "invoke_function". In short, I think the old type name is better and renaming it doesn't seem to have anything to do with the bug being fixed.

Copy link
Collaborator Author

@mtfriesen mtfriesen Apr 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description outlines the reasoning for why the change is being made, which I'll copy here for posterity:

  • To let the compiler catch this error, both in the eBPF project and in extension projects, explicitly define the dispatch table used to invoke programs.
  • Remove redundant (and erroneous) definitions throughout the eBPF test and sample codebase.

If the naming in a test file is preferred over the pre-existing, unmodified naming in the published eBPF extension header, I can go ahead and fix that, too.

Copy link
Collaborator Author

@mtfriesen mtfriesen Apr 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, I agree invoke_program is a better name, too.

Merged via the queue into microsoft:main with commit 664a612 Apr 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ebpf_program_batch_end_invoke_function_t declaration doesn't match implementation function prototype
5 participants