From fa9d06f4a7ee79645ca753e3615b6af02a534c48 Mon Sep 17 00:00:00 2001 From: Nathaniel Mitchell Date: Wed, 24 Jul 2024 08:47:18 -0700 Subject: [PATCH] Add try/except block when copying BARs in rogue_mmio_bar tool Signed-off-by: Nathaniel Mitchell --- chipsec/modules/tools/smm/rogue_mmio_bar.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/chipsec/modules/tools/smm/rogue_mmio_bar.py b/chipsec/modules/tools/smm/rogue_mmio_bar.py index 4c97d2547c..c6c7767847 100644 --- a/chipsec/modules/tools/smm/rogue_mmio_bar.py +++ b/chipsec/modules/tools/smm/rogue_mmio_bar.py @@ -91,7 +91,15 @@ def smi_mmio_range_fuzz(self, thread_id, b, d, f, bar_off, is64bit, bar, new_bar # copy all registers from MMIO range to new location in memory # we do that once rather than before every SMI since we return after first change detected self.logger.log(f'[*] copying BAR 0x{base:X} > 0x{self.reloc_mmio:X}') - orig_mmio = self.copy_bar(base, self.reloc_mmio, size) + try: + orig_mmio = self.copy_bar(base, self.reloc_mmio, size) + except Exception as e: + self.logger.log_failed('Unable to copy bar. Skipping.') + self.logger.log_verbose(str(e)) + if self.cs.os_helper.is_windows(): + self.logger.log_important('Try running in Linux for better coverage.') + return False + if self.logger.VERBOSE: self.cs.mmio.dump_MMIO(base, size) write_file('mmio_mem.orig', orig_mmio)