ebpf-for-windows/ebpfsvc/rpc_api.cpp

45 строки
1.2 KiB
C++
Исходник Обычный вид История

// Copyright (c) Microsoft Corporation
// SPDX-License-Identifier: MIT
#include "api_service.h"
#include "rpc_interface_h.h"
#include "svc_common.h"
#include <mutex>
#include <stdexcept>
#include <stdio.h>
#include <vector>
Registry changes for program and section data. (#1192) * fix * backup * fix backup * msbuild compiling * fix release build * fixes * cmake build fix * fix cmake build * fix analyse build * fix Signed-off-by: Anurag Saxena <43585259+saxena-anurag@users.noreply.github.com> * fix expected output * add pre step for tests * add pre step for tests * add -s option, revert this later * Revert "add -s option, revert this later" This reverts commit 1f42d100e45b296ede3cb9bc6712aca788b7acf6. * code cleanup Signed-off-by: Anurag Saxena <anusa@microsoft.com> * rename driver_registry_helper.h * delete bpf_structs.h * fix * hardcode HKLM * code cleanup * fix * backup * fix backup * msbuild compiling * fix release build * fixes * cmake build fix * fix cmake build * fix analyse build * fix Signed-off-by: Anurag Saxena <43585259+saxena-anurag@users.noreply.github.com> * add pre step for tests * add pre step for tests * add -s option, revert this later * Revert "add -s option, revert this later" This reverts commit 1f42d100e45b296ede3cb9bc6712aca788b7acf6. * code cleanup Signed-off-by: Anurag Saxena <anusa@microsoft.com> * rename driver_registry_helper.h * delete bpf_structs.h * fix * hardcode HKLM * code cleanup * fix build break * fix build break, enable warning * fix bad merge * cleanup * fix * fix tests * add tests, make ebpf_store_helper platform agnostic * fixes, cleanup, common code for store APIs * fix cmake build, driver tests * cleanup * code cleanup * cr comments * code cleanup * cleanup * bugfix * Apply suggestions from code review Co-authored-by: Dave Thaler <dthaler@microsoft.com> * cr comments * fix build break * move UM read store APIs to a different file * cr comments * cr comments * cr comments Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2022-07-01 02:53:03 +03:00
bool use_ebpf_store = false;
ebpf_result_t
ebpf_server_verify_and_load_program(
/* [ref][in] */ ebpf_program_load_info* info,
/* [ref][out] */ uint32_t* logs_size,
/* [ref][size_is][size_is][out] */ char** logs)
{
ebpf_result_t result;
if (info->instruction_count == 0) {
return EBPF_INVALID_ARGUMENT;
}
// Set the handle of program being verified in thread-local storage.
set_program_under_verification(reinterpret_cast<ebpf_handle_t>(info->program_handle));
result = ebpf_verify_and_load_program(
&info->program_type,
reinterpret_cast<ebpf_handle_t>(info->program_handle),
info->execution_context,
info->execution_type,
info->map_count,
info->handle_map,
info->instruction_count,
reinterpret_cast<ebpf_inst*>(info->instructions),
const_cast<const char**>(logs),
logs_size);
ebpf_clear_thread_local_storage();
return result;
}