diff --git a/libs/api/Verifier.cpp b/libs/api/Verifier.cpp index cfde83d276..87649df203 100644 --- a/libs/api/Verifier.cpp +++ b/libs/api/Verifier.cpp @@ -672,7 +672,6 @@ _ebpf_api_elf_verify_section_from_stream( { std::ostringstream error; std::ostringstream output; - struct _thread_local_storage_cache tls_cache; *report = nullptr; *error_message = nullptr; diff --git a/libs/api_common/api_common.cpp b/libs/api_common/api_common.cpp index 2ba71bd95d..cbbae504aa 100644 --- a/libs/api_common/api_common.cpp +++ b/libs/api_common/api_common.cpp @@ -151,7 +151,6 @@ ebpf_clear_thread_local_storage() noexcept { set_global_program_and_attach_type(nullptr, nullptr); clear_map_descriptors(); - clear_program_info_cache(); set_program_under_verification(ebpf_handle_invalid); set_verification_in_progress(false); clean_up_sync_device_handle(); diff --git a/libs/api_common/windows_platform_common.cpp b/libs/api_common/windows_platform_common.cpp index 9077b17931..4b276b66b6 100644 --- a/libs/api_common/windows_platform_common.cpp +++ b/libs/api_common/windows_platform_common.cpp @@ -98,14 +98,13 @@ struct _ebpf_section_info_deleter } }; -// Thread local cache for program information queried from execution context. +// Global cache for program information queried from execution context. typedef std::unique_ptr ebpf_program_info_ptr_t; -static thread_local std::map _program_info_cache; +static std::map _program_info_cache; -// Thread local cache for program descriptor queried from execution context. +// Global cache for program descriptor queried from execution context. typedef std::unique_ptr ebpf_program_descriptor_ptr_t; -static thread_local std::map - _program_descriptor_cache; +static std::map _program_descriptor_cache; // Global cache for the program and section information queried from eBPF store. typedef std::unique_ptr ebpf_section_info_ptr_t; @@ -742,6 +741,8 @@ _load_ebpf_provider_data() void clear_ebpf_provider_data() { + clear_program_info_cache(); + _windows_program_types.clear(); _windows_section_definitions.clear(); _windows_program_information.clear(); diff --git a/libs/shared/ebpf_serialize.c b/libs/shared/ebpf_serialize.c index 5df3cd2f77..384b17fe67 100644 --- a/libs/shared/ebpf_serialize.c +++ b/libs/shared/ebpf_serialize.c @@ -15,6 +15,7 @@ typedef struct _ebpf_serialized_program_type_descriptor size_t size; ebpf_context_descriptor_t context_descriptor; GUID program_type; + uint32_t bpf_prog_type; unsigned char is_privileged; size_t name_length; uint8_t name[1]; @@ -427,6 +428,7 @@ ebpf_serialize_program_info( serialized_program_type_descriptor->context_descriptor = *program_type_descriptor->context_descriptor; } serialized_program_type_descriptor->program_type = program_type_descriptor->program_type; + serialized_program_type_descriptor->bpf_prog_type = program_type_descriptor->bpf_prog_type; serialized_program_type_descriptor->is_privileged = program_type_descriptor->is_privileged; serialized_program_type_descriptor->name_length = program_type_descriptor_name_length; // Copy the program type descriptor name buffer. @@ -517,6 +519,7 @@ ebpf_deserialize_program_info( serialized_program_type_descriptor = (const ebpf_serialized_program_type_descriptor_t*)current; local_program_type_descriptor->program_type = serialized_program_type_descriptor->program_type; + local_program_type_descriptor->bpf_prog_type = serialized_program_type_descriptor->bpf_prog_type; local_program_type_descriptor->is_privileged = serialized_program_type_descriptor->is_privileged; // Allocate and deserialize context_descriptor, if present.