diff --git a/.gitmodules b/.gitmodules index b0598cd112..08641f5fa1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,6 @@ [submodule "external/ebpf-verifier"] path = external/ebpf-verifier - url = https://github.com/dthaler/ebpf-verifier.git + url = https://github.com/vbpf/ebpf-verifier.git [submodule "external/ubpf"] path = external/ubpf url = https://github.com/iovisor/ubpf.git diff --git a/ebpf-for-windows.sln b/ebpf-for-windows.sln index 9201a212be..4e357f47e9 100644 --- a/ebpf-for-windows.sln +++ b/ebpf-for-windows.sln @@ -6,7 +6,6 @@ MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ebpfverifier", "external\ebpf-verifier\build\ebpfverifier.vcxproj", "{7D5B4E68-C0FA-3F86-9405-F6400219B440}" ProjectSection(ProjectDependencies) = postProject {231EE32B-EBA4-4FE5-A55B-DB18F539D403} = {231EE32B-EBA4-4FE5-A55B-DB18F539D403} - {98D56B8A-D8EB-3D98-B8EE-C83696B4D58A} = {98D56B8A-D8EB-3D98-B8EE-C83696B4D58A} EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libs", "libs", "{B02E60AE-1254-459C-8824-AC6CDB6AE52E}" @@ -180,11 +179,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bpftool", "tools\bpftool\bp {231EE32B-EBA4-4FE5-A55B-DB18F539D403} = {231EE32B-EBA4-4FE5-A55B-DB18F539D403} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "yaml-cpp", "external\ebpf-verifier\build\yaml-cpp.vcxproj", "{98D56B8A-D8EB-3D98-B8EE-C83696B4D58A}" - ProjectSection(ProjectDependencies) = postProject - {231EE32B-EBA4-4FE5-A55B-DB18F539D403} = {231EE32B-EBA4-4FE5-A55B-DB18F539D403} - EndProjectSection -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bpf2c", "tools\bpf2c\bpf2c.vcxproj", "{69B97E52-18DC-434E-A6E4-4C0F3E88C44A}" ProjectSection(ProjectDependencies) = postProject {231EE32B-EBA4-4FE5-A55B-DB18F539D403} = {231EE32B-EBA4-4FE5-A55B-DB18F539D403} @@ -330,7 +324,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "usersim", "external\usersim {231EE32B-EBA4-4FE5-A55B-DB18F539D403} = {231EE32B-EBA4-4FE5-A55B-DB18F539D403} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbtf", "external\ebpf-verifier\build\external\libbtf\libbtf\libbtf.vcxproj", "{9FD0723C-6979-3D32-8D17-6CECA34B7026}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbtf", "external\ebpf-verifier\build\external\libbtf\libbtf\libbtf.vcxproj", "{249E3FBC-0098-3E3E-80AE-C8F8EF6AB0E5}" ProjectSection(ProjectDependencies) = postProject {231EE32B-EBA4-4FE5-A55B-DB18F539D403} = {231EE32B-EBA4-4FE5-A55B-DB18F539D403} EndProjectSection @@ -663,8 +657,6 @@ Global {21236F4F-341C-454F-B55B-C653897AB3E8}.NativeOnlyDebug|ARM64.ActiveCfg = Debug|ARM64 {21236F4F-341C-454F-B55B-C653897AB3E8}.NativeOnlyDebug|ARM64.Build.0 = Debug|ARM64 {21236F4F-341C-454F-B55B-C653897AB3E8}.NativeOnlyDebug|x64.ActiveCfg = Debug|x64 - {21236F4F-341C-454F-B55B-C653897AB3E8}.NativeOnlyDebug|x86.ActiveCfg = Debug|Win32 - {21236F4F-341C-454F-B55B-C653897AB3E8}.NativeOnlyDebug|x86.Build.0 = Debug|Win32 {21236F4F-341C-454F-B55B-C653897AB3E8}.NativeOnlyRelease|ARM64.ActiveCfg = Debug|x64 {21236F4F-341C-454F-B55B-C653897AB3E8}.NativeOnlyRelease|x64.ActiveCfg = Release|x64 {21236F4F-341C-454F-B55B-C653897AB3E8}.Release|ARM64.ActiveCfg = Release|ARM64 @@ -1263,34 +1255,6 @@ Global {CA179B38-EBF5-4371-B830-73486E35250B}.RelWithDebInfo|ARM64.Build.0 = Release|ARM64 {CA179B38-EBF5-4371-B830-73486E35250B}.RelWithDebInfo|x64.ActiveCfg = Release|x64 {CA179B38-EBF5-4371-B830-73486E35250B}.RelWithDebInfo|x64.Build.0 = Release|x64 - {98D56B8A-D8EB-3D98-B8EE-C83696B4D58A}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {98D56B8A-D8EB-3D98-B8EE-C83696B4D58A}.Debug|ARM64.Build.0 = Debug|ARM64 - {98D56B8A-D8EB-3D98-B8EE-C83696B4D58A}.Debug|x64.ActiveCfg = Debug|x64 - {98D56B8A-D8EB-3D98-B8EE-C83696B4D58A}.Debug|x64.Build.0 = Debug|x64 - {98D56B8A-D8EB-3D98-B8EE-C83696B4D58A}.FuzzerDebug|ARM64.ActiveCfg = Debug|ARM64 - {98D56B8A-D8EB-3D98-B8EE-C83696B4D58A}.FuzzerDebug|ARM64.Build.0 = Debug|ARM64 - {98D56B8A-D8EB-3D98-B8EE-C83696B4D58A}.FuzzerDebug|x64.ActiveCfg = Debug|x64 - {98D56B8A-D8EB-3D98-B8EE-C83696B4D58A}.FuzzerDebug|x64.Build.0 = Debug|x64 - {98D56B8A-D8EB-3D98-B8EE-C83696B4D58A}.MinSizeRel|ARM64.ActiveCfg = MinSizeRel|ARM64 - {98D56B8A-D8EB-3D98-B8EE-C83696B4D58A}.MinSizeRel|ARM64.Build.0 = MinSizeRel|ARM64 - {98D56B8A-D8EB-3D98-B8EE-C83696B4D58A}.MinSizeRel|x64.ActiveCfg = MinSizeRel|x64 - {98D56B8A-D8EB-3D98-B8EE-C83696B4D58A}.MinSizeRel|x64.Build.0 = MinSizeRel|x64 - {98D56B8A-D8EB-3D98-B8EE-C83696B4D58A}.NativeOnlyDebug|ARM64.ActiveCfg = Debug|ARM64 - {98D56B8A-D8EB-3D98-B8EE-C83696B4D58A}.NativeOnlyDebug|ARM64.Build.0 = Debug|ARM64 - {98D56B8A-D8EB-3D98-B8EE-C83696B4D58A}.NativeOnlyDebug|x64.ActiveCfg = Debug|x64 - {98D56B8A-D8EB-3D98-B8EE-C83696B4D58A}.NativeOnlyDebug|x64.Build.0 = Debug|x64 - {98D56B8A-D8EB-3D98-B8EE-C83696B4D58A}.NativeOnlyRelease|ARM64.ActiveCfg = Release|ARM64 - {98D56B8A-D8EB-3D98-B8EE-C83696B4D58A}.NativeOnlyRelease|ARM64.Build.0 = Release|ARM64 - {98D56B8A-D8EB-3D98-B8EE-C83696B4D58A}.NativeOnlyRelease|x64.ActiveCfg = Release|x64 - {98D56B8A-D8EB-3D98-B8EE-C83696B4D58A}.NativeOnlyRelease|x64.Build.0 = Release|x64 - {98D56B8A-D8EB-3D98-B8EE-C83696B4D58A}.Release|ARM64.ActiveCfg = Release|ARM64 - {98D56B8A-D8EB-3D98-B8EE-C83696B4D58A}.Release|ARM64.Build.0 = Release|ARM64 - {98D56B8A-D8EB-3D98-B8EE-C83696B4D58A}.Release|x64.ActiveCfg = Release|x64 - {98D56B8A-D8EB-3D98-B8EE-C83696B4D58A}.Release|x64.Build.0 = Release|x64 - {98D56B8A-D8EB-3D98-B8EE-C83696B4D58A}.RelWithDebInfo|ARM64.ActiveCfg = RelWithDebInfo|ARM64 - {98D56B8A-D8EB-3D98-B8EE-C83696B4D58A}.RelWithDebInfo|ARM64.Build.0 = RelWithDebInfo|ARM64 - {98D56B8A-D8EB-3D98-B8EE-C83696B4D58A}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64 - {98D56B8A-D8EB-3D98-B8EE-C83696B4D58A}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64 {69B97E52-18DC-434E-A6E4-4C0F3E88C44A}.Debug|ARM64.ActiveCfg = Debug|ARM64 {69B97E52-18DC-434E-A6E4-4C0F3E88C44A}.Debug|ARM64.Build.0 = Debug|ARM64 {69B97E52-18DC-434E-A6E4-4C0F3E88C44A}.Debug|x64.ActiveCfg = Debug|x64 @@ -1466,13 +1430,9 @@ Global {8DD6577A-CBBE-43FE-9FC3-E42CB013CC60}.NativeOnlyDebug|ARM64.ActiveCfg = Debug|ARM64 {8DD6577A-CBBE-43FE-9FC3-E42CB013CC60}.NativeOnlyDebug|ARM64.Build.0 = Debug|ARM64 {8DD6577A-CBBE-43FE-9FC3-E42CB013CC60}.NativeOnlyDebug|x64.ActiveCfg = Debug|x64 - {8DD6577A-CBBE-43FE-9FC3-E42CB013CC60}.NativeOnlyDebug|x86.ActiveCfg = Debug|Win32 - {8DD6577A-CBBE-43FE-9FC3-E42CB013CC60}.NativeOnlyDebug|x86.Build.0 = Debug|Win32 {8DD6577A-CBBE-43FE-9FC3-E42CB013CC60}.NativeOnlyRelease|ARM64.ActiveCfg = Release|x64 {8DD6577A-CBBE-43FE-9FC3-E42CB013CC60}.NativeOnlyRelease|ARM64.Build.0 = Release|x64 {8DD6577A-CBBE-43FE-9FC3-E42CB013CC60}.NativeOnlyRelease|x64.ActiveCfg = Release|x64 - {8DD6577A-CBBE-43FE-9FC3-E42CB013CC60}.NativeOnlyRelease|x86.ActiveCfg = Debug|Win32 - {8DD6577A-CBBE-43FE-9FC3-E42CB013CC60}.NativeOnlyRelease|x86.Build.0 = Debug|Win32 {8DD6577A-CBBE-43FE-9FC3-E42CB013CC60}.Release|ARM64.ActiveCfg = Release|x64 {8DD6577A-CBBE-43FE-9FC3-E42CB013CC60}.Release|ARM64.Build.0 = Release|x64 {8DD6577A-CBBE-43FE-9FC3-E42CB013CC60}.Release|x64.ActiveCfg = Release|x64 @@ -1708,13 +1668,9 @@ Global {F106D38A-AC35-4B5A-AEEE-7235E4915A72}.NativeOnlyDebug|ARM64.ActiveCfg = Debug|ARM64 {F106D38A-AC35-4B5A-AEEE-7235E4915A72}.NativeOnlyDebug|ARM64.Build.0 = Debug|ARM64 {F106D38A-AC35-4B5A-AEEE-7235E4915A72}.NativeOnlyDebug|x64.ActiveCfg = Debug|x64 - {F106D38A-AC35-4B5A-AEEE-7235E4915A72}.NativeOnlyDebug|x86.ActiveCfg = Debug|Win32 - {F106D38A-AC35-4B5A-AEEE-7235E4915A72}.NativeOnlyDebug|x86.Build.0 = Debug|Win32 {F106D38A-AC35-4B5A-AEEE-7235E4915A72}.NativeOnlyRelease|ARM64.ActiveCfg = Release|x64 {F106D38A-AC35-4B5A-AEEE-7235E4915A72}.NativeOnlyRelease|ARM64.Build.0 = Release|x64 {F106D38A-AC35-4B5A-AEEE-7235E4915A72}.NativeOnlyRelease|x64.ActiveCfg = Release|x64 - {F106D38A-AC35-4B5A-AEEE-7235E4915A72}.NativeOnlyRelease|x86.ActiveCfg = Debug|Win32 - {F106D38A-AC35-4B5A-AEEE-7235E4915A72}.NativeOnlyRelease|x86.Build.0 = Debug|Win32 {F106D38A-AC35-4B5A-AEEE-7235E4915A72}.Release|ARM64.ActiveCfg = Release|x64 {F106D38A-AC35-4B5A-AEEE-7235E4915A72}.Release|ARM64.Build.0 = Release|x64 {F106D38A-AC35-4B5A-AEEE-7235E4915A72}.Release|x64.ActiveCfg = Release|x64 @@ -1764,13 +1720,9 @@ Global {E619B985-44B3-4292-A585-5CD0C4315ED3}.NativeOnlyDebug|ARM64.ActiveCfg = Debug|ARM64 {E619B985-44B3-4292-A585-5CD0C4315ED3}.NativeOnlyDebug|ARM64.Build.0 = Debug|ARM64 {E619B985-44B3-4292-A585-5CD0C4315ED3}.NativeOnlyDebug|x64.ActiveCfg = Debug|x64 - {E619B985-44B3-4292-A585-5CD0C4315ED3}.NativeOnlyDebug|x86.ActiveCfg = Debug|Win32 - {E619B985-44B3-4292-A585-5CD0C4315ED3}.NativeOnlyDebug|x86.Build.0 = Debug|Win32 {E619B985-44B3-4292-A585-5CD0C4315ED3}.NativeOnlyRelease|ARM64.ActiveCfg = Release|x64 {E619B985-44B3-4292-A585-5CD0C4315ED3}.NativeOnlyRelease|ARM64.Build.0 = Release|x64 {E619B985-44B3-4292-A585-5CD0C4315ED3}.NativeOnlyRelease|x64.ActiveCfg = Release|x64 - {E619B985-44B3-4292-A585-5CD0C4315ED3}.NativeOnlyRelease|x86.ActiveCfg = Debug|Win32 - {E619B985-44B3-4292-A585-5CD0C4315ED3}.NativeOnlyRelease|x86.Build.0 = Debug|Win32 {E619B985-44B3-4292-A585-5CD0C4315ED3}.Release|ARM64.ActiveCfg = Release|x64 {E619B985-44B3-4292-A585-5CD0C4315ED3}.Release|ARM64.Build.0 = Release|x64 {E619B985-44B3-4292-A585-5CD0C4315ED3}.Release|x64.ActiveCfg = Release|x64 @@ -1971,34 +1923,34 @@ Global {030A7AC6-14DC-45CF-AF34-891057AB1402}.RelWithDebInfo|ARM64.Build.0 = Release|ARM64 {030A7AC6-14DC-45CF-AF34-891057AB1402}.RelWithDebInfo|x64.ActiveCfg = Release|x64 {030A7AC6-14DC-45CF-AF34-891057AB1402}.RelWithDebInfo|x64.Build.0 = Release|x64 - {9FD0723C-6979-3D32-8D17-6CECA34B7026}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {9FD0723C-6979-3D32-8D17-6CECA34B7026}.Debug|ARM64.Build.0 = Debug|ARM64 - {9FD0723C-6979-3D32-8D17-6CECA34B7026}.Debug|x64.ActiveCfg = Debug|x64 - {9FD0723C-6979-3D32-8D17-6CECA34B7026}.Debug|x64.Build.0 = Debug|x64 - {9FD0723C-6979-3D32-8D17-6CECA34B7026}.FuzzerDebug|ARM64.ActiveCfg = FuzzerDebug|ARM64 - {9FD0723C-6979-3D32-8D17-6CECA34B7026}.FuzzerDebug|ARM64.Build.0 = FuzzerDebug|ARM64 - {9FD0723C-6979-3D32-8D17-6CECA34B7026}.FuzzerDebug|x64.ActiveCfg = FuzzerDebug|x64 - {9FD0723C-6979-3D32-8D17-6CECA34B7026}.FuzzerDebug|x64.Build.0 = FuzzerDebug|x64 - {9FD0723C-6979-3D32-8D17-6CECA34B7026}.MinSizeRel|ARM64.ActiveCfg = MinSizeRel|ARM64 - {9FD0723C-6979-3D32-8D17-6CECA34B7026}.MinSizeRel|ARM64.Build.0 = MinSizeRel|ARM64 - {9FD0723C-6979-3D32-8D17-6CECA34B7026}.MinSizeRel|x64.ActiveCfg = MinSizeRel|x64 - {9FD0723C-6979-3D32-8D17-6CECA34B7026}.MinSizeRel|x64.Build.0 = MinSizeRel|x64 - {9FD0723C-6979-3D32-8D17-6CECA34B7026}.NativeOnlyDebug|ARM64.ActiveCfg = Debug|ARM64 - {9FD0723C-6979-3D32-8D17-6CECA34B7026}.NativeOnlyDebug|ARM64.Build.0 = Debug|ARM64 - {9FD0723C-6979-3D32-8D17-6CECA34B7026}.NativeOnlyDebug|x64.ActiveCfg = Debug|x64 - {9FD0723C-6979-3D32-8D17-6CECA34B7026}.NativeOnlyDebug|x64.Build.0 = Debug|x64 - {9FD0723C-6979-3D32-8D17-6CECA34B7026}.NativeOnlyRelease|ARM64.ActiveCfg = Release|ARM64 - {9FD0723C-6979-3D32-8D17-6CECA34B7026}.NativeOnlyRelease|ARM64.Build.0 = Release|ARM64 - {9FD0723C-6979-3D32-8D17-6CECA34B7026}.NativeOnlyRelease|x64.ActiveCfg = Release|x64 - {9FD0723C-6979-3D32-8D17-6CECA34B7026}.NativeOnlyRelease|x64.Build.0 = Release|x64 - {9FD0723C-6979-3D32-8D17-6CECA34B7026}.Release|ARM64.ActiveCfg = Release|ARM64 - {9FD0723C-6979-3D32-8D17-6CECA34B7026}.Release|ARM64.Build.0 = Release|ARM64 - {9FD0723C-6979-3D32-8D17-6CECA34B7026}.Release|x64.ActiveCfg = Release|x64 - {9FD0723C-6979-3D32-8D17-6CECA34B7026}.Release|x64.Build.0 = Release|x64 - {9FD0723C-6979-3D32-8D17-6CECA34B7026}.RelWithDebInfo|ARM64.ActiveCfg = RelWithDebInfo|ARM64 - {9FD0723C-6979-3D32-8D17-6CECA34B7026}.RelWithDebInfo|ARM64.Build.0 = RelWithDebInfo|ARM64 - {9FD0723C-6979-3D32-8D17-6CECA34B7026}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64 - {9FD0723C-6979-3D32-8D17-6CECA34B7026}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64 + {249E3FBC-0098-3E3E-80AE-C8F8EF6AB0E5}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {249E3FBC-0098-3E3E-80AE-C8F8EF6AB0E5}.Debug|ARM64.Build.0 = Debug|ARM64 + {249E3FBC-0098-3E3E-80AE-C8F8EF6AB0E5}.Debug|x64.ActiveCfg = Debug|x64 + {249E3FBC-0098-3E3E-80AE-C8F8EF6AB0E5}.Debug|x64.Build.0 = Debug|x64 + {249E3FBC-0098-3E3E-80AE-C8F8EF6AB0E5}.FuzzerDebug|ARM64.ActiveCfg = FuzzerDebug|ARM64 + {249E3FBC-0098-3E3E-80AE-C8F8EF6AB0E5}.FuzzerDebug|ARM64.Build.0 = FuzzerDebug|ARM64 + {249E3FBC-0098-3E3E-80AE-C8F8EF6AB0E5}.FuzzerDebug|x64.ActiveCfg = FuzzerDebug|x64 + {249E3FBC-0098-3E3E-80AE-C8F8EF6AB0E5}.FuzzerDebug|x64.Build.0 = FuzzerDebug|x64 + {249E3FBC-0098-3E3E-80AE-C8F8EF6AB0E5}.MinSizeRel|ARM64.ActiveCfg = MinSizeRel|ARM64 + {249E3FBC-0098-3E3E-80AE-C8F8EF6AB0E5}.MinSizeRel|ARM64.Build.0 = MinSizeRel|ARM64 + {249E3FBC-0098-3E3E-80AE-C8F8EF6AB0E5}.MinSizeRel|x64.ActiveCfg = MinSizeRel|x64 + {249E3FBC-0098-3E3E-80AE-C8F8EF6AB0E5}.MinSizeRel|x64.Build.0 = MinSizeRel|x64 + {249E3FBC-0098-3E3E-80AE-C8F8EF6AB0E5}.NativeOnlyDebug|ARM64.ActiveCfg = Debug|ARM64 + {249E3FBC-0098-3E3E-80AE-C8F8EF6AB0E5}.NativeOnlyDebug|ARM64.Build.0 = Debug|ARM64 + {249E3FBC-0098-3E3E-80AE-C8F8EF6AB0E5}.NativeOnlyDebug|x64.ActiveCfg = Debug|x64 + {249E3FBC-0098-3E3E-80AE-C8F8EF6AB0E5}.NativeOnlyDebug|x64.Build.0 = Debug|x64 + {249E3FBC-0098-3E3E-80AE-C8F8EF6AB0E5}.NativeOnlyRelease|ARM64.ActiveCfg = Release|ARM64 + {249E3FBC-0098-3E3E-80AE-C8F8EF6AB0E5}.NativeOnlyRelease|ARM64.Build.0 = Release|ARM64 + {249E3FBC-0098-3E3E-80AE-C8F8EF6AB0E5}.NativeOnlyRelease|x64.ActiveCfg = Release|x64 + {249E3FBC-0098-3E3E-80AE-C8F8EF6AB0E5}.NativeOnlyRelease|x64.Build.0 = Release|x64 + {249E3FBC-0098-3E3E-80AE-C8F8EF6AB0E5}.Release|ARM64.ActiveCfg = Release|ARM64 + {249E3FBC-0098-3E3E-80AE-C8F8EF6AB0E5}.Release|ARM64.Build.0 = Release|ARM64 + {249E3FBC-0098-3E3E-80AE-C8F8EF6AB0E5}.Release|x64.ActiveCfg = Release|x64 + {249E3FBC-0098-3E3E-80AE-C8F8EF6AB0E5}.Release|x64.Build.0 = Release|x64 + {249E3FBC-0098-3E3E-80AE-C8F8EF6AB0E5}.RelWithDebInfo|ARM64.ActiveCfg = RelWithDebInfo|ARM64 + {249E3FBC-0098-3E3E-80AE-C8F8EF6AB0E5}.RelWithDebInfo|ARM64.Build.0 = RelWithDebInfo|ARM64 + {249E3FBC-0098-3E3E-80AE-C8F8EF6AB0E5}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64 + {249E3FBC-0098-3E3E-80AE-C8F8EF6AB0E5}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64 {1937DB41-F3EB-4955-A636-6386DCB394F6}.Debug|ARM64.ActiveCfg = Debug|ARM64 {1937DB41-F3EB-4955-A636-6386DCB394F6}.Debug|ARM64.Build.0 = Debug|ARM64 {1937DB41-F3EB-4955-A636-6386DCB394F6}.Debug|x64.ActiveCfg = Debug|x64 @@ -2342,7 +2294,6 @@ Global {724EB55A-CCFC-4662-92E3-B664CDA365E7} = {492C9B22-9237-4996-9E33-CA14D3533616} {07DC6181-84A2-4A14-A806-5E9AF6C929C2} = {492C9B22-9237-4996-9E33-CA14D3533616} {CA179B38-EBF5-4371-B830-73486E35250B} = {B09749EC-3D14-414B-BA9B-CD20E218DC84} - {98D56B8A-D8EB-3D98-B8EE-C83696B4D58A} = {69CDB6A1-434D-4BC9-9BFF-D12DF7EDBB6B} {69B97E52-18DC-434E-A6E4-4C0F3E88C44A} = {B09749EC-3D14-414B-BA9B-CD20E218DC84} {61DF9973-81B9-4006-9148-52F58259BBCF} = {492C9B22-9237-4996-9E33-CA14D3533616} {8BD3552A-2CFB-4A59-AB15-2031B97ADA1E} = {492C9B22-9237-4996-9E33-CA14D3533616} @@ -2370,7 +2321,7 @@ Global {4F082524-9496-44FA-8CBA-4BC0BDC62568} = {492C9B22-9237-4996-9E33-CA14D3533616} {AA933B9F-B5D8-4AA8-AC18-98FE1A161E8A} = {69CDB6A1-434D-4BC9-9BFF-D12DF7EDBB6B} {030A7AC6-14DC-45CF-AF34-891057AB1402} = {69CDB6A1-434D-4BC9-9BFF-D12DF7EDBB6B} - {9FD0723C-6979-3D32-8D17-6CECA34B7026} = {69CDB6A1-434D-4BC9-9BFF-D12DF7EDBB6B} + {249E3FBC-0098-3E3E-80AE-C8F8EF6AB0E5} = {69CDB6A1-434D-4BC9-9BFF-D12DF7EDBB6B} {1937DB41-F3EB-4955-A636-6386DCB394F6} = {69CDB6A1-434D-4BC9-9BFF-D12DF7EDBB6B} {1FDAD2FD-EBD8-462A-B285-ED5174E55079} = {97D3096A-20FB-4ACB-A038-88E652FE61E3} {9388DD45-7941-45D7-B4FF-BC00F550AF17} = {69CDB6A1-434D-4BC9-9BFF-D12DF7EDBB6B} diff --git a/external/ebpf-verifier b/external/ebpf-verifier index 1dbf0bc8db..6025c9b998 160000 --- a/external/ebpf-verifier +++ b/external/ebpf-verifier @@ -1 +1 @@ -Subproject commit 1dbf0bc8db339b622ea5c3ff9414de9ccb1adf57 +Subproject commit 6025c9b998f7ad3cd3f45605169202bdf23c1878 diff --git a/include/linux/bpf.h b/include/linux/bpf.h index 63ae172f13..eefd2d3756 100644 --- a/include/linux/bpf.h +++ b/include/linux/bpf.h @@ -92,7 +92,8 @@ typedef struct uint32_t key_size; ///< Size in bytes of keys. uint32_t value_size; ///< Size in bytes of values. uint32_t max_entries; ///< Maximum number of entries in the map. - uint32_t map_flags; ///< Flags (currently 0). + uint32_t map_flags; ///< Not supported, must be zero. + uint32_t inner_map_fd; ///< File descriptor of inner map. } sys_bpf_map_create_attr_t; typedef struct diff --git a/libs/api/bpf_syscall.cpp b/libs/api/bpf_syscall.cpp index abd7a6026e..a49238e7b7 100644 --- a/libs/api/bpf_syscall.cpp +++ b/libs/api/bpf_syscall.cpp @@ -93,7 +93,12 @@ bpf(int cmd, union bpf_attr* attr, unsigned int size) } case BPF_MAP_CREATE: { ExtensibleStruct map_create_attr((void*)attr, (size_t)size); - struct bpf_map_create_opts opts = {.map_flags = map_create_attr->map_flags}; + + struct bpf_map_create_opts opts = { + .inner_map_fd = map_create_attr->inner_map_fd, + .map_flags = map_create_attr->map_flags, + }; + return bpf_map_create( map_create_attr->map_type, nullptr, diff --git a/libs/api/ebpf_api.cpp b/libs/api/ebpf_api.cpp index 7bb640a990..4c57eacd65 100644 --- a/libs/api/ebpf_api.cpp +++ b/libs/api/ebpf_api.cpp @@ -601,8 +601,16 @@ _ebpf_map_lookup_element_batch_helper( } count_returned += entries_returned; - // Point previous_key to the last key in the batch. - previous_key = (uint8_t*)keys + (count_returned - 1) * key_size; + // Set the previous_key for the next batch. + if (find_and_delete || count_returned == 0) { + // If find_and_delete is set to true, the entries are already deleted. + // If no more entries are returned, there is no need to fetch more. + // Hence the previous_key is set to null. + previous_key = nullptr; + } else { + // Point previous_key to the last key in the batch. + previous_key = (uint8_t*)keys + (count_returned - 1) * key_size; + } // Partial return signals last no more entries. if (entries_returned != entries_to_fetch) { @@ -610,8 +618,11 @@ _ebpf_map_lookup_element_batch_helper( } } - // Copy previous key into out_batch. - std::copy(previous_key, previous_key + key_size, (uint8_t*)out_batch); + memset((uint8_t*)out_batch, 0, key_size); + // Copy previous key into out_batch, if find_and_delete is false. + if (!find_and_delete && (previous_key != nullptr)) { + std::copy(previous_key, previous_key + key_size, (uint8_t*)out_batch); + } *count = static_cast(count_returned); diff --git a/libs/execution_context/ebpf_maps.c b/libs/execution_context/ebpf_maps.c index 9894d32342..c65a4a5ae8 100644 --- a/libs/execution_context/ebpf_maps.c +++ b/libs/execution_context/ebpf_maps.c @@ -496,7 +496,7 @@ _find_array_map_entry_with_reference( return result; } - ebpf_id_t *id = (ebpf_id_t*)(*data); + ebpf_id_t* id = (ebpf_id_t*)(*data); if (id != NULL && *id == 0) { // Turn zero ID into EBPF_OBJECT_NOT_FOUND. *data = NULL; @@ -2922,10 +2922,12 @@ ebpf_map_get_next_key_and_value_batch( memcpy(key_and_value + output_length + key_size, next_value, value_size); - if (flags & EBPF_MAP_FIND_FLAG_DELETE) { - // If the caller requested deletion, delete the entry. + if ((flags & EBPF_MAP_FIND_FLAG_DELETE) && (previous_key != NULL)) { + // If the caller requested deletion, delete the previous entry. result = ebpf_map_metadata_tables[map->ebpf_map_definition.type].delete_entry(map, previous_key); if (result != EBPF_SUCCESS) { + EBPF_LOG_MESSAGE_UINT64( + EBPF_TRACELOG_LEVEL_ERROR, EBPF_TRACELOG_KEYWORD_MAP, "Failed to delete entry", result); break; } } @@ -2943,5 +2945,16 @@ ebpf_map_get_next_key_and_value_batch( *key_and_value_length = output_length; + if ((flags & EBPF_MAP_FIND_FLAG_DELETE) && (previous_key != NULL) && (output_length != 0)) { + // If the caller requested deletion, delete the last entry. + ebpf_result_t delete_result = + ebpf_map_metadata_tables[map->ebpf_map_definition.type].delete_entry(map, previous_key); + if (delete_result != EBPF_SUCCESS) { + EBPF_LOG_MESSAGE_UINT64( + EBPF_TRACELOG_LEVEL_ERROR, EBPF_TRACELOG_KEYWORD_MAP, "Failed to delete last entry", delete_result); + result = delete_result; + } + } + return result; } diff --git a/tests/unit/libbpf_test.cpp b/tests/unit/libbpf_test.cpp index 8b2bcdbd57..4811a4adc6 100644 --- a/tests/unit/libbpf_test.cpp +++ b/tests/unit/libbpf_test.cpp @@ -3006,6 +3006,64 @@ TEST_CASE("BPF_PROG_BIND_MAP etc.", "[libbpf]") attr.prog_bind_map.flags = 0; REQUIRE(bpf(BPF_PROG_BIND_MAP, &attr, sizeof(attr)) == 0); + // Verify we can create a nested array map. + uint32_t key = 0; + fd_t value = map_fd; + attr.map_create = {}; + attr.map_create.map_type = BPF_MAP_TYPE_ARRAY_OF_MAPS; + attr.map_create.key_size = sizeof(key); + attr.map_create.value_size = sizeof(value); + attr.map_create.max_entries = 1; + attr.map_create.inner_map_fd = map_fd; + int nested_map_fd = bpf(BPF_MAP_CREATE, &attr, sizeof(attr.map_create)); + REQUIRE(nested_map_fd >= 0); + + // Ensure we can insert map_fd into the outer map. + attr.map_update = {}; + attr.map_update.map_fd = nested_map_fd; + attr.map_update.key = (uintptr_t)&key; + attr.map_update.value = (uintptr_t)&value; + REQUIRE(bpf(BPF_MAP_UPDATE_ELEM, &attr, sizeof(attr.map_update)) == 0); + + // Ensure that looking up the same key gives the ID of the inner map. + ebpf_id_t value_id = 0; + attr.map_lookup = {}; + attr.map_lookup.map_fd = nested_map_fd; + attr.map_lookup.key = (uintptr_t)&key; + attr.map_lookup.value = (uintptr_t)&value_id; + REQUIRE(bpf(BPF_MAP_LOOKUP_ELEM, &attr, sizeof(attr.map_lookup)) == 0); + REQUIRE(value_id == map_id); + + Platform::_close(nested_map_fd); + + // Verify we can create a nested hash map. + attr.map_create = {}; + attr.map_create.map_type = BPF_MAP_TYPE_HASH_OF_MAPS; + attr.map_create.key_size = sizeof(key); + attr.map_create.value_size = sizeof(value); + attr.map_create.max_entries = 1; + attr.map_create.inner_map_fd = map_fd; + nested_map_fd = bpf(BPF_MAP_CREATE, &attr, sizeof(attr.map_create)); + REQUIRE(nested_map_fd >= 0); + + // Ensure we can insert map_fd into the outer map. + attr.map_update = {}; + attr.map_update.map_fd = nested_map_fd; + attr.map_update.key = (uintptr_t)&key; + attr.map_update.value = (uintptr_t)&value; + REQUIRE(bpf(BPF_MAP_UPDATE_ELEM, &attr, sizeof(attr.map_update)) == 0); + + // Ensure that looking up the same key gives the ID of the inner map. + value_id = 0; + attr.map_lookup = {}; + attr.map_lookup.map_fd = nested_map_fd; + attr.map_lookup.key = (uintptr_t)&key; + attr.map_lookup.value = (uintptr_t)&value_id; + REQUIRE(bpf(BPF_MAP_LOOKUP_ELEM, &attr, sizeof(attr.map_lookup)) == 0); + REQUIRE(value_id == map_id); + + Platform::_close(nested_map_fd); + // Release our own references on the map and program. Platform::_close(map_fd); Platform::_close(program_fd); @@ -3632,6 +3690,7 @@ _test_maps_batch(bpf_map_type map_type) bpf_map_lookup_batch( map_fd, nullptr, &next_key, fetched_keys.data(), fetched_values.data(), &fetched_batch_size, &opts) == 0); REQUIRE(fetched_batch_size == batch_size); + _test_batch_iteration_maps(map_fd, batch_size, &opts, value_size, num_of_cpus); // Request more keys than present. uint32_t large_fetched_batch_size = fetched_batch_size * 2; @@ -3639,7 +3698,7 @@ _test_maps_batch(bpf_map_type map_type) bpf_map_lookup_batch( map_fd, nullptr, &next_key, fetched_keys.data(), fetched_values.data(), &large_fetched_batch_size, &opts) == 0); - REQUIRE(fetched_batch_size == batch_size); + REQUIRE(large_fetched_batch_size == batch_size); // Search at end of map. REQUIRE( @@ -3652,18 +3711,56 @@ _test_maps_batch(bpf_map_type map_type) &large_fetched_batch_size, &opts) == -ENOENT); - // Fetch all keys in batches. + // Verify all keys and values in batches. _test_batch_iteration_maps(map_fd, batch_size, &opts, value_size, num_of_cpus); - // Delete the batch. + // Delete all keys in one batch. uint32_t delete_batch_size = batch_size; opts.elem_flags = 0; - - // Delete all keys in one batch. REQUIRE(bpf_map_delete_batch(map_fd, keys.data(), &delete_batch_size, &opts) == 0); REQUIRE(delete_batch_size == batch_size); - // Fetch all keys in one batch. + // Verify there are no entries, after deletion. + REQUIRE( + bpf_map_lookup_batch( + map_fd, nullptr, &next_key, fetched_keys.data(), fetched_values.data(), &fetched_batch_size, &opts) == + -ENOENT); + + // Lookup and Delete batch operation. + opts.elem_flags = BPF_NOEXIST; + update_batch_size = batch_size; + + // Populate the map with the keys and values. + REQUIRE(bpf_map_update_batch(map_fd, keys.data(), values.data(), &update_batch_size, &opts) == 0); + REQUIRE(update_batch_size == batch_size); + + next_key = 0; + opts.elem_flags = BPF_ANY; + fetched_batch_size = batch_size; + REQUIRE( + bpf_map_lookup_batch( + map_fd, nullptr, &next_key, fetched_keys.data(), fetched_values.data(), &fetched_batch_size, &opts) == 0); + REQUIRE(fetched_batch_size == batch_size); + _test_batch_iteration_maps(map_fd, batch_size, &opts, value_size, num_of_cpus); + // Verify the fetched_keys and fetched_values are returned correctly. + std::sort(fetched_keys.begin(), fetched_keys.end()); + REQUIRE(fetched_keys == keys); + std::sort(fetched_values.begin(), fetched_values.end()); + REQUIRE(fetched_values == values); + + next_key = 0; + REQUIRE( + bpf_map_lookup_and_delete_batch( + map_fd, nullptr, &next_key, fetched_keys.data(), fetched_values.data(), &fetched_batch_size, &opts) == 0); + REQUIRE(fetched_batch_size == batch_size); + REQUIRE(next_key == 0); + // Verify the fetched_keys and fetched_values are returned correctly. + std::sort(fetched_keys.begin(), fetched_keys.end()); + REQUIRE(fetched_keys == keys); + std::sort(fetched_values.begin(), fetched_values.end()); + REQUIRE(fetched_values == values); + + // Verify there are no entries, after deletion. REQUIRE( bpf_map_lookup_batch( map_fd, nullptr, &next_key, fetched_keys.data(), fetched_values.data(), &fetched_batch_size, &opts) == diff --git a/tools/bpf2c/bpf_code_generator.cpp b/tools/bpf2c/bpf_code_generator.cpp index eafc8c5256..00fb63386f 100644 --- a/tools/bpf2c/bpf_code_generator.cpp +++ b/tools/bpf2c/bpf_code_generator.cpp @@ -979,6 +979,7 @@ bpf_code_generator::bpf_code_generator_program::encode_instructions( source = "IMMEDIATE(" + std::to_string(inst.imm) + ")"; } bool is64bit = (inst.opcode & INST_CLS_MASK) == INST_CLS_ALU64; + int bits = is64bit ? 64 : 32; AluOperations operation = static_cast(inst.opcode >> 4); std::string swap_function; std::string type; @@ -993,14 +994,30 @@ bpf_code_generator::bpf_code_generator_program::encode_instructions( output.lines.push_back(std::format("{} *= {};", destination, source)); break; case AluOperations::Div: - if (is64bit) { - type = (inst.offset == 1) ? "(int64_t)" : ""; + type = (is64bit) ? "" : "(uint32_t)"; + if (inst.offset == 1) { + // Signed division. + output.lines.push_back(std::format( + "if (!((int{}_t){} == INT{}_MIN && (int{}_t){} == -1)) {{", + bits, + destination, + bits, + bits, + source)); output.lines.push_back(std::format( - "{} = {} ? ({}{} / {}{}) : 0;", destination, source, type, destination, type, source)); + INDENT "{} = {}{} ? ((int{}_t){} / (int{}_t){}) : 0;", + destination, + type, + source, + bits, + destination, + bits, + source)); + output.lines.push_back("}"); } else { - type = (inst.offset == 1) ? "(int32_t)" : "(uint32_t)"; + // Unsigned division. output.lines.push_back(std::format( - "{} = (uint32_t){} ? {}{} / {}{} : 0;", destination, source, type, destination, type, source)); + "{} = {}{} ? ({}{} / {}{}) : 0;", destination, type, source, type, destination, type, source)); } break; case AluOperations::Or: @@ -1052,23 +1069,36 @@ bpf_code_generator::bpf_code_generator_program::encode_instructions( output.lines.push_back(std::format("{} = -(int64_t){};", destination, destination)); break; case AluOperations::Mod: - if (is64bit) { - type = (inst.offset == 1) ? "(int64_t)" : ""; + type = (is64bit) ? "" : "(uint32_t)"; + if (inst.offset == 1) { + // Signed modulo. output.lines.push_back(std::format( - "{} = {} ? ({}{} % {}{}) : {}{};", + "if ((int{}_t){} == INT{}_MIN && (int{}_t){} == -1) {{", + bits, destination, - source, - type, + bits, + bits, + source)); + output.lines.push_back(std::format(INDENT "{} = 0;", destination)); + output.lines.push_back("} else {"); + output.lines.push_back(std::format( + INDENT "{} = {}{} ? ((int{}_t){} % (int{}_t){}) : (int{}_t){};", destination, type, source, - type, + bits, + destination, + bits, + source, + bits, destination)); + output.lines.push_back("}"); } else { - type = (inst.offset == 1) ? "(int32_t)" : "(uint32_t)"; + // Unsigned modulo. output.lines.push_back(std::format( - "{} = (uint32_t){} ? ({}{} % {}{}) : {}{};", + "{} = {}{} ? ({}{} % {}{}) : {}{};", destination, + type, source, type, destination,