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

Add support for multiple levels of bpf2bpf calls #4047

Merged
merged 3 commits into from
Nov 27, 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
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
Loading