diff --git a/ebpfcore/EbpfCore.vcxproj b/ebpfcore/EbpfCore.vcxproj index 2538d54d7b..ed39d5d140 100644 --- a/ebpfcore/EbpfCore.vcxproj +++ b/ebpfcore/EbpfCore.vcxproj @@ -124,7 +124,7 @@ %(AdditionalDependencies);$(DDK_LIB_PATH)\ntoskrnl.lib;$(DDK_LIB_PATH)\ndis.lib;$(DDK_LIB_PATH)\wdmsec.lib;$(DDK_LIB_PATH)\fwpkclnt.lib;$(SDK_LIB_PATH)\uuid.lib;$(DDK_LIB_PATH)\netio.lib;$(DDK_LIB_PATH)\ksecdd.lib $(OutDir);%(AdditionalLibraryDirectories) - /spdin:$(SolutionDir)spd\ebpfcore.spd %(AdditionalOptions) + /spgo /spdin:$(SolutionDir)spd\ebpfcore.spd %(AdditionalOptions) SHA256 @@ -144,7 +144,7 @@ %(AdditionalDependencies);$(DDK_LIB_PATH)\ntoskrnl.lib;$(DDK_LIB_PATH)\ndis.lib;$(DDK_LIB_PATH)\wdmsec.lib;$(DDK_LIB_PATH)\fwpkclnt.lib;$(SDK_LIB_PATH)\uuid.lib;$(DDK_LIB_PATH)\netio.lib;$(DDK_LIB_PATH)\ksecdd.lib $(OutDir);%(AdditionalLibraryDirectories) - /spdin:$(SolutionDir)spd\ebpfcore.spd %(AdditionalOptions) + /spgo /spdin:$(SolutionDir)spd\ebpfcore.spd %(AdditionalOptions) SHA256 diff --git a/libs/execution_context/ebpf_maps.c b/libs/execution_context/ebpf_maps.c index 6c5d12fc62..3a2555dd92 100644 --- a/libs/execution_context/ebpf_maps.c +++ b/libs/execution_context/ebpf_maps.c @@ -2540,15 +2540,18 @@ ebpf_map_get_program_from_entry(_Inout_ ebpf_map_t* map, size_t key_size, _In_re return NULL; } ebpf_map_type_t type = map->ebpf_map_definition.type; - if (ebpf_map_metadata_tables[type].get_object_from_entry == NULL) { + // This function should be invoked only for BPF_MAP_TYPE_PROG_ARRAY. + // We can bypass the metadata table lookup and directly call the function. + if (type != BPF_MAP_TYPE_PROG_ARRAY) { EBPF_LOG_MESSAGE_UINT64( EBPF_TRACELOG_LEVEL_ERROR, EBPF_TRACELOG_KEYWORD_MAP, "ebpf_map_get_program_from_entry not supported on map", - map->ebpf_map_definition.type); + type); return NULL; } - return (ebpf_program_t*)ebpf_map_metadata_tables[type].get_object_from_entry(map, key); + + return (ebpf_program_t*)_get_object_from_array_map_entry(map, key); } _Must_inspect_result_ ebpf_result_t diff --git a/spd/EbpfCore.spd b/spd/EbpfCore.spd new file mode 100644 index 0000000000..aa36d11dac Binary files /dev/null and b/spd/EbpfCore.spd differ