33 using namespace check;
38 setup_check_control_vm_execution_control_fields_all_paths(std::vector<struct control_flow_path> &cfg)
69 setup_check_control_vm_exit_control_fields_all_paths(std::vector<struct control_flow_path> &cfg)
84 setup_check_control_vm_entry_control_fields_all_paths(std::vector<struct control_flow_path> &cfg)
99 std::vector<struct control_flow_path> sub_cfg;
101 setup_check_control_vm_execution_control_fields_all_paths(sub_cfg);
102 setup_check_control_vm_exit_control_fields_all_paths(sub_cfg);
103 setup_check_control_vm_entry_control_fields_all_paths(sub_cfg);
105 path.
setup = [sub_cfg]
107 for (
const auto &sub_path : sub_cfg)
115 setup_check_control_pin_based_ctls_reserved_properly_set_paths(std::vector<struct control_flow_path> &cfg)
133 setup_check_control_proc_based_ctls_reserved_properly_set_paths(std::vector<struct control_flow_path> &cfg)
151 setup_check_control_proc_based_ctls2_reserved_properly_set_paths(std::vector<struct control_flow_path> &cfg)
177 using namespace secondary_processor_based_vm_execution_controls;
196 setup_check_control_cr3_count_less_than_4_paths(std::vector<struct control_flow_path> &cfg)
209 setup_check_control_io_bitmap_address_bits_paths(std::vector<struct control_flow_path> &cfg)
255 setup_check_control_msr_bitmap_address_bits_paths(std::vector<struct control_flow_path> &cfg)
287 setup_check_control_tpr_shadow_and_virtual_apic_paths(std::vector<struct control_flow_path> &cfg)
289 using namespace primary_processor_based_vm_execution_controls;
290 using namespace secondary_processor_based_vm_execution_controls;
424 setup_check_control_nmi_exiting_and_virtual_nmi_paths(std::vector<struct control_flow_path> &cfg)
455 setup_check_control_virtual_nmi_and_nmi_window_paths(std::vector<struct control_flow_path> &cfg)
486 setup_check_control_virtual_apic_address_bits_paths(std::vector<struct control_flow_path> &cfg)
532 setup_check_control_x2apic_mode_and_virtual_apic_access_paths(std::vector<struct control_flow_path> &cfg)
575 setup_check_control_virtual_interrupt_and_external_interrupt_paths(std::vector<struct control_flow_path> &cfg)
617 setup_check_control_process_posted_interrupt_checks_paths(std::vector<struct control_flow_path> &cfg)
691 setup_check_control_vpid_checks_paths(std::vector<struct control_flow_path> &cfg)
728 setup_check_control_enable_ept_checks_paths(std::vector<struct control_flow_path> &cfg)
801 setup_check_control_enable_pml_checks_paths(std::vector<struct control_flow_path> &cfg)
855 setup_check_control_unrestricted_guests_paths(std::vector<struct control_flow_path> &cfg)
898 setup_check_control_enable_vm_functions_paths(std::vector<struct control_flow_path> &cfg)
900 using namespace vmcs::secondary_processor_based_vm_execution_controls;
978 setup_check_control_enable_vmcs_shadowing_paths(std::vector<struct control_flow_path> &cfg)
1006 cfg.push_back(path);
1015 cfg.push_back(path);
1020 cfg.push_back(path);
1025 cfg.push_back(path);
1029 cfg.push_back(path);
1033 setup_check_control_enable_ept_violation_checks_paths(std::vector<struct control_flow_path> &cfg)
1041 cfg.push_back(path);
1051 cfg.push_back(path);
1062 cfg.push_back(path);
1067 cfg.push_back(path);
1071 cfg.push_back(path);
1075 setup_check_control_vm_exit_ctls_reserved_properly_set_paths(std::vector<struct control_flow_path> &cfg)
1083 cfg.push_back(path);
1088 cfg.push_back(path);
1092 cfg.push_back(path);
1096 setup_check_control_activate_and_save_preemption_timer_must_be_0_paths(std::vector<struct control_flow_path> &cfg)
1104 cfg.push_back(path);
1115 cfg.push_back(path);
1123 cfg.push_back(path);
1127 setup_check_control_exit_msr_store_address_paths(std::vector<struct control_flow_path> &cfg)
1131 cfg.push_back(path);
1140 cfg.push_back(path);
1149 cfg.push_back(path);
1158 cfg.push_back(path);
1166 cfg.push_back(path);
1170 setup_check_control_exit_msr_load_address_paths(std::vector<struct control_flow_path> &cfg)
1174 cfg.push_back(path);
1183 cfg.push_back(path);
1192 cfg.push_back(path);
1201 cfg.push_back(path);
1209 cfg.push_back(path);
1213 setup_check_control_vm_entry_ctls_reserved_properly_set_paths(std::vector<struct control_flow_path> &cfg)
1221 cfg.push_back(path);
1226 cfg.push_back(path);
1230 cfg.push_back(path);
1234 setup_check_control_event_injection_type_vector_checks_paths(std::vector<struct control_flow_path> &cfg)
1236 using namespace vm_entry_interruption_information_field;
1238 path.
setup = [&] {
set(0UL); };
1240 cfg.push_back(path);
1249 cfg.push_back(path);
1258 cfg.push_back(path);
1267 cfg.push_back(path);
1272 cfg.push_back(path);
1281 cfg.push_back(path);
1285 cfg.push_back(path);
1289 setup_check_control_event_injection_delivery_ec_checks_paths(std::vector<struct control_flow_path> &cfg)
1291 using namespace vm_entry_interruption_information_field;
1295 cfg.push_back(path);
1308 cfg.push_back(path);
1319 cfg.push_back(path);
1324 cfg.push_back(path);
1328 cfg.push_back(path);
1333 cfg.push_back(path);
1337 setup_check_control_event_injection_reserved_bits_checks_paths(std::vector<struct control_flow_path> &cfg)
1339 using namespace vm_entry_interruption_information_field;
1341 path.
setup = [&] {
set(0UL); };
1343 cfg.push_back(path);
1347 cfg.push_back(path);
1352 cfg.push_back(path);
1356 setup_check_control_event_injection_ec_checks_paths(std::vector<struct control_flow_path> &cfg)
1358 using namespace vm_entry_interruption_information_field;
1360 path.
setup = [&] {
set(0UL); };
1362 cfg.push_back(path);
1366 cfg.push_back(path);
1375 cfg.push_back(path);
1379 cfg.push_back(path);
1383 setup_check_control_event_injection_instr_length_checks_paths(std::vector<struct control_flow_path> &cfg)
1385 using namespace vm_entry_interruption_information_field;
1387 path.
setup = [&] {
set(0UL); };
1389 cfg.push_back(path);
1397 cfg.push_back(path);
1407 cfg.push_back(path);
1412 cfg.push_back(path);
1416 cfg.push_back(path);
1420 setup_check_control_entry_msr_load_address_paths(std::vector<struct control_flow_path> &cfg)
1424 cfg.push_back(path);
1433 cfg.push_back(path);
1442 cfg.push_back(path);
1451 cfg.push_back(path);
1459 cfg.push_back(path);
1463 vmcs_ut::test_check_control_vmx_controls_all()
1465 std::vector<struct control_flow_path> cfg;
1472 vmcs_ut::test_check_control_vm_execution_control_fields_all()
1474 std::vector<struct control_flow_path> cfg;
1475 setup_check_control_vm_execution_control_fields_all_paths(cfg);
1481 vmcs_ut::test_check_control_vm_exit_control_fields_all()
1483 std::vector<struct control_flow_path> cfg;
1484 setup_check_control_vm_exit_control_fields_all_paths(cfg);
1490 vmcs_ut::test_check_control_vm_entry_control_fields_all()
1492 std::vector<struct control_flow_path> cfg;
1493 setup_check_control_vm_entry_control_fields_all_paths(cfg);
1499 vmcs_ut::test_check_control_pin_based_ctls_reserved_properly_set()
1501 std::vector<struct control_flow_path> cfg;
1502 setup_check_control_pin_based_ctls_reserved_properly_set_paths(cfg);
1508 vmcs_ut::test_check_control_proc_based_ctls_reserved_properly_set()
1510 std::vector<struct control_flow_path> cfg;
1511 setup_check_control_proc_based_ctls_reserved_properly_set_paths(cfg);
1517 vmcs_ut::test_check_control_proc_based_ctls2_reserved_properly_set()
1519 std::vector<struct control_flow_path> cfg;
1520 setup_check_control_proc_based_ctls2_reserved_properly_set_paths(cfg);
1526 vmcs_ut::test_check_control_cr3_count_less_than_4()
1528 std::vector<struct control_flow_path> cfg;
1529 setup_check_control_cr3_count_less_than_4_paths(cfg);
1535 vmcs_ut::test_check_control_io_bitmap_address_bits()
1537 std::vector<struct control_flow_path> cfg;
1538 setup_check_control_io_bitmap_address_bits_paths(cfg);
1544 vmcs_ut::test_check_control_msr_bitmap_address_bits()
1546 std::vector<struct control_flow_path> cfg;
1547 setup_check_control_msr_bitmap_address_bits_paths(cfg);
1553 vmcs_ut::test_check_control_tpr_shadow_and_virtual_apic()
1555 std::vector<struct control_flow_path> cfg;
1556 setup_check_control_tpr_shadow_and_virtual_apic_paths(cfg);
1562 vmcs_ut::test_check_control_nmi_exiting_and_virtual_nmi()
1564 std::vector<struct control_flow_path> cfg;
1565 setup_check_control_nmi_exiting_and_virtual_nmi_paths(cfg);
1571 vmcs_ut::test_check_control_virtual_nmi_and_nmi_window()
1573 std::vector<struct control_flow_path> cfg;
1574 setup_check_control_virtual_nmi_and_nmi_window_paths(cfg);
1580 vmcs_ut::test_check_control_virtual_apic_address_bits()
1582 std::vector<struct control_flow_path> cfg;
1583 setup_check_control_virtual_apic_address_bits_paths(cfg);
1589 vmcs_ut::test_check_control_x2apic_mode_and_virtual_apic_access()
1591 std::vector<struct control_flow_path> cfg;
1592 setup_check_control_x2apic_mode_and_virtual_apic_access_paths(cfg);
1598 vmcs_ut::test_check_control_virtual_interrupt_and_external_interrupt()
1600 std::vector<struct control_flow_path> cfg;
1601 setup_check_control_virtual_interrupt_and_external_interrupt_paths(cfg);
1607 vmcs_ut::test_check_control_process_posted_interrupt_checks()
1609 std::vector<struct control_flow_path> cfg;
1610 setup_check_control_process_posted_interrupt_checks_paths(cfg);
1616 vmcs_ut::test_check_control_vpid_checks()
1618 std::vector<struct control_flow_path> cfg;
1619 setup_check_control_vpid_checks_paths(cfg);
1625 vmcs_ut::test_check_control_enable_ept_checks()
1627 std::vector<struct control_flow_path> cfg;
1628 setup_check_control_enable_ept_checks_paths(cfg);
1634 vmcs_ut::test_check_control_enable_pml_checks()
1636 std::vector<struct control_flow_path> cfg;
1637 setup_check_control_enable_pml_checks_paths(cfg);
1643 vmcs_ut::test_check_control_unrestricted_guests()
1645 std::vector<struct control_flow_path> cfg;
1646 setup_check_control_unrestricted_guests_paths(cfg);
1652 vmcs_ut::test_check_control_enable_vm_functions()
1654 std::vector<struct control_flow_path> cfg;
1655 setup_check_control_enable_vm_functions_paths(cfg);
1661 vmcs_ut::test_check_control_enable_vmcs_shadowing()
1663 std::vector<struct control_flow_path> cfg;
1664 setup_check_control_enable_vmcs_shadowing_paths(cfg);
1670 vmcs_ut::test_check_control_enable_ept_violation_checks()
1672 std::vector<struct control_flow_path> cfg;
1673 setup_check_control_enable_ept_violation_checks_paths(cfg);
1679 vmcs_ut::test_check_control_vm_exit_ctls_reserved_properly_set()
1681 std::vector<struct control_flow_path> cfg;
1682 setup_check_control_vm_exit_ctls_reserved_properly_set_paths(cfg);
1688 vmcs_ut::test_check_control_activate_and_save_preemption_timer_must_be_0()
1690 std::vector<struct control_flow_path> cfg;
1691 setup_check_control_activate_and_save_preemption_timer_must_be_0_paths(cfg);
1697 vmcs_ut::test_check_control_exit_msr_store_address()
1699 std::vector<struct control_flow_path> cfg;
1700 setup_check_control_exit_msr_store_address_paths(cfg);
1706 vmcs_ut::test_check_control_exit_msr_load_address()
1708 std::vector<struct control_flow_path> cfg;
1709 setup_check_control_exit_msr_load_address_paths(cfg);
1715 vmcs_ut::test_check_control_vm_entry_ctls_reserved_properly_set()
1717 std::vector<struct control_flow_path> cfg;
1718 setup_check_control_vm_entry_ctls_reserved_properly_set_paths(cfg);
1724 vmcs_ut::test_check_control_event_injection_type_vector_checks()
1726 std::vector<struct control_flow_path> cfg;
1727 setup_check_control_event_injection_type_vector_checks_paths(cfg);
1733 vmcs_ut::test_check_control_event_injection_delivery_ec_checks()
1735 std::vector<struct control_flow_path> cfg;
1736 setup_check_control_event_injection_delivery_ec_checks_paths(cfg);
1742 vmcs_ut::test_check_control_event_injection_reserved_bits_checks()
1744 std::vector<struct control_flow_path> cfg;
1745 setup_check_control_event_injection_reserved_bits_checks_paths(cfg);
1751 vmcs_ut::test_check_control_event_injection_ec_checks()
1753 std::vector<struct control_flow_path> cfg;
1754 setup_check_control_event_injection_ec_checks_paths(cfg);
1760 vmcs_ut::test_check_control_event_injection_instr_length_checks()
1762 std::vector<struct control_flow_path> cfg;
1763 setup_check_control_event_injection_instr_length_checks_paths(cfg);
1769 vmcs_ut::test_check_control_entry_msr_load_address()
1771 std::vector<struct control_flow_path> cfg;
1772 setup_check_control_entry_msr_load_address_paths(cfg);
1778 vmcs_ut::test_check_control_reserved_properly_set()
1784 auto ctls = vm_entry_controls::get();
1791 vmcs_ut::test_check_memory_type_reserved()
constexpr const auto mask
void control_entry_msr_load_address()
constexpr const auto addr
constexpr const auto mask
constexpr const auto mask
void proc_ctl2_allow0(uint64_t mask)
constexpr const auto addr
constexpr const auto mask
void control_x2apic_mode_and_virtual_apic_access()
constexpr const auto addr
void control_vmx_controls_all()
void exit_ctl_allow0(uint64_t mask)
constexpr const auto mask
constexpr const auto mask
void control_pin_based_ctls_reserved_properly_set()
#define test_vmcs_check(cfg,...)
constexpr const auto mask
constexpr const auto mask
constexpr const auto mask
void pin_ctl_allow1(uint64_t mask)
void control_event_injection_reserved_bits_checks()
std::map< uint64_t, uint64_t > g_vmcs_fields
constexpr const auto mask
constexpr const auto mask
void control_process_posted_interrupt_checks()
void control_vm_entry_ctls_reserved_properly_set()
#define expect_no_exception(f)
constexpr const auto mask
void control_cr3_count_less_then_4()
bool g_phys_to_virt_return_nullptr
void control_virtual_interrupt_and_external_interrupt()
void control_exit_msr_load_address()
constexpr const auto mask
constexpr const auto mask
constexpr const auto addr
void control_virtual_nmi_and_nmi_window()
constexpr const auto addr
constexpr const auto write_back
void control_enable_ept_checks()
void control_event_injection_instr_length_checks()
constexpr const auto mask
constexpr const auto software_interrupt
void control_unrestricted_guests()
auto memory_type_reserved(T memory_type)
constexpr const auto mask
void control_proc_based_ctls_reserved_properly_set()
constexpr const auto mask
constexpr const auto other_event
constexpr const auto hardware_exception
void control_event_injection_ec_checks()
constexpr const auto uncacheable
constexpr const auto mask
void control_enable_vm_functions()
void control_enable_vmcs_shadowing()
constexpr const auto addr
void proc_ctl2_disallow1(uint64_t mask)
constexpr const auto addr
std::map< msrs::field_type, msrs::value_type > g_msrs
void control_virtual_apic_address_bits()
void set_if_exists(T val, bool verbose=false) noexcept
std::map< cpuid::field_type, cpuid::value_type > g_eax_cpuid
constexpr const auto mask
void control_vm_entry_control_fields_all()
constexpr const auto non_maskable_interrupt
void control_exit_msr_store_address()
std::shared_ptr< std::exception > exception
void control_nmi_exiting_and_virtual_nmi()
constexpr const auto mask
void control_enable_ept_violation_checks()
void pin_ctl_allow0(uint64_t mask)
constexpr const auto mask
void control_msr_bitmap_address_bits()
constexpr const auto reserved
void control_vpid_checks()
constexpr const auto mask
void control_proc_based_ctls2_reserved_properly_set()
void proc_ctl2_allow1(uint64_t mask)
constexpr const auto mask
void control_io_bitmap_address_bits()
void proc_ctl_allow1(uint64_t mask)
constexpr const auto mask
void control_tpr_shadow_and_virtual_apic()
void control_vm_execution_control_fields_all()
void control_event_injection_delivery_ec_checks()
constexpr const auto addr
constexpr const auto name
void control_enable_pml_checks()
void proc_ctl_allow0(uint64_t mask)
constexpr const auto msr_addr
constexpr const auto addr
void exit_ctl_allow1(uint64_t mask)
void control_activate_and_save_preemption_timer_must_be_0()
void control_vm_exit_ctls_reserved_properly_set()
void control_event_injection_type_vector_checks()
uint64_t g_virt_apic_addr
void control_vm_exit_control_fields_all()
void vmfunc_ctl_allow1(uint64_t mask)
auto control_reserved_properly_set(MA msr_addr, C ctls, const char *ctls_name)
constexpr const auto write_through
void setup_check_control_vmx_controls_all_paths(std::vector< struct control_flow_path > &cfg)
constexpr const auto mask
constexpr const auto mask
void proc_ctl_disallow1(uint64_t mask)
std::function< void()> setup