Skip to content
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

Release v0.14.1 #3265

Merged
merged 4 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion docs/eBpfExtensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ Helper function IDs for different program types need not be unique.
* `return_type`: Set the appropriate value for the `ebpf_return_type_t` enum that represents the return type of the
helper function.
* `arguments`: Array of (at most) five helper function arguments of type `ebpf_argument_type_t`.
* `reallocate_packet`: Flag indicating if this helper function performs packet reallocation.

#### `ebpf_argument_type_t` Enum
This enum describes the various argument types that can be passed to an eBPF helper function. This is defined in the
Expand Down
5 changes: 0 additions & 5 deletions include/ebpf_program_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@

#include <guiddef.h>
#if !defined(NO_CRT) && !defined(_NO_CRT_STDIO_INLINE)
#include <stdbool.h>
#include <stdint.h>
#else
typedef unsigned char uint8_t;
typedef unsigned int uint32_t;
typedef unsigned long long uint64_t;
typedef unsigned short wchar_t;
#define bool _Bool
#endif

#define EBPF_MAX_PROGRAM_DESCRIPTOR_NAME_LENGTH 256
Expand All @@ -29,15 +27,12 @@ typedef struct _ebpf_program_type_descriptor
char is_privileged;
} ebpf_program_type_descriptor_t;

#define HELPER_FUNCTION_REALLOCATE_PACKET 0x1

typedef struct _ebpf_helper_function_prototype
{
uint32_t helper_id;
const char* name;
ebpf_return_type_t return_type;
ebpf_argument_type_t arguments[5];
bool reallocate_packet : 1;
} ebpf_helper_function_prototype_t;

typedef struct _ebpf_program_info
Expand Down
2 changes: 1 addition & 1 deletion installer/Product.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ SPDX-License-Identifier: MIT
<?define ProductVersion="022C44B5-8969-4B75-8DB0-73F98B1BD7DC"?>
<?define UpgradeCode="B6BCACB1-C872-4159-ABCB-43A50668056C"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:ui="http://schemas.microsoft.com/wix/UIExtension" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Product Id="$(var.ProductVersion)" Name="eBPF for Windows" Language="1033" Version="0.14.0" Manufacturer="Microsoft" UpgradeCode="$(var.UpgradeCode)">
<Product Id="$(var.ProductVersion)" Name="eBPF for Windows" Language="1033" Version="0.14.1" Manufacturer="Microsoft" UpgradeCode="$(var.UpgradeCode)">
<Package Description="eBPF for Windows" InstallerVersion="301" Compressed="yes" InstallScope="perMachine" Manufacturer="Microsoft" Platform="x64" />
<MajorUpgrade AllowSameVersionUpgrades="yes"
Disallow="yes" DisallowUpgradeErrorMessage="An older version of [ProductName] is already installed. Please remove it first."
Expand Down
7 changes: 1 addition & 6 deletions libs/api_common/store_helper_internal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,8 @@ _load_helper_prototype(

// Read serialized helper prototype information.
char serialized_data[sizeof(ebpf_helper_function_prototype_t)] = {0};
bool reallocate_packet = false;
size_t expected_size = sizeof(helper_prototype->helper_id) + sizeof(helper_prototype->return_type) +
sizeof(helper_prototype->arguments) + sizeof(reallocate_packet);
sizeof(helper_prototype->arguments);

status = ebpf_read_registry_value_binary(
helper_info_key, EBPF_HELPER_DATA_PROTOTYPE, (uint8_t*)serialized_data, expected_size);
Expand All @@ -67,10 +66,6 @@ _load_helper_prototype(
memcpy(&helper_prototype->arguments, serialized_data + offset, sizeof(helper_prototype->arguments));
offset += sizeof(helper_prototype->arguments);

memcpy(&reallocate_packet, serialized_data + offset, sizeof(reallocate_packet));
helper_prototype->reallocate_packet = reallocate_packet ? HELPER_FUNCTION_REALLOCATE_PACKET : 0;
offset += sizeof(reallocate_packet);

helper_prototype->name =
cxplat_duplicate_string(ebpf_down_cast_from_wstring(std::wstring(helper_name)).c_str());
if (helper_prototype->name == nullptr) {
Expand Down
2 changes: 0 additions & 2 deletions libs/api_common/windows_helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,5 @@ get_helper_prototype_windows(int32_t n)
verifier_prototype.argument_type[i] = raw_prototype->arguments[i];
}

verifier_prototype.reallocate_packet = raw_prototype->reallocate_packet == TRUE;

return verifier_prototype;
}
8 changes: 0 additions & 8 deletions libs/execution_context/ebpf_program.c
Original file line number Diff line number Diff line change
Expand Up @@ -2063,7 +2063,6 @@ _IRQL_requires_max_(PASSIVE_LEVEL) static ebpf_result_t _ebpf_program_compute_pr
// b. Helper name.
// c. Helper return type.
// d. Helper argument types.
// e. reallocate_packet flag (if set).

// Note:
// Order and fields being hashed is important. The order and fields being hashed must match the order and fields
Expand Down Expand Up @@ -2129,13 +2128,6 @@ _IRQL_requires_max_(PASSIVE_LEVEL) static ebpf_result_t _ebpf_program_compute_pr
goto Exit;
}
}

if (helper_function_prototype->reallocate_packet) {
result = EBPF_CRYPTOGRAPHIC_HASH_APPEND_STR(cryptographic_hash, "reallocate_packet");
if (result != EBPF_SUCCESS) {
goto Exit;
}
}
}
*hash_length = 0;
result = ebpf_cryptographic_hash_get_hash_length(cryptographic_hash, hash_length);
Expand Down
7 changes: 1 addition & 6 deletions libs/shared/ebpf_serialize.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ typedef struct _ebpf_serialized_helper_function_prototype
uint32_t helper_id;
ebpf_return_type_t return_type;
ebpf_argument_type_t arguments[5];
uint8_t reallocate_packet;
size_t name_length;
uint8_t name[1];
} ebpf_serialized_helper_function_prototype_t;
Expand Down Expand Up @@ -463,8 +462,6 @@ ebpf_serialize_program_info(
for (uint16_t index = 0; index < EBPF_COUNT_OF(helper_prototype->arguments); index++) {
serialized_helper_prototype->arguments[index] = helper_prototype->arguments[index];
}
serialized_helper_prototype->reallocate_packet =
helper_prototype->reallocate_packet ? HELPER_FUNCTION_REALLOCATE_PACKET : 0;
serialized_helper_prototype->name_length = helper_function_name_length;
// Copy the program type descriptor name buffer.
memcpy(serialized_helper_prototype->name, helper_prototype->name, helper_function_name_length);
Expand Down Expand Up @@ -630,14 +627,12 @@ ebpf_deserialize_program_info(
goto Exit;
}

// Deserialize helper prototype.
// Serialize helper prototype.
helper_prototype->helper_id = serialized_helper_prototype->helper_id;
helper_prototype->return_type = serialized_helper_prototype->return_type;
for (int i = 0; i < EBPF_COUNT_OF(helper_prototype->arguments); i++) {
helper_prototype->arguments[i] = serialized_helper_prototype->arguments[i];
}
helper_prototype->reallocate_packet =
serialized_helper_prototype->reallocate_packet == HELPER_FUNCTION_REALLOCATE_PACKET;

// Adjust remaining buffer length.
result = ebpf_safe_size_t_subtract(
Expand Down
5 changes: 1 addition & 4 deletions libs/store_helper/ebpf_store_helper.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft Corporation
// SPDX-License-Identifier: MIT

#include "ebpf_program_types.h"
#include "ebpf_registry_helper.h"
#include "ebpf_store_helper.h"
#include "ebpf_windows.h"
Expand Down Expand Up @@ -40,7 +41,6 @@ _ebpf_store_update_helper_prototype(
uint32_t offset;
ebpf_store_key_t helper_function_key = NULL;
char serialized_data[sizeof(ebpf_helper_function_prototype_t)] = {0};
const bool reallocate_packet = helper_info->reallocate_packet;

wchar_t* wide_helper_name = ebpf_get_wstring_from_string(helper_info->name);
if (wide_helper_name == NULL) {
Expand All @@ -63,9 +63,6 @@ _ebpf_store_update_helper_prototype(
memcpy(serialized_data + offset, helper_info->arguments, sizeof(helper_info->arguments));
offset += sizeof(helper_info->arguments);

memcpy(serialized_data + offset, &reallocate_packet, sizeof(reallocate_packet));
offset += sizeof(reallocate_packet);

// Save the helper prototype data.
result = ebpf_write_registry_value_binary(
helper_function_key, EBPF_HELPER_DATA_PROTOTYPE, (uint8_t*)&serialized_data[0], offset);
Expand Down
3 changes: 1 addition & 2 deletions netebpfext/net_ebpf_ext_program_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ static const ebpf_helper_function_prototype_t _xdp_test_ebpf_extension_helper_fu
{XDP_EXT_HELPER_FUNCTION_START + 1,
"bpf_xdp_adjust_head",
EBPF_RETURN_TYPE_INTEGER,
{EBPF_ARGUMENT_TYPE_PTR_TO_CTX, EBPF_ARGUMENT_TYPE_ANYTHING},
HELPER_FUNCTION_REALLOCATE_PACKET}};
{EBPF_ARGUMENT_TYPE_PTR_TO_CTX, EBPF_ARGUMENT_TYPE_ANYTHING}}};

// XDP_TEST program information.
static const ebpf_context_descriptor_t _ebpf_xdp_test_context_descriptor = {
Expand Down
2 changes: 1 addition & 1 deletion resource/ebpf_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#define EBPF_VERSION_MAJOR 0
#define EBPF_VERSION_MINOR 14
#define EBPF_VERSION_REVISION 0
#define EBPF_VERSION_REVISION 1

#define QUOTE(str) #str
#define EXPAND_AND_QUOTE(str) QUOTE(str)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ _get_version(_Out_ bpf2c_version_t* version)
{
version->major = 0;
version->minor = 14;
version->revision = 0;
version->revision = 1;
}

static void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ _get_version(_Out_ bpf2c_version_t* version)
{
version->major = 0;
version->minor = 14;
version->revision = 0;
version->revision = 1;
}

static void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ _get_version(_Out_ bpf2c_version_t* version)
{
version->major = 0;
version->minor = 14;
version->revision = 0;
version->revision = 1;
}

static void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ _get_version(_Out_ bpf2c_version_t* version)
{
version->major = 0;
version->minor = 14;
version->revision = 0;
version->revision = 1;
}

static void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ _get_version(_Out_ bpf2c_version_t* version)
{
version->major = 0;
version->minor = 14;
version->revision = 0;
version->revision = 1;
}

static void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ _get_version(_Out_ bpf2c_version_t* version)
{
version->major = 0;
version->minor = 14;
version->revision = 0;
version->revision = 1;
}

static void
Expand Down
2 changes: 1 addition & 1 deletion tests/bpf2c_tests/expected/bad_map_name_dll.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ _get_version(_Out_ bpf2c_version_t* version)
{
version->major = 0;
version->minor = 14;
version->revision = 0;
version->revision = 1;
}

static void
Expand Down
2 changes: 1 addition & 1 deletion tests/bpf2c_tests/expected/bad_map_name_raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ _get_version(_Out_ bpf2c_version_t* version)
{
version->major = 0;
version->minor = 14;
version->revision = 0;
version->revision = 1;
}

static void
Expand Down
2 changes: 1 addition & 1 deletion tests/bpf2c_tests/expected/bad_map_name_sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ _get_version(_Out_ bpf2c_version_t* version)
{
version->major = 0;
version->minor = 14;
version->revision = 0;
version->revision = 1;
}

static void
Expand Down
2 changes: 1 addition & 1 deletion tests/bpf2c_tests/expected/bindmonitor_dll.c
Original file line number Diff line number Diff line change
Expand Up @@ -2022,7 +2022,7 @@ _get_version(_Out_ bpf2c_version_t* version)
{
version->major = 0;
version->minor = 14;
version->revision = 0;
version->revision = 1;
}

static void
Expand Down
2 changes: 1 addition & 1 deletion tests/bpf2c_tests/expected/bindmonitor_mt_tailcall_dll.c
Original file line number Diff line number Diff line change
Expand Up @@ -6192,7 +6192,7 @@ _get_version(_Out_ bpf2c_version_t* version)
{
version->major = 0;
version->minor = 14;
version->revision = 0;
version->revision = 1;
}

static void
Expand Down
2 changes: 1 addition & 1 deletion tests/bpf2c_tests/expected/bindmonitor_mt_tailcall_raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -6166,7 +6166,7 @@ _get_version(_Out_ bpf2c_version_t* version)
{
version->major = 0;
version->minor = 14;
version->revision = 0;
version->revision = 1;
}

static void
Expand Down
2 changes: 1 addition & 1 deletion tests/bpf2c_tests/expected/bindmonitor_mt_tailcall_sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -6327,7 +6327,7 @@ _get_version(_Out_ bpf2c_version_t* version)
{
version->major = 0;
version->minor = 14;
version->revision = 0;
version->revision = 1;
}

static void
Expand Down
2 changes: 1 addition & 1 deletion tests/bpf2c_tests/expected/bindmonitor_raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -1996,7 +1996,7 @@ _get_version(_Out_ bpf2c_version_t* version)
{
version->major = 0;
version->minor = 14;
version->revision = 0;
version->revision = 1;
}

static void
Expand Down
2 changes: 1 addition & 1 deletion tests/bpf2c_tests/expected/bindmonitor_ringbuf_dll.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ _get_version(_Out_ bpf2c_version_t* version)
{
version->major = 0;
version->minor = 14;
version->revision = 0;
version->revision = 1;
}

static void
Expand Down
2 changes: 1 addition & 1 deletion tests/bpf2c_tests/expected/bindmonitor_ringbuf_raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ _get_version(_Out_ bpf2c_version_t* version)
{
version->major = 0;
version->minor = 14;
version->revision = 0;
version->revision = 1;
}

static void
Expand Down
2 changes: 1 addition & 1 deletion tests/bpf2c_tests/expected/bindmonitor_ringbuf_sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ _get_version(_Out_ bpf2c_version_t* version)
{
version->major = 0;
version->minor = 14;
version->revision = 0;
version->revision = 1;
}

static void
Expand Down
2 changes: 1 addition & 1 deletion tests/bpf2c_tests/expected/bindmonitor_sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -2157,7 +2157,7 @@ _get_version(_Out_ bpf2c_version_t* version)
{
version->major = 0;
version->minor = 14;
version->revision = 0;
version->revision = 1;
}

static void
Expand Down
2 changes: 1 addition & 1 deletion tests/bpf2c_tests/expected/bindmonitor_tailcall_dll.c
Original file line number Diff line number Diff line change
Expand Up @@ -2233,7 +2233,7 @@ _get_version(_Out_ bpf2c_version_t* version)
{
version->major = 0;
version->minor = 14;
version->revision = 0;
version->revision = 1;
}

static void
Expand Down
2 changes: 1 addition & 1 deletion tests/bpf2c_tests/expected/bindmonitor_tailcall_raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -2207,7 +2207,7 @@ _get_version(_Out_ bpf2c_version_t* version)
{
version->major = 0;
version->minor = 14;
version->revision = 0;
version->revision = 1;
}

static void
Expand Down
2 changes: 1 addition & 1 deletion tests/bpf2c_tests/expected/bindmonitor_tailcall_sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -2368,7 +2368,7 @@ _get_version(_Out_ bpf2c_version_t* version)
{
version->major = 0;
version->minor = 14;
version->revision = 0;
version->revision = 1;
}

static void
Expand Down
2 changes: 1 addition & 1 deletion tests/bpf2c_tests/expected/bpf_call_dll.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ _get_version(_Out_ bpf2c_version_t* version)
{
version->major = 0;
version->minor = 14;
version->revision = 0;
version->revision = 1;
}

static void
Expand Down
2 changes: 1 addition & 1 deletion tests/bpf2c_tests/expected/bpf_call_raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ _get_version(_Out_ bpf2c_version_t* version)
{
version->major = 0;
version->minor = 14;
version->revision = 0;
version->revision = 1;
}

static void
Expand Down
2 changes: 1 addition & 1 deletion tests/bpf2c_tests/expected/bpf_call_sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ _get_version(_Out_ bpf2c_version_t* version)
{
version->major = 0;
version->minor = 14;
version->revision = 0;
version->revision = 1;
}

static void
Expand Down
Loading
Loading