Skip to content

Commit

Permalink
Merge branch 'main' into upload_regression
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan-Jowett authored Nov 21, 2024
2 parents e46f1b4 + cb3833e commit 5f78f9e
Show file tree
Hide file tree
Showing 151 changed files with 5,558 additions and 3,992 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
/**/[Pp]kg/**
/**/[Pp]ackages/**
/**/[Bb]uild/**
/**/build_fuzzer/**
/**/.[Gg]radle/**
/**/[Rr]elease/**
/**/[Dd]ebug/**
Expand Down
77 changes: 77 additions & 0 deletions .onefuzz/OneFuzzConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,83 @@
}
}
}
},
{
"JobNotificationEmail": "[email protected]",
"Skip": false,
"TargetBuildBranches": [
"main"
],
"Fuzzer": {
"$type": "libfuzzer",
"FuzzingHarnessExecutableName": "ubpf_fuzzer.exe",
"CheckFuzzerHelp": true,
"FuzzingEntrypoint": "LLVMFuzzerTestOneInput",
"CollectCrashDumps": true,
"FuzzingTargetBinaries": [
"ebpapi.sys"
]
},
"MinAvailableMemoryMB": null,
"FuzzerTimeoutInSeconds": 120,
"RebootAfterSetup": null,
"Tags": {},
"TargetEnv": {
"ASAN_OPTIONS": "allocator_may_return_null=1",
"UBPF_FUZZER_CONSTRAINT_CHECK": "1"
},
"OneFuzzJobs": [
{
"ProjectName": "eBPF for Windows",
"TargetName": "ubpf",
"SeedCorpusContainer": "ubpf-corpus",
"Tags": {},
"TargetEnv": {
"ASAN_OPTIONS": "allocator_may_return_null=1"
}
}
],
"JobDependencies": [
"ubpf_fuzzer.exe",
"ubpf_fuzzer.pdb",
"clang_rt.asan_dbg_dynamic-x86_64.dll",
"clang_rt.asan_dynamic-x86_64.dll",
"msvcp140d.dll",
"msvcp140d_atomic_wait.dll",
"msvcp140d_codecvt_ids.dll",
"msvcp140_1d.dll",
"msvcp140_2d.dll",
"vccorlib140d.dll",
"vcruntime140d.dll",
"vcruntime140_1d.dll",
"vcruntime140_threadsd.dll",
"ucrtbased.dll"
],
"CodeCoverage": {
"Org": "microsoft",
"Project": "OS",
"PipelineId": "79576"
},
"AdoTemplate": {
"Org": "mscodehub",
"Project": "eBPFForWindows",
"AssignedTo": "[email protected]",
"AreaPath": "eBPFForWindows",
"IterationPath": "eBPFForWindows",
"Type": "Bug",
"BaseUrl": "https://dev.azure.com/mscodehub",
"Comment": "<a href='{{ input_url }}'>This input</a> caused the <a href='{{ target_url }}'>fuzz target</a> {{ report.executable }} to crash. The faulting input SHA256 hash is {{ report.input_sha256 }} <br>",
"OnDuplicate": {
"Increment": [
""
],
"Comment": "<a href='{{ input_url }}'>This input</a> caused the <a href='{{ target_url }}'>fuzz target</a> {{ report.executable }} to crash. The faulting input SHA256 hash is {{ report.input_sha256 }} <br>",
"SetState": {
"Resolved": "Active",
"Closed": "Active"
}
}
}
}
]
}
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" TreatAsLocalProperty="Platform">
<PropertyGroup Label="Version">
<EbpfVersion_Major>0</EbpfVersion_Major>
<EbpfVersion_Minor>20</EbpfVersion_Minor>
<EbpfVersion_Minor>21</EbpfVersion_Minor>
<EbpfVersion_Revision>0</EbpfVersion_Revision>
<EbpfVersion>$(EbpfVersion_Major).$(EbpfVersion_Minor).$(EbpfVersion_Revision)</EbpfVersion>
</PropertyGroup>
Expand Down
1,260 changes: 1,230 additions & 30 deletions ebpf-for-windows.sln

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion external/ubpf
Submodule ubpf updated 35 files
+2 −2 .github/workflows/dependency-review.yml
+126 −14 .github/workflows/fuzzing.yml
+4 −2 .github/workflows/main.yml
+5 −5 .github/workflows/posix.yml
+2 −2 .github/workflows/scorecards.yml
+1 −1 .github/workflows/update-docs.yml
+11 −3 .github/workflows/windows.yml
+1 −1 .gitmodules
+5 −0 CMakeLists.txt
+0 −0 custom_tests/data/ubpf_test_custom_local_function_stack_size.input
+1 −0 custom_tests/data/ubpf_test_custom_local_function_stack_size_zero.input
+1 −0 custom_tests/data/ubpf_test_default_local_function_stack_size.input
+0 −0 custom_tests/descrs/ubpf_test_custom_local_function_stack_size.md
+11 −0 custom_tests/descrs/ubpf_test_custom_local_function_stack_size_unaligned.md
+60 −0 custom_tests/descrs/ubpf_test_custom_local_function_stack_size_zero.md
+40 −0 custom_tests/descrs/ubpf_test_default_local_function_stack_size.md
+43 −3 custom_tests/srcs/ubpf_test_custom_local_function_stack_size.cc
+58 −0 custom_tests/srcs/ubpf_test_custom_local_function_stack_size_unaligned.cc
+116 −0 custom_tests/srcs/ubpf_test_custom_local_function_stack_size_zero.cc
+116 −0 custom_tests/srcs/ubpf_test_default_local_function_stack_size.cc
+1 −1 external/bpf_conformance
+1 −1 external/ebpf-verifier
+11 −16 libfuzzer/CMakeLists.txt
+66 −32 libfuzzer/libfuzz_harness.cc
+25 −0 tests/call_local_use_stack.data
+13 −0 tests/err-call-invalid-jump.data
+2 −0 tests/err-call0.data
+147 −0 ubpf/dictionary_generator.py
+0 −23 ubpf_plugin/ubpf_plugin.cc
+1 −0 vm/CMakeLists.txt
+19 −6 vm/inc/ubpf.h
+1,010 −0 vm/ubpf_instruction_valid.c
+20 −1 vm/ubpf_int.h
+21 −3 vm/ubpf_jit_arm64.c
+181 −32 vm/ubpf_vm.c
12 changes: 12 additions & 0 deletions libs/ubpf/kernel/ubpf_kernel.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,17 @@
#define strerror place_holder_strerror
#define errno (place_holder_errno())

#if !defined(NDEBUG)
void
_assert(const char* message, const char* file, unsigned line)
{
UNREFERENCED_PARAMETER(message);
UNREFERENCED_PARAMETER(file);
UNREFERENCED_PARAMETER(line);
__fastfail(0);
}
#endif

inline int
fprintf(void* stream, const char* format, ...)
{
Expand Down Expand Up @@ -128,5 +139,6 @@ void __cdecl abort(void) { KeBugCheck(PAGE_FAULT_IN_NONPAGED_AREA); }
#include "ubpf_vm.c"
#pragma warning(push)
#pragma warning(disable : 6387) // ubpf_jit.c(70): error C6387: 'buffer' could be '0'
#include "ubpf_instruction_valid.c"
#include "ubpf_jit.c"
#pragma warning(pop)
1 change: 1 addition & 0 deletions libs/ubpf/user/ubpf_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
// Windows headers define near and far which conflict with the ubpf headers.
#undef near
#undef far
#include "ubpf_instruction_valid.c"
#include "ubpf_jit.c"
#include "ubpf_jit_support.c"
#include "ubpf_jit_x86_64.c"
Expand Down
2 changes: 2 additions & 0 deletions scripts/initialize_ebpf_repo.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ $commands = @(
"cmake $cmakeCommonArgs -S external\ebpf-verifier -B external\ebpf-verifier\build",
"cmake $cmakeCommonArgs -S external\catch2 -B external\catch2\build -DBUILD_TESTING=OFF",
"cmake $cmakeCommonArgs -S external\ubpf -B external\ubpf\build",
"cmake $cmakeCommonArgs -S external\ubpf -B external\ubpf\build_fuzzer -DUBPF_ENABLE_LIBFUZZER=on",
"nuget restore ebpf-for-windows.sln"
)

Expand All @@ -36,4 +37,5 @@ foreach ($command in $commands) {
Exit $LASTEXITCODE
}
}

Write-Host "All commands succeeded."
165 changes: 165 additions & 0 deletions scripts/ubpf_fuzzer_post_build/ubpf_fuzzer_post_build.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (c) eBPF for Windows contributors
SPDX-License-Identifier: MIT
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="FuzzerDebug|x64">
<Configuration>FuzzerDebug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="NativeOnlyDebug|x64">
<Configuration>NativeOnlyDebug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="NativeOnlyRelease|x64">
<Configuration>NativeOnlyRelease</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{3d563e44-b7d0-499c-a15c-c1c1b9a73b6f}</ProjectGuid>
<RootNamespace>ubpffuzzerpostbuild</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Utility</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Utility</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='FuzzerDebug|x64'">
<PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
<ConfigurationType>Utility</ConfigurationType>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='NativeOnlyDebug|x64'">
<ConfigurationType>Utility</ConfigurationType>
<PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='NativeOnlyRelease|x64'">
<ConfigurationType>Utility</ConfigurationType>
<PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<PostBuildEvent>
<Command>copy $(SolutionDir)external\ubpf\build_fuzzer\bin\$(Configuration)\* $(OutDir)</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<PostBuildEvent>
<Command>copy $(SolutionDir)external\ubpf\build_fuzzer\bin\$(Configuration)\* $(OutDir)</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='FuzzerDebug|x64'">
<PostBuildEvent>
<Command>copy $(SolutionDir)external\ubpf\build_fuzzer\bin\RelWithDebInfo\* $(OutDir)</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (c) eBPF for Windows contributors
SPDX-License-Identifier: MIT
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ static void
_get_version(_Out_ bpf2c_version_t* version)
{
version->major = 0;
version->minor = 20;
version->minor = 21;
version->revision = 0;
}

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

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

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 @@ -181,7 +181,7 @@ static void
_get_version(_Out_ bpf2c_version_t* version)
{
version->major = 0;
version->minor = 20;
version->minor = 21;
version->revision = 0;
}

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 @@ -155,7 +155,7 @@ static void
_get_version(_Out_ bpf2c_version_t* version)
{
version->major = 0;
version->minor = 20;
version->minor = 21;
version->revision = 0;
}

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 @@ -316,7 +316,7 @@ static void
_get_version(_Out_ bpf2c_version_t* version)
{
version->major = 0;
version->minor = 20;
version->minor = 21;
version->revision = 0;
}

Expand Down
Loading

0 comments on commit 5f78f9e

Please sign in to comment.