test_vmcs_intel_x64_check_host.cpp
Go to the documentation of this file.
1 //
2 // Bareflank Hypervisor
3 //
4 // Copyright (C) 2015 Assured Information Security, Inc.
5 // Author: Rian Quinn <quinnr@ainfosec.com>
6 // Author: Brendan Kerrigan <kerriganb@ainfosec.com>
7 // Author: Connor Davis <davisc@ainfosec.com>
8 //
9 // This library is free software; you can redistribute it and/or
10 // modify it under the terms of the GNU Lesser General Public
11 // License as published by the Free Software Foundation; either
12 // version 2.1 of the License, or (at your option) any later version.
13 //
14 // This library is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 // Lesser General Public License for more details.
18 //
19 // You should have received a copy of the GNU Lesser General Public
20 // License along with this library; if not, write to the Free Software
21 
22 #include <test.h>
23 #include <string>
24 
29 
30 #include <intrinsics/srs_x64.h>
33 
34 using namespace x64;
35 using namespace intel_x64;
36 using namespace msrs;
37 using namespace vmcs;
38 
39 static struct control_flow_path path;
40 
41 static void
42 setup_check_host_control_registers_and_msrs_all_paths(std::vector<struct control_flow_path> &cfg)
43 {
44  path.setup = [&]
45  {
46  g_msrs[ia32_vmx_cr0_fixed0::addr] = 0ULL; // allow cr0 and
47  g_msrs[ia32_vmx_cr0_fixed1::addr] = 0xFFFFFFFFFFFFFFFFULL; // cr4 bits to be
48  g_msrs[ia32_vmx_cr4_fixed0::addr] = 0ULL; // either 0 or 1
49  g_msrs[ia32_vmx_cr4_fixed1::addr] = 0xFFFFFFFFFFFFFFFFULL; //
50  host_cr3::set(0x1000ULL); // host_cr3 is valid physical address
51  host_ia32_sysenter_esp::set(0x1000UL); // esp is canonical address
52  host_ia32_sysenter_eip::set(0x1000UL); // eip is canonical address
56  };
57  path.throws_exception = false;
58  cfg.push_back(path);
59 }
60 
61 static void
62 setup_check_host_segment_and_descriptor_table_registers_all_paths(std::vector<struct control_flow_path> &cfg)
63 {
64  using namespace vmcs;
65  using namespace segment_register;
66 
67  path.setup = [&]
68  {
69  host_es_selector::ti::set(false); host_es_selector::rpl::set(0U); // es.ti == 0 && es.rpl == 0
70  host_cs_selector::ti::set(false); host_cs_selector::rpl::set(0U); // cs.ti == 0 && cs.rpl == 0
71  host_ss_selector::ti::set(false); host_ss_selector::rpl::set(0U); // ss.ti == 0 && ss.rpl == 0
72  host_ds_selector::ti::set(false); host_ds_selector::rpl::set(0U); // ds.ti == 0 && ds.rpl == 0
73  host_fs_selector::ti::set(false); host_fs_selector::rpl::set(0U); // fs.ti == 0 && fs.rpl == 0
74  host_gs_selector::ti::set(false); host_gs_selector::rpl::set(0U); // gs.ti == 0 && gs.rpl == 0
75  host_tr_selector::ti::set(false); host_tr_selector::rpl::set(0U); // tr.ti == 0 && tr.rpl == 0
76 
79 
80  vm_exit_controls::host_address_space_size::enable(); // VM-exit ctrl host_address_space_size is 1
81  host_fs_base::set(0x1000UL); // fs base is canonical address
82  host_gs_base::set(0x1000UL); // gs base is canonical address
83  host_gdtr_base::set(0x1000UL); // gdtr base is canonical address
84  host_idtr_base::set(0x1000UL); // idtr base is canonical address
85  host_tr_base::set(0x1000UL); // tr base is canonical address
86  };
87  path.throws_exception = false;
88  cfg.push_back(path);
89 }
90 
91 static void
92 setup_check_host_address_space_size_all_paths(std::vector<struct control_flow_path> &cfg)
93 {
94  path.setup = [&]
95  {
97  vm_exit_controls::host_address_space_size::enable(); // VM-exit ctrl host_address_space_size is 1
98  host_cr4::physical_address_extensions::enable(); // host_cr4::physical_address_extensions == 1
99  host_rip::set(0x1000UL); // rip is canonical address
100  };
101  path.throws_exception = false;
102  cfg.push_back(path);
103 }
104 
105 void
106 setup_check_host_state_all_paths(std::vector<struct control_flow_path> &cfg)
107 {
108  std::vector<struct control_flow_path> sub_cfg;
109 
110  setup_check_host_control_registers_and_msrs_all_paths(sub_cfg);
111  setup_check_host_segment_and_descriptor_table_registers_all_paths(sub_cfg);
112  setup_check_host_address_space_size_all_paths(sub_cfg);
113 
114  path.setup = [sub_cfg]
115  {
116  for (const auto &sub_path : sub_cfg)
117  sub_path.setup();
118  };
119  path.throws_exception = false;
120  cfg.push_back(path);
121 }
122 
123 static void
124 setup_check_host_cr0_for_unsupported_bits_paths(std::vector<struct control_flow_path> &cfg)
125 {
126  path.setup = [&]
127  {
128  host_cr0::set(0U);
130  };
131  path.throws_exception = false;
132  cfg.push_back(path);
133 
134  path.setup = [&] { g_msrs[ia32_vmx_cr0_fixed0::addr] = 1; };
135  path.throws_exception = true;
136  path.exception = ""_ut_lee;
137  cfg.push_back(path);
138 }
139 
140 static void
141 setup_check_host_cr4_for_unsupported_bits_paths(std::vector<struct control_flow_path> &cfg)
142 {
143  path.setup = [&]
144  {
145  host_cr4::set(0U);
147  };
148  path.throws_exception = false;
149  cfg.push_back(path);
150 
151  path.setup = [&] { g_msrs[ia32_vmx_cr4_fixed0::addr] = 1; };
152  path.throws_exception = true;
153  path.exception = ""_ut_lee;
154  cfg.push_back(path);
155 }
156 
157 static void
158 setup_check_host_cr3_for_unsupported_bits_paths(std::vector<struct control_flow_path> &cfg)
159 {
160  path.setup = [&] { host_cr3::set(0xff00000000000000UL); };
161  path.throws_exception = true;
162  path.exception = ""_ut_lee;
163  cfg.push_back(path);
164 
165  path.setup = [&] { host_cr3::set(0x1000UL); };
166  path.throws_exception = false;
167  cfg.push_back(path);
168 }
169 
170 static void
171 setup_check_host_ia32_sysenter_esp_canonical_address_paths(std::vector<struct control_flow_path> &cfg)
172 {
173  path.setup = [&] { host_ia32_sysenter_esp::set(0U); };
174  path.throws_exception = false;
175  cfg.push_back(path);
176 
177  path.setup = [&] { host_ia32_sysenter_esp::set(0x800000000000U); };
178  path.throws_exception = true;
179  path.exception = ""_ut_lee;
180  cfg.push_back(path);
181 }
182 
183 static void
184 setup_check_host_ia32_sysenter_eip_canonical_address_paths(std::vector<struct control_flow_path> &cfg)
185 {
186  path.setup = [&] { host_ia32_sysenter_eip::set(0U); };
187  path.throws_exception = false;
188  cfg.push_back(path);
189 
190  path.setup = [&] { host_ia32_sysenter_eip::set(0x800000000000U); };
191  path.throws_exception = true;
192  path.exception = ""_ut_lee;
193  cfg.push_back(path);
194 }
195 
196 static void
197 setup_check_host_verify_load_ia32_perf_global_ctrl_paths(std::vector<struct control_flow_path> &cfg)
198 {
199  path.setup = [&]
200  {
203  };
204  path.throws_exception = false;
205  cfg.push_back(path);
206 
207  path.setup = [&]
208  {
212  };
213  path.throws_exception = true;
214  path.exception = ""_ut_lee;
215  cfg.push_back(path);
216 
217  path.setup = [&] { host_ia32_perf_global_ctrl::set(0x0U); };
218  path.throws_exception = false;
219  cfg.push_back(path);
220 }
221 
222 static void
223 setup_check_host_verify_load_ia32_pat_paths(std::vector<struct control_flow_path> &cfg)
224 {
225  path.setup = [&]
226  {
229  };
230  path.throws_exception = false;
231  cfg.push_back(path);
232 
233  path.setup = [&]
234  {
238  };
239  path.throws_exception = true;
240  path.exception = ""_ut_lee;
241  cfg.push_back(path);
242 
243  path.setup = [&]
244  {
247  };
248  path.throws_exception = true;
249  path.exception = ""_ut_lee;
250  cfg.push_back(path);
251 
252  path.setup = [&]
253  {
256  };
257  path.throws_exception = true;
258  path.exception = ""_ut_lee;
259  cfg.push_back(path);
260 
261  path.setup = [&]
262  {
265  };
266  path.throws_exception = true;
267  path.exception = ""_ut_lee;
268  cfg.push_back(path);
269 
270  path.setup = [&]
271  {
274  };
275  path.throws_exception = true;
276  path.exception = ""_ut_lee;
277  cfg.push_back(path);
278 
279  path.setup = [&]
280  {
283  };
284  path.throws_exception = true;
285  path.exception = ""_ut_lee;
286  cfg.push_back(path);
287 
288  path.setup = [&]
289  {
292  };
293  path.throws_exception = true;
294  path.exception = ""_ut_lee;
295  cfg.push_back(path);
296 
297  path.setup = [&]
298  {
301  };
302  path.throws_exception = true;
303  path.exception = ""_ut_lee;
304  cfg.push_back(path);
305 
307  path.throws_exception = false;
308  cfg.push_back(path);
309 }
310 
311 static void
312 setup_check_host_verify_load_ia32_efer_paths(std::vector<struct control_flow_path> &cfg)
313 {
314  path.setup = [&]
315  {
318  };
319  path.throws_exception = false;
320  cfg.push_back(path);
321 
322  path.setup = [&]
323  {
327  };
328  path.throws_exception = true;
329  path.exception = ""_ut_lee;
330  cfg.push_back(path);
331 
332  path.setup = [&]
333  {
338  };
339  path.throws_exception = true;
340  path.exception = ""_ut_lee;
341  cfg.push_back(path);
342 
343  path.setup = [&]
344  {
348  };
349  path.throws_exception = true;
350  path.exception = ""_ut_lee;
351  cfg.push_back(path);
352 
353  path.setup = [&]
354  {
357  };
358  path.throws_exception = false;
359  cfg.push_back(path);
360 
361  path.setup = [&]
362  {
366  };
367  path.throws_exception = true;
368  path.exception = ""_ut_lee;
369  cfg.push_back(path);
370 
371  path.setup = [&]
372  {
377  };
378  path.throws_exception = true;
379  path.exception = ""_ut_lee;
380  cfg.push_back(path);
381 
382  path.setup = [&] { host_ia32_efer::lme::disable(); };
383  path.throws_exception = false;
384  cfg.push_back(path);
385 }
386 
387 
388 static void
389 setup_check_host_es_selector_rpl_ti_equal_zero_paths(std::vector<struct control_flow_path> &cfg)
390 {
391  path.setup = [&] { host_es_selector::set(0U); };
392  path.throws_exception = false;
393  cfg.push_back(path);
394 
395  path.setup = [&] { host_es_selector::ti::set(true); };
396  path.throws_exception = true;
397  path.exception = ""_ut_lee;
398  cfg.push_back(path);
399 
400  path.setup = [&]
401  {
404  };
405  path.throws_exception = true;
406  path.exception = ""_ut_lee;
407  cfg.push_back(path);
408 }
409 
410 static void
411 setup_check_host_cs_selector_rpl_ti_equal_zero_paths(std::vector<struct control_flow_path> &cfg)
412 {
413  path.setup = [&] { host_cs_selector::set(0U); };
414  path.throws_exception = false;
415  cfg.push_back(path);
416 
417  path.setup = [&] { host_cs_selector::ti::set(true); };
418  path.throws_exception = true;
419  path.exception = ""_ut_lee;
420  cfg.push_back(path);
421 
422  path.setup = [&]
423  {
426  };
427  path.throws_exception = true;
428  path.exception = ""_ut_lee;
429  cfg.push_back(path);
430 }
431 
432 static void
433 setup_check_host_ss_selector_rpl_ti_equal_zero_paths(std::vector<struct control_flow_path> &cfg)
434 {
435  path.setup = [&] { host_ss_selector::set(0U); };
436  path.throws_exception = false;
437  cfg.push_back(path);
438 
439  path.setup = [&] { host_ss_selector::ti::set(true); };
440  path.throws_exception = true;
441  path.exception = ""_ut_lee;
442  cfg.push_back(path);
443 
444  path.setup = [&]
445  {
448  };
449  path.throws_exception = true;
450  path.exception = ""_ut_lee;
451  cfg.push_back(path);
452 }
453 
454 static void
455 setup_check_host_ds_selector_rpl_ti_equal_zero_paths(std::vector<struct control_flow_path> &cfg)
456 {
457  path.setup = [&] { host_ds_selector::set(0U); };
458  path.throws_exception = false;
459  cfg.push_back(path);
460 
461  path.setup = [&] { host_ds_selector::ti::set(true); };
462  path.throws_exception = true;
463  path.exception = ""_ut_lee;
464  cfg.push_back(path);
465 
466  path.setup = [&]
467  {
470  };
471  path.throws_exception = true;
472  path.exception = ""_ut_lee;
473  cfg.push_back(path);
474 }
475 
476 static void
477 setup_check_host_fs_selector_rpl_ti_equal_zero_paths(std::vector<struct control_flow_path> &cfg)
478 {
479  path.setup = [&] { host_fs_selector::set(0U); };
480  path.throws_exception = false;
481  cfg.push_back(path);
482 
483  path.setup = [&] { host_fs_selector::ti::set(true); };
484  path.throws_exception = true;
485  path.exception = ""_ut_lee;
486  cfg.push_back(path);
487 
488  path.setup = [&]
489  {
492  };
493  path.throws_exception = true;
494  path.exception = ""_ut_lee;
495  cfg.push_back(path);
496 }
497 
498 static void
499 setup_check_host_gs_selector_rpl_ti_equal_zero_paths(std::vector<struct control_flow_path> &cfg)
500 {
501  path.setup = [&] { host_gs_selector::set(0U); };
502  path.throws_exception = false;
503  cfg.push_back(path);
504 
505  path.setup = [&] { host_gs_selector::ti::set(true); };
506  path.throws_exception = true;
507  path.exception = ""_ut_lee;
508  cfg.push_back(path);
509 
510  path.setup = [&]
511  {
514  };
515  path.throws_exception = true;
516  path.exception = ""_ut_lee;
517  cfg.push_back(path);
518 }
519 
520 static void
521 setup_check_host_tr_selector_rpl_ti_equal_zero_paths(std::vector<struct control_flow_path> &cfg)
522 {
523  path.setup = [&] { host_tr_selector::set(0U); };
524  path.throws_exception = false;
525  cfg.push_back(path);
526 
527  path.setup = [&] { host_tr_selector::ti::set(true); };
528  path.throws_exception = true;
529  path.exception = ""_ut_lee;
530  cfg.push_back(path);
531 
532  path.setup = [&]
533  {
536  };
537  path.throws_exception = true;
538  path.exception = ""_ut_lee;
539  cfg.push_back(path);
540 }
541 
542 static void
543 setup_check_host_cs_not_equal_zero_paths(std::vector<struct control_flow_path> &cfg)
544 {
545  path.setup = [&] { host_cs_selector::set(1UL); };
546  path.throws_exception = false;
547  cfg.push_back(path);
548 
549  path.setup = [&] { host_cs_selector::set(0U); };
550  path.throws_exception = true;
551  path.exception = ""_ut_lee;
552  cfg.push_back(path);
553 }
554 
555 static void
556 setup_check_host_tr_not_equal_zero_paths(std::vector<struct control_flow_path> &cfg)
557 {
558  path.setup = [&] { host_tr_selector::set(1UL); };
559  path.throws_exception = false;
560  cfg.push_back(path);
561 
562  path.setup = [&] { host_tr_selector::set(0U); };
563  path.throws_exception = true;
564  path.exception = ""_ut_lee;
565  cfg.push_back(path);
566 }
567 
568 static void
569 setup_check_host_ss_not_equal_zero_paths(std::vector<struct control_flow_path> &cfg)
570 {
571  path.setup = [&]
572  {
575  };
576  path.throws_exception = false;
577  cfg.push_back(path);
578 
579  path.setup = [&]
580  {
584  };
585  path.throws_exception = true;
586  path.exception = ""_ut_lee;
587  cfg.push_back(path);
588 
589  path.setup = [&] { host_ss_selector::set(1U); };
590  path.throws_exception = false;
591  cfg.push_back(path);
592 }
593 
594 static void
595 setup_check_host_fs_canonical_base_address_paths(std::vector<struct control_flow_path> &cfg)
596 {
597  path.setup = [&] { host_fs_base::set(1U); };
598  path.throws_exception = false;
599  cfg.push_back(path);
600 
601  path.setup = [&] { host_fs_base::set(0x800000000000U); };
602  path.throws_exception = true;
603  path.exception = ""_ut_lee;
604  cfg.push_back(path);
605 }
606 
607 static void
608 setup_check_host_gs_canonical_base_address_paths(std::vector<struct control_flow_path> &cfg)
609 {
610  path.setup = [&] { host_gs_base::set(1U); };
611  path.throws_exception = false;
612  cfg.push_back(path);
613 
614  path.setup = [&] { host_gs_base::set(0x800000000000U); };
615  path.throws_exception = true;
616  path.exception = ""_ut_lee;
617  cfg.push_back(path);
618 }
619 
620 static void
621 setup_check_host_gdtr_canonical_base_address_paths(std::vector<struct control_flow_path> &cfg)
622 {
623  path.setup = [&] { host_gdtr_base::set(1U); };
624  path.throws_exception = false;
625  cfg.push_back(path);
626 
627  path.setup = [&] { host_gdtr_base::set(0x800000000000U); };
628  path.throws_exception = true;
629  path.exception = ""_ut_lee;
630  cfg.push_back(path);
631 }
632 
633 static void
634 setup_check_host_idtr_canonical_base_address_paths(std::vector<struct control_flow_path> &cfg)
635 {
636  path.setup = [&] { host_idtr_base::set(1U); };
637  path.throws_exception = false;
638  cfg.push_back(path);
639 
640  path.setup = [&] { host_idtr_base::set(0x800000000000U); };
641  path.throws_exception = true;
642  path.exception = ""_ut_lee;
643  cfg.push_back(path);
644 }
645 
646 static void
647 setup_check_host_tr_canonical_base_address_paths(std::vector<struct control_flow_path> &cfg)
648 {
649  path.setup = [&] { host_tr_base::set(1U); };
650  path.throws_exception = false;
651  cfg.push_back(path);
652 
653  path.setup = [&] { host_tr_base::set(0x800000000000U); };
654  path.throws_exception = true;
655  path.exception = ""_ut_lee;
656  cfg.push_back(path);
657 }
658 
659 static void
660 setup_check_host_if_outside_ia32e_mode_paths(std::vector<struct control_flow_path> &cfg)
661 {
663  path.throws_exception = false;
664  cfg.push_back(path);
665 
666  path.setup = [&]
667  {
668  g_msrs[ia32_efer::addr] = 0;
670  };
671  path.throws_exception = true;
672  path.exception = ""_ut_lee;
673  cfg.push_back(path);
674 
675  path.setup = [&]
676  {
679  };
680  path.throws_exception = true;
681  path.exception = ""_ut_lee;
682  cfg.push_back(path);
683 
684  path.setup = [&]
685  {
688  };
689  path.throws_exception = false;
690  cfg.push_back(path);
691 }
692 
693 static void
694 setup_check_host_address_space_size_exit_ctl_is_set_paths(std::vector<struct control_flow_path> &cfg)
695 {
696  path.setup = [&] { g_msrs[ia32_efer::addr] = 0; };
697  path.throws_exception = false;
698  cfg.push_back(path);
699 
700  path.setup = [&]
701  {
705  };
706  path.throws_exception = true;
707  path.exception = ""_ut_lee;
708  cfg.push_back(path);
709 
710  path.setup = [&]
711  {
714  };
715  path.throws_exception = false;
716  cfg.push_back(path);
717 }
718 
719 static void
720 setup_check_host_address_space_disabled_paths(std::vector<struct control_flow_path> &cfg)
721 {
722  path.setup = [&]
723  {
726  };
727  path.throws_exception = false;
728  cfg.push_back(path);
729 
730  path.setup = [&]
731  {
736  };
737  path.throws_exception = true;
738  path.exception = ""_ut_lee;
739  cfg.push_back(path);
740 
741  path.setup = [&]
742  {
746  };
747  path.throws_exception = true;
748  path.exception = ""_ut_lee;
749  cfg.push_back(path);
750 
751  path.setup = [&]
752  {
753  host_cr4::set(0U);
754  host_rip::set(0xf000000000U);
755  };
756  path.throws_exception = true;
757  path.exception = ""_ut_lee;
758  cfg.push_back(path);
759 
760  path.setup = [&] { host_rip::set(0U); };
761  path.throws_exception = false;
762  cfg.push_back(path);
763 }
764 
765 static void
766 setup_check_host_address_space_enabled_paths(std::vector<struct control_flow_path> &cfg)
767 {
768  path.setup = [&]
769  {
772  };
773  path.throws_exception = false;
774  cfg.push_back(path);
775 
776  path.setup = [&]
777  {
781  };
782  path.throws_exception = true;
783  path.exception = ""_ut_lee;
784  cfg.push_back(path);
785 
786  path.setup = [&]
787  {
789  host_rip::set(0x800000000000U);
790  };
791  path.throws_exception = true;
792  path.exception = ""_ut_lee;
793  cfg.push_back(path);
794 
795  path.setup = [&] { host_rip::set(0U); };
796  path.throws_exception = false;
797  cfg.push_back(path);
798 }
799 
800 void
801 vmcs_ut::test_check_host_state_all()
802 {
803  std::vector<struct control_flow_path> cfg;
805 
807 }
808 
809 void
810 vmcs_ut::test_check_host_control_registers_and_msrs_all()
811 {
812  std::vector<struct control_flow_path> cfg;
813  setup_check_host_control_registers_and_msrs_all_paths(cfg);
814 
816 }
817 
818 void
819 vmcs_ut::test_check_host_segment_and_descriptor_table_registers_all()
820 {
821  std::vector<struct control_flow_path> cfg;
822  setup_check_host_segment_and_descriptor_table_registers_all_paths(cfg);
823 
825 }
826 
827 void
828 vmcs_ut::test_check_host_address_space_size_all()
829 {
830  std::vector<struct control_flow_path> cfg;
831  setup_check_host_address_space_size_all_paths(cfg);
832 
834 }
835 
836 void
837 vmcs_ut::test_check_host_cr0_for_unsupported_bits()
838 {
839  std::vector<struct control_flow_path> cfg;
840  setup_check_host_cr0_for_unsupported_bits_paths(cfg);
841 
843 }
844 
845 void
846 vmcs_ut::test_check_host_cr4_for_unsupported_bits()
847 {
848  std::vector<struct control_flow_path> cfg;
849  setup_check_host_cr4_for_unsupported_bits_paths(cfg);
850 
852 }
853 
854 void
855 vmcs_ut::test_check_host_cr3_for_unsupported_bits()
856 {
857  std::vector<struct control_flow_path> cfg;
858  setup_check_host_cr3_for_unsupported_bits_paths(cfg);
859 
861 }
862 
863 void
864 vmcs_ut::test_check_host_ia32_sysenter_esp_canonical_address()
865 {
866  std::vector<struct control_flow_path> cfg;
867  setup_check_host_ia32_sysenter_esp_canonical_address_paths(cfg);
868 
870 }
871 
872 void
873 vmcs_ut::test_check_host_ia32_sysenter_eip_canonical_address()
874 {
875  std::vector<struct control_flow_path> cfg;
876  setup_check_host_ia32_sysenter_eip_canonical_address_paths(cfg);
877 
879 }
880 
881 void
882 vmcs_ut::test_check_host_verify_load_ia32_perf_global_ctrl()
883 {
884  std::vector<struct control_flow_path> cfg;
885  setup_check_host_verify_load_ia32_perf_global_ctrl_paths(cfg);
886 
888 }
889 
890 void
891 vmcs_ut::test_check_host_verify_load_ia32_pat()
892 {
893  std::vector<struct control_flow_path> cfg;
894  setup_check_host_verify_load_ia32_pat_paths(cfg);
895 
897 }
898 
899 void
900 vmcs_ut::test_check_host_verify_load_ia32_efer()
901 {
902  std::vector<struct control_flow_path> cfg;
903  setup_check_host_verify_load_ia32_efer_paths(cfg);
904 
906 }
907 
908 void
909 vmcs_ut::test_check_host_es_selector_rpl_ti_equal_zero()
910 {
911  std::vector<struct control_flow_path> cfg;
912  setup_check_host_es_selector_rpl_ti_equal_zero_paths(cfg);
913 
915 }
916 
917 void
918 vmcs_ut::test_check_host_cs_selector_rpl_ti_equal_zero()
919 {
920  std::vector<struct control_flow_path> cfg;
921  setup_check_host_cs_selector_rpl_ti_equal_zero_paths(cfg);
922 
924 }
925 
926 void
927 vmcs_ut::test_check_host_ss_selector_rpl_ti_equal_zero()
928 {
929  std::vector<struct control_flow_path> cfg;
930  setup_check_host_ss_selector_rpl_ti_equal_zero_paths(cfg);
931 
933 }
934 
935 void
936 vmcs_ut::test_check_host_ds_selector_rpl_ti_equal_zero()
937 {
938  std::vector<struct control_flow_path> cfg;
939  setup_check_host_ds_selector_rpl_ti_equal_zero_paths(cfg);
940 
942 }
943 
944 void
945 vmcs_ut::test_check_host_fs_selector_rpl_ti_equal_zero()
946 {
947  std::vector<struct control_flow_path> cfg;
948  setup_check_host_fs_selector_rpl_ti_equal_zero_paths(cfg);
949 
951 }
952 
953 void
954 vmcs_ut::test_check_host_gs_selector_rpl_ti_equal_zero()
955 {
956  std::vector<struct control_flow_path> cfg;
957  setup_check_host_gs_selector_rpl_ti_equal_zero_paths(cfg);
958 
960 }
961 
962 void
963 vmcs_ut::test_check_host_tr_selector_rpl_ti_equal_zero()
964 {
965  std::vector<struct control_flow_path> cfg;
966  setup_check_host_tr_selector_rpl_ti_equal_zero_paths(cfg);
967 
969 }
970 
971 void
972 vmcs_ut::test_check_host_cs_not_equal_zero()
973 {
974  std::vector<struct control_flow_path> cfg;
975  setup_check_host_cs_not_equal_zero_paths(cfg);
976 
978 }
979 
980 void
981 vmcs_ut::test_check_host_tr_not_equal_zero()
982 {
983  std::vector<struct control_flow_path> cfg;
984  setup_check_host_tr_not_equal_zero_paths(cfg);
985 
987 }
988 
989 void
990 vmcs_ut::test_check_host_ss_not_equal_zero()
991 {
992  std::vector<struct control_flow_path> cfg;
993  setup_check_host_ss_not_equal_zero_paths(cfg);
994 
996 }
997 
998 void
999 vmcs_ut::test_check_host_fs_canonical_base_address()
1000 {
1001  std::vector<struct control_flow_path> cfg;
1002  setup_check_host_fs_canonical_base_address_paths(cfg);
1003 
1005 }
1006 
1007 void
1008 vmcs_ut::test_check_host_gs_canonical_base_address()
1009 {
1010  std::vector<struct control_flow_path> cfg;
1011  setup_check_host_gs_canonical_base_address_paths(cfg);
1012 
1014 }
1015 
1016 void
1017 vmcs_ut::test_check_host_gdtr_canonical_base_address()
1018 {
1019  std::vector<struct control_flow_path> cfg;
1020  setup_check_host_gdtr_canonical_base_address_paths(cfg);
1021 
1023 }
1024 
1025 void
1026 vmcs_ut::test_check_host_idtr_canonical_base_address()
1027 {
1028  std::vector<struct control_flow_path> cfg;
1029  setup_check_host_idtr_canonical_base_address_paths(cfg);
1030 
1032 }
1033 
1034 void
1035 vmcs_ut::test_check_host_tr_canonical_base_address()
1036 {
1037  std::vector<struct control_flow_path> cfg;
1038  setup_check_host_tr_canonical_base_address_paths(cfg);
1039 
1041 }
1042 
1043 void
1044 vmcs_ut::test_check_host_if_outside_ia32e_mode()
1045 {
1046  std::vector<struct control_flow_path> cfg;
1047  setup_check_host_if_outside_ia32e_mode_paths(cfg);
1048 
1050 }
1051 
1052 void
1053 vmcs_ut::test_check_host_address_space_size_exit_ctl_is_set()
1054 {
1055  std::vector<struct control_flow_path> cfg;
1056  setup_check_host_address_space_size_exit_ctl_is_set_paths(cfg);
1057 
1059 }
1060 
1061 void
1062 vmcs_ut::test_check_host_address_space_disabled()
1063 {
1064  std::vector<struct control_flow_path> cfg;
1065  setup_check_host_address_space_disabled_paths(cfg);
1066 
1068 }
1069 
1070 void
1071 vmcs_ut::test_check_host_address_space_enabled()
1072 {
1073  std::vector<struct control_flow_path> cfg;
1074  setup_check_host_address_space_enabled_paths(cfg);
1075 
1077 }
void entry_ctl_allow1(uint64_t mask)
Definition: test.cpp:110
void exit_ctl_allow0(uint64_t mask)
Definition: test.cpp:106
#define test_vmcs_check(cfg,...)
Definition: test.h:36
constexpr const auto mask
Definition: cpuid_x64.h:85
bool throws_exception
Definition: test.h:44
void entry_ctl_allow0(uint64_t mask)
Definition: test.cpp:114
constexpr const auto addr
Definition: cpuid_x64.h:80
std::map< msrs::field_type, msrs::value_type > g_msrs
std::shared_ptr< std::exception > exception
Definition: test.h:43
void setup_check_host_state_all_paths(std::vector< struct control_flow_path > &cfg)
constexpr const auto uncacheable
Definition: x64.h:42
void exit_ctl_allow1(uint64_t mask)
Definition: test.cpp:102
void set(T val) noexcept
Definition: crs_intel_x64.h:52
Definition: cache_x64.h:31
std::function< void()> setup
Definition: test.h:42