-
Notifications
You must be signed in to change notification settings - Fork 248
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
Add versioning to native module NMR interface #4256
Add versioning to native module NMR interface #4256
Conversation
…thub.com/saxena-anurag/ebpf-for-windows-1 into user/anusa/multiple_load_native_module_2
…thub.com/saxena-anurag/ebpf-for-windows-1 into user/anusa/multiple_load_native_module_2
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.
Approving, but there's some more places that could benefit from "const" if you have to make other changes for any reason.
libs/execution_context/ebpf_native.c
Outdated
helper_function_entry_t* entry = | ||
(helper_function_entry_t*)ARRAY_ELEMENT_INDEX(helper_info, i, helper_entry_size); |
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.
helper_function_entry_t* entry = | |
(helper_function_entry_t*)ARRAY_ELEMENT_INDEX(helper_info, i, helper_entry_size); | |
const helper_function_entry_t* entry = | |
(const helper_function_entry_t*)ARRAY_ELEMENT_INDEX(helper_info, i, helper_entry_size); |
global_variable_section_info_t* global_variable_section_info = | ||
(global_variable_section_info_t*)ARRAY_ELEMENT_INDEX( |
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.
global_variable_section_info_t* global_variable_section_info = | |
(global_variable_section_info_t*)ARRAY_ELEMENT_INDEX( | |
const global_variable_section_info_t* global_variable_section_info = | |
(const global_variable_section_info_t*)ARRAY_ELEMENT_INDEX( |
@@ -718,22 +1002,26 @@ _ebpf_native_initialize_maps( | |||
} | |||
|
|||
for (uint32_t i = 0; i < map_count; i++) { | |||
if (maps[i].definition.pinning != LIBBPF_PIN_NONE && maps[i].definition.pinning != LIBBPF_PIN_BY_NAME) { | |||
// Copy the map_entry_t from native module to ebpf_native_map_t. | |||
map_entry_t* map_entry = (map_entry_t*)ARRAY_ELEMENT_INDEX(maps, i, map_entry_size); |
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.
map_entry_t* map_entry = (map_entry_t*)ARRAY_ELEMENT_INDEX(maps, i, map_entry_size); | |
const map_entry_t* map_entry = (const map_entry_t*)ARRAY_ELEMENT_INDEX(maps, i, map_entry_size); |
libs/execution_context/ebpf_native.c
Outdated
@@ -496,43 +792,30 @@ _ebpf_native_provider_attach_client_callback( | |||
ebpf_native_module_t** module = NULL; | |||
bool lock_acquired = false; | |||
metadata_table_t* table = NULL; |
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.
metadata_table_t* table = NULL; |
libs/execution_context/ebpf_native.c
Outdated
|
||
table = (metadata_table_t*)client_dispatch; |
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.
table = (metadata_table_t*)client_dispatch; | |
const metadata_table_t* table = (const metadata_table_t*)client_dispatch; |
libs/execution_context/ebpf_native.c
Outdated
memcpy(&local_global_section_info, global_variable_section_info, global_variable_section_info_size); | ||
global_variable_section_info = NULL; | ||
|
||
ebpf_native_map_t* native_map = _ebpf_native_find_map_by_name(instance, local_global_section_info.name); |
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.
ebpf_native_map_t* native_map = _ebpf_native_find_map_by_name(instance, local_global_section_info.name); | |
const ebpf_native_map_t* native_map = _ebpf_native_find_map_by_name(instance, local_global_section_info.name); |
…ithub.com/saxena-anurag/ebpf-for-windows-1 into user/anusa/native_module_npi_versioning_2
Fixes #4266
This pull request includes significant changes to the
include/bpf2c.h
andlibs/shared/shared_common.c
files to add version headers to various eBPF native module data structures. The changes also introduce new validation functions and update existing structures to include these headers.Introduction of Version Headers:
ebpf_native_module_header_t
to multiple data structures ininclude/bpf2c.h
to ensure backward compatibility and facilitate future extensions. [1] [2] [3] [4]include/bpf2c.h
.Validation Functions:
libs/shared/ebpf_shared_framework.h
.libs/shared/shared_common.c
.Updates to Existing Structures:
_ebpf_pe_get_map_definitions
inlibs/api/ebpf_api.cpp
to handle new alignment requirements for map entries.struct bpf_prog_info
ininclude/ebpf_structs.h
.Additional Changes:
ARRAY_ELEM_INDEX
macro fromlibs/shared/shared_common.c
tolibs/shared/ebpf_shared_framework.h
. [1] [2]These changes ensure that the eBPF native module data structures are backward compatible and can be extended in the future without breaking existing functionality.