Skip to content

Commit

Permalink
Revert "Add return codes support to cpuid_fuzz, ept_finder and hyperc…
Browse files Browse the repository at this point in the history
…allfuzz (tools/vmm)"

This reverts commit 041da2f.

Signed-off-by: Sae86 <[email protected]>
  • Loading branch information
Sae86 committed Sep 29, 2023
1 parent 6919ea8 commit 85f176e
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 19 deletions.
3 changes: 0 additions & 3 deletions chipsec/modules/tools/vmm/cpuid_fuzz.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,6 @@


class cpuid_fuzz (BaseModule):
def __init__(self):
BaseModule().__init__()
self.rc_res = ModuleResult(17, 'https://chipsec.github.io/modules/chipsec.modules.tools.vmm.cpuid_fuzz.html')

def fuzz_CPUID(self, eax_start, random_order = False):
eax_range = _NO_EAX_TO_FUZZ
Expand Down
13 changes: 4 additions & 9 deletions chipsec/modules/tools/vmm/ept_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ def __init__(self):
BaseModule.__init__(self)
self.read_from_file = False
self.par = []
self.rc_res = ModuleResult(18, 'https://chipsec.github.io/modules/chipsec.modules.tools.vmm.ept_finder.html')

def read_physical_mem(self, addr, size=0x1000):
if self.read_from_file:
Expand Down Expand Up @@ -208,24 +207,21 @@ def run(self, module_argv):
else:
self.logger.log_error('Invalid parameters')
self.logger.log(self.__doc__.replace('`', ''))
self.rc_res.setStatusBit(self.rc_res.status.UNSUPPORTED_OPTION)
return self.rc_res.getReturnCode(ModuleResult.ERROR)
return ModuleResult.ERROR
else:
revision_id = self.cs.msr.read_msr(0, 0x480)[0]
self.par = self.get_memory_ranges()

if len(self.par) == 0:
self.logger.log_error("Memory ranges are not defined!")
self.rc_res.setStatusBit(self.rc_res.status.UNDEFINED_RANGES)
return self.rc_res.getReturnCode(ModuleResult.ERROR)
return ModuleResult.ERROR

if (len(module_argv) == 2) and (module_argv[0] == "dump"):
for (pa, end_pa, _) in self.par:
postfix = "lo" if pa == 0x0 else "hi" if pa == 0x100000000 else "0x{:08x}".format(pa)
filename = "{}.dram_{}".format(module_argv[1], postfix)
self.dump_dram(filename, pa, end_pa)
self.rc_res.setStatusBit(self.rc_res.status.SUCCESS)
return self.rc_res.getReturnCode(ModuleResult.PASSED)
return ModuleResult.PASSED

self.logger.log('[*] Searching Extended Page Tables ...')
ept_pt_list = self.find_ept_pt({}, 0, 4)
Expand Down Expand Up @@ -259,5 +255,4 @@ def run(self, module_argv):
ept.save_configuration(self.path + 'ept_{:08x}.py'.format(eptp))
count += 1

self.rc_res.setStatusBit(self.rc_res.status.INFORMATION)
return self.rc_res.getReturnCode(ModuleResult.INFORMATION)
return ModuleResult.INFORMATION
1 change: 0 additions & 1 deletion chipsec/modules/tools/vmm/hv/synth_dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ def print_statistics(self):
class synth_dev(BaseModule):
def __init__(self):
BaseModule.__init__(self)
self.responses = {}
self.rc_res = ModuleResult(11, 'https://chipsec.github.io/modules/chipsec.modules.tools.vmm.hv.synth_dev.html')

def usage(self):
Expand Down
2 changes: 1 addition & 1 deletion chipsec/modules/tools/vmm/hv/synth_kbd.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def run(self, module_argv):
else:
self.usage()
self.rc_res.setStatusBit(self.rc_res.status.UNSUPPORTED_OPTION)
return self.rc_res.getReturnCode(ModuleResult.SKIPPED)
return self.rc_res.getReturnCode(ModuleResult.ERROR)

vb = VMBusDiscovery()
vb.debug = True
Expand Down
7 changes: 2 additions & 5 deletions chipsec/modules/tools/vmm/hypercallfuzz.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ class hypercallfuzz(BaseModule):
def __init__(self):
BaseModule.__init__(self)
self.vmm = VMM(self.cs)
self.rc_res = ModuleResult(19, 'https://chipsec.github.io/modules/chipsec.modules.tools.vmm.hypercallfuzz.html')

self.random_order = True
self.gprs = GPRS
Expand Down Expand Up @@ -148,8 +147,7 @@ def fuzz_generic_hypercalls(self):
pass

self.logger.log(f'[*] Finished fuzzing: time elapsed {time.time() - t:.3f}')
self.rc_res.setStatusBit(self.rc_res.status.VERIFY)
return self.rc_res.getReturnCode(ModuleResult.WARNING)
return ModuleResult.WARNING

def run(self, module_argv):
self.logger.start_test("Dumb VMM hypercall fuzzer")
Expand Down Expand Up @@ -179,6 +177,5 @@ def run(self, module_argv):

self.logger.log_information('Module completed')
self.logger.log_warning('System may be in an unknown state, further evaluation may be needed.')
self.rc_res.setStatusBit(self.rc_res.status.VERIFY)
self.res = self.rc_res.getReturnCode(ModuleResult.WARNING)
self.res = ModuleResult.WARNING
return self.res

0 comments on commit 85f176e

Please sign in to comment.