@@ -1483,8 +1483,8 @@ ebpf_program_query_info(
14831483
14841484 size_t file_name_length = reply->section_name_offset - reply->file_name_offset ;
14851485 size_t section_name_length = reply->header .length - reply->section_name_offset ;
1486- char * local_file_name = reinterpret_cast <char *>(ebpf_allocate (file_name_length + 1 ));
1487- char * local_section_name = reinterpret_cast <char *>(ebpf_allocate (section_name_length + 1 ));
1486+ char * local_file_name = reinterpret_cast <char *>(ebpf_allocate_with_tag (file_name_length + 1 , EBPF_POOL_TAG_DEFAULT ));
1487+ char * local_section_name = reinterpret_cast <char *>(ebpf_allocate_with_tag (section_name_length + 1 , EBPF_POOL_TAG_DEFAULT ));
14881488
14891489 if (!local_file_name || !local_section_name) {
14901490 ebpf_free (local_file_name);
@@ -1656,7 +1656,7 @@ ebpf_program_attach(
16561656
16571657 ebpf_assert (program);
16581658
1659- ebpf_link_t * new_link = (ebpf_link_t *)ebpf_allocate (sizeof (ebpf_link_t ));
1659+ ebpf_link_t * new_link = (ebpf_link_t *)ebpf_allocate_with_tag (sizeof (ebpf_link_t ), EBPF_POOL_TAG_DEFAULT );
16601660 if (new_link == nullptr ) {
16611661 EBPF_RETURN_RESULT (EBPF_NO_MEMORY);
16621662 }
@@ -1712,7 +1712,7 @@ ebpf_program_attach_by_fd(
17121712 EBPF_LOG_ENTRY ();
17131713 ebpf_assert (link);
17141714
1715- ebpf_link_t * new_link = (ebpf_link_t *)ebpf_allocate (sizeof (ebpf_link_t ));
1715+ ebpf_link_t * new_link = (ebpf_link_t *)ebpf_allocate_with_tag (sizeof (ebpf_link_t ), EBPF_POOL_TAG_DEFAULT );
17161716 if (new_link == nullptr ) {
17171717 EBPF_RETURN_RESULT (EBPF_NO_MEMORY);
17181718 }
@@ -2286,7 +2286,7 @@ _initialize_ebpf_object_from_native_file(
22862286 object.execution_type = EBPF_EXECUTION_NATIVE;
22872287
22882288 for (ebpf_api_program_info_t * info = infos; info; info = info->next ) {
2289- program = (ebpf_program_t *)ebpf_allocate (sizeof (ebpf_program_t ));
2289+ program = (ebpf_program_t *)ebpf_allocate_with_tag (sizeof (ebpf_program_t ), EBPF_POOL_TAG_DEFAULT );
22902290 if (program == nullptr ) {
22912291 result = EBPF_NO_MEMORY;
22922292 goto Exit;
@@ -2580,7 +2580,7 @@ _ebpf_pe_get_map_definitions(
25802580 break ;
25812581 }
25822582
2583- map = (ebpf_map_t *)ebpf_allocate (sizeof (ebpf_map_t ));
2583+ map = (ebpf_map_t *)ebpf_allocate_with_tag (sizeof (ebpf_map_t ), EBPF_POOL_TAG_DEFAULT );
25842584 if (map == nullptr ) {
25852585 goto Error;
25862586 }
@@ -2759,7 +2759,7 @@ _ebpf_pe_add_section(
27592759 std::string elf_section_name = pe_context->section_names [pe_section_name];
27602760 std::string program_name = pe_context->program_names [pe_section_name];
27612761
2762- ebpf_api_program_info_t * info = (ebpf_api_program_info_t *)ebpf_allocate (sizeof (*info));
2762+ ebpf_api_program_info_t * info = (ebpf_api_program_info_t *)ebpf_allocate_with_tag (sizeof (*info), EBPF_POOL_TAG_DEFAULT );
27632763 if (info == nullptr ) {
27642764 pe_context->result = EBPF_NO_MEMORY;
27652765 return_value = 1 ;
@@ -2785,7 +2785,7 @@ _ebpf_pe_add_section(
27852785 info->expected_attach_type = pe_context->section_attach_types [pe_section_name];
27862786
27872787 info->raw_data_size = section_header.Misc .VirtualSize ;
2788- info->raw_data = (char *)ebpf_allocate (section_header.Misc .VirtualSize );
2788+ info->raw_data = (char *)ebpf_allocate_with_tag (section_header.Misc .VirtualSize , EBPF_POOL_TAG_DEFAULT );
27892789 if (info->raw_data == nullptr || info->section_name == nullptr ) {
27902790 pe_context->result = EBPF_NO_MEMORY;
27912791 return_value = 1 ;
@@ -3633,7 +3633,7 @@ _load_native_programs(
36333633 size_t buffer_size = offsetof (ebpf_operation_load_native_programs_reply_t , data) + handles_size;
36343634
36353635 if (count_of_maps > 0 ) {
3636- *map_handles = (ebpf_handle_t *)ebpf_allocate (map_handles_size);
3636+ *map_handles = (ebpf_handle_t *)ebpf_allocate_with_tag (map_handles_size, EBPF_POOL_TAG_DEFAULT );
36373637 if (*map_handles == nullptr ) {
36383638 EBPF_LOG_MESSAGE (
36393639 EBPF_TRACELOG_LEVEL_ERROR,
@@ -3645,7 +3645,7 @@ _load_native_programs(
36453645 }
36463646
36473647 if (count_of_programs > 0 ) {
3648- *program_handles = (ebpf_handle_t *)ebpf_allocate (program_handles_size);
3648+ *program_handles = (ebpf_handle_t *)ebpf_allocate_with_tag (program_handles_size, EBPF_POOL_TAG_DEFAULT );
36493649 if (*program_handles == nullptr ) {
36503650 EBPF_LOG_MESSAGE (
36513651 EBPF_TRACELOG_LEVEL_ERROR,
@@ -5222,3 +5222,20 @@ ebpf_map_set_wait_handle(fd_t map_fd, uint64_t index, ebpf_handle_t handle) NO_E
52225222 EBPF_RETURN_RESULT (result);
52235223}
52245224CATCH_NO_MEMORY_EBPF_RESULT
5225+
5226+ _Must_inspect_result_ ebpf_result_t
5227+ ebpf_link_mark_as_legacy_mode (fd_t link_fd) NO_EXCEPT_TRY
5228+ {
5229+ EBPF_LOG_ENTRY ();
5230+ ebpf_result_t result = EBPF_SUCCESS;
5231+ ebpf_handle_t link_handle = _get_handle_from_file_descriptor (link_fd);
5232+ if (link_handle == ebpf_handle_invalid) {
5233+ result = EBPF_INVALID_FD;
5234+ EBPF_RETURN_RESULT (result);
5235+ }
5236+ ebpf_operation_link_set_legacy_mode_request_t request{
5237+ sizeof (request), ebpf_operation_id_t ::EBPF_OPERATION_LINK_SET_LEGACY_MODE, link_handle};
5238+ result = win32_error_code_to_ebpf_result (invoke_ioctl (request));
5239+ EBPF_RETURN_RESULT (result);
5240+ }
5241+ CATCH_NO_MEMORY_EBPF_RESULT
0 commit comments