Skip to content

Commit

Permalink
Update verifier to latest (#1991)
Browse files Browse the repository at this point in the history
* Update verifier to latest

Fixes #1451
Fixes #1756

Signed-off-by: Dave Thaler <[email protected]>

* Update samples to work around verifier limitation

Signed-off-by: Dave Thaler <[email protected]>

* Update expected bpf2c output

Signed-off-by: Dave Thaler <[email protected]>

* Fix cmake build

Signed-off-by: Dave Thaler <[email protected]>

---------

Signed-off-by: Dave Thaler <[email protected]>
  • Loading branch information
dthaler authored Feb 1, 2023
1 parent 74b1672 commit 68544ba
Show file tree
Hide file tree
Showing 16 changed files with 20,470 additions and 8,758 deletions.
8 changes: 4 additions & 4 deletions docs/isa-support.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,28 +69,28 @@ opcode src imm description PREVAIL
0x5d any 0x00 if dst != src goto +offset Y Y Y jne-reg
0x5e any 0x00 if (uint32_t)dst != (uint32_t)src goto +offset Y Y Y jne32-reg
0x5f any 0x00 dst &= src Y Y Y alu64-bit
0x61 any 0x00 dst = \*(uint32_t \*)(src + offset) ??? Y Y ldxw
0x61 any 0x00 dst = \*(uint32_t \*)(src + offset) Y Y Y ldxw
0x62 0x0 any \*(uint32_t \*)(dst + offset) = imm Y Y Y stw
0x63 any 0x00 \*(uint32_t \*)(dst + offset) = src Y Y Y stxw
0x64 0x0 any dst = (uint32_t)(dst << imm) Y Y Y alu-bit
0x65 0x0 any if dst s> imm goto +offset Y Y Y jsgt-imm
0x66 0x0 any if (int32_t)dst s> (int32_t)imm goto +offset Y Y Y jsgt32-imm
0x67 0x0 any dst <<= imm Y Y Y alu64-bit
0x69 any 0x00 dst = \*(uint16_t \*)(src + offset) ??? Y Y ldxh
0x69 any 0x00 dst = \*(uint16_t \*)(src + offset) Y Y Y ldxh
0x6a 0x0 any \*(uint16_t \*)(dst + offset) = imm Y Y Y sth
0x6b any 0x00 \*(uint16_t \*)(dst + offset) = src Y Y Y stxh
0x6c any 0x00 dst = (uint32_t)(dst << src) Y Y Y alu-bit
0x6d any 0x00 if dst s> src goto +offset Y Y Y jsgt-reg
0x6e any 0x00 if (int32_t)dst s> (int32_t)src goto +offset Y Y Y jsgt32-reg
0x6f any 0x00 dst <<= src Y Y Y lsh-reg
0x71 any 0x00 dst = \*(uint8_t \*)(src + offset) ??? Y Y ldxb
0x71 any 0x00 dst = \*(uint8_t \*)(src + offset) Y Y Y ldxb
0x72 0x0 any \*(uint8_t \*)(dst + offset) = imm Y Y Y stb
0x73 any 0x00 \*(uint8_t \*)(dst + offset) = src Y Y Y stxb
0x74 0x0 any dst = (uint32_t)(dst >> imm) Y Y Y rsh32
0x75 0x0 any if dst s>= imm goto +offset Y Y Y jsge-imm
0x76 0x0 any if (int32_t)dst s>= (int32_t)imm goto +offset Y Y Y jsge32-imm
0x77 0x0 any dst >>= imm Y Y Y alu64-bit
0x79 any 0x00 dst = \*(uint64_t \*)(src + offset) ??? Y Y ldxdw
0x79 any 0x00 dst = \*(uint64_t \*)(src + offset) Y Y Y ldxdw
0x7a 0x0 any \*(uint64_t \*)(dst + offset) = imm Y Y Y stdw
0x7b any 0x00 \*(uint64_t \*)(dst + offset) = src Y Y Y stxdw
0x7c any 0x00 dst = (uint32_t)(dst >> src) Y Y Y alu-bit
Expand Down
9 changes: 0 additions & 9 deletions external/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# SPDX-License-Identifier: MIT

add_subdirectory("ebpf-verifier" EXCLUDE_FROM_ALL)
add_subdirectory("Catch2" EXCLUDE_FROM_ALL)
add_subdirectory("ubpf" EXCLUDE_FROM_ALL)

# Special target that we can link to external dependencies
Expand All @@ -17,14 +16,6 @@ target_compile_definitions("ebpf_for_windows_external_settings" INTERFACE
"_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS"
)

#
# Catch2
#

target_link_libraries("Catch2" PRIVATE
"ebpf_for_windows_external_settings"
)

#
# ebpfverifier
#
Expand Down
2 changes: 1 addition & 1 deletion external/ebpf-verifier
4 changes: 2 additions & 2 deletions libs/execution_context/ebpf_program.c
Original file line number Diff line number Diff line change
Expand Up @@ -1486,7 +1486,7 @@ _ebpf_helper_id_to_index_compare(const void* lhs, const void* rhs)
* 2) During initialization, the program binds to the program information provider.
* 3) During the attach callback, the program information is hashed and stored.
* 4) The verifier then queries the program information from the ebpf_program_t object and uses it to verify the program
* safety.
* safety.
* 5) If the program information provider is reattached, the program information is hashed and compared with the
* hash stored in the program and the program is rejected if the hash does not match. This ensures that the program
* information the verifier uses to verify the program safety is the same as the program information the program uses to
Expand All @@ -1504,7 +1504,7 @@ _ebpf_program_initialize_or_verify_program_info_hash(_Inout_ ebpf_program_t* pro
ebpf_result_t result;
ebpf_cryptographic_hash_t* cryptographic_hash = NULL;
ebpf_helper_id_to_index_t* helper_id_to_index = NULL;
const ebpf_program_info_t* program_info = NULL;
ebpf_program_info_t* program_info = NULL;

result = ebpf_program_get_program_info(program, &program_info);
if (result != EBPF_SUCCESS) {
Expand Down
Loading

0 comments on commit 68544ba

Please sign in to comment.