Skip to content

Commit

Permalink
Update verifier to latest
Browse files Browse the repository at this point in the history
* Update verifier, which includes the fix to make bpf2bpf calls work with multiple stack levels
* Update ebpf-for-windows to deal with minor API breaking changes in the verifier
* Remove redundant crab_verifier_wrapper.hpp and just use ebpf_verifier_wrapper.hpp
* Update bindmonitor_bpf2bpf.c sample to test with multiple stack levels
* Add bindmonitor_bpf2bpf.c as a bpf2c test case

Signed-off-by: Dave Thaler <[email protected]>
  • Loading branch information
dthaler committed Nov 25, 2024
1 parent ae04b0b commit 8ff6914
Show file tree
Hide file tree
Showing 13 changed files with 363 additions and 276 deletions.
20 changes: 0 additions & 20 deletions libs/api/crab_verifier_wrapper.hpp

This file was deleted.

2 changes: 1 addition & 1 deletion libs/api/windows_platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

#include "api_common.hpp"
#include "api_internal.h"
#include "crab_verifier_wrapper.hpp"
#include "ebpf_api.h"
#include "ebpf_verifier_wrapper.hpp"
#include "helpers.hpp"
#include "map_descriptors.hpp"
#include "platform.hpp"
Expand Down
6 changes: 3 additions & 3 deletions libs/api_common/api_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,13 @@ ebpf_verify_program(
const cfg_t cfg = prepare_cfg(prog, info, options.cfg_opts);
auto invariants = analyze(cfg);
if (options.verbosity_opts.print_invariants) {
invariants.print_invariants(os, cfg);
print_invariants(os, cfg, options.verbosity_opts.simplify, invariants);
}
bool pass;
if (options.verbosity_opts.print_failures) {
auto report = invariants.check_assertions(cfg);
thread_local_options.verbosity_opts.print_line_info = true;
report.print_warnings(os);
print_warnings(os, report);
pass = report.verified();
stats->total_warnings = (int)report.warning_set().size();
stats->total_unreachable = (int)report.reachability_set().size();
Expand All @@ -194,4 +194,4 @@ ebpf_verify_program(
os << "error: " << e.what() << std::endl;
return false;
}
}
}
5 changes: 3 additions & 2 deletions libs/api_common/ebpf_verifier_wrapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
#pragma warning(disable : 4244) // 'conversion' conversion from 'type1' to
// 'type2', possible loss of data
#pragma warning(disable : 4267) // conversion from 'size_t' to 'int', possible loss of data
#pragma warning(disable : 26451) // Arithmetic overflow
#pragma warning(disable : 26450) // Arithmetic overflow
#pragma warning(disable : 4458) // declaration of 'warnings' hides class member
#pragma warning(disable : 26439) // This kind of function may not
// throw. Declare it 'noexcept'
#pragma warning(disable : 26450) // Arithmetic overflow
#pragma warning(disable : 26451) // Arithmetic overflow
#pragma warning(disable : 26495) // Always initialize a member variable
#undef FALSE
#undef TRUE
Expand Down
2 changes: 1 addition & 1 deletion libs/api_common/windows_platform_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

#include "api_common.hpp"
#include "api_internal.h"
#include "crab_verifier_wrapper.hpp"
#include "device_helper.hpp"
#include "ebpf_api.h"
#include "ebpf_nethooks.h"
#include "ebpf_protocol.h"
#include "ebpf_serialize.h"
#include "ebpf_store_helper.h"
#include "ebpf_verifier_wrapper.hpp"
#include "helpers.hpp"
#include "map_descriptors.hpp"
#include "platform.hpp"
Expand Down
2 changes: 1 addition & 1 deletion libs/api_common/windows_program_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

#pragma once

#include "crab_verifier_wrapper.hpp"
#include "ebpf_nethooks.h"
#include "ebpf_program_types.h"
#include "ebpf_verifier_wrapper.hpp"

#define PTYPE(name, descr, native_type, prefixes) \
{ \
Expand Down
2 changes: 1 addition & 1 deletion libs/service/windows_platform_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

#include "api_common.hpp"
#include "api_internal.h"
#include "crab_verifier_wrapper.hpp"
#include "ebpf_api.h"
#include "ebpf_verifier_wrapper.hpp"
#include "helpers.hpp"
#include "platform.hpp"
#include "spec_type_descriptors.hpp"
Expand Down
1 change: 1 addition & 0 deletions tests/bpf2c_tests/elf_bpf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ run_test_elf(const std::string& elf_file, _test_mode test_mode, const std::optio
DECLARE_TEST("atomic_instruction_fetch_add", _test_mode::Verify)
DECLARE_TEST("bad_map_name", _test_mode::Verify)
DECLARE_TEST("bindmonitor", _test_mode::Verify)
DECLARE_TEST("bindmonitor_bpf2bpf", _test_mode::Verify)
DECLARE_TEST("bindmonitor_ringbuf", _test_mode::Verify)
DECLARE_TEST("bindmonitor_tailcall", _test_mode::Verify)
DECLARE_TEST("bindmonitor_mt_tailcall", _test_mode::Verify)
Expand Down
Loading

0 comments on commit 8ff6914

Please sign in to comment.