diff --git a/chipsec/modules/tools/smm/smm_ptr.py b/chipsec/modules/tools/smm/smm_ptr.py index cb19fb45cc..c0f307603b 100644 --- a/chipsec/modules/tools/smm/smm_ptr.py +++ b/chipsec/modules/tools/smm/smm_ptr.py @@ -215,6 +215,8 @@ def clear(self): self.confirmed = False def add(self, duration, code, data, gprs, confirmed=False): + if duration is None: + return if not self.code: self.code = code outlier = self.is_outlier(duration) @@ -444,6 +446,7 @@ def smi_fuzz_iter(self, thread_id, _addr, _smi_desc, fill_contents=True, restore if not scan: self.send_smi(thread_id, _smi_desc.smi_code, _smi_desc.smi_data, _smi_desc.name, _smi_desc.desc, _rax, _rbx, _rcx, _rdx, _rsi, _rdi) else: + duration = None _, duration = self.send_smi_timed(thread_id, _smi_desc.smi_code, _smi_desc.smi_data, _smi_desc.name, _smi_desc.desc, _rax, _rbx, _rcx, _rdx, _rsi, _rdi) # # Re-do the call if it was identified as an outlier, due to periodic SMI delays @@ -484,7 +487,7 @@ def test_config(self, thread_id, _smi_config_fname, _addr, _addr1): for line in fcfg: if '' == line.strip(): self.logger.log(f'\n[*] Testing SMI# 0x{_smi_desc.smi_code:02X} (data: 0x{_smi_desc.smi_data:02X}) {_smi_desc.name} ({_smi_desc.desc})') - if selfsmi_fuzz_iter(thread_id, _addr, _smi_desc): + if self.smi_fuzz_iter(thread_id, _addr, _smi_desc): bad_ptr_cnt += 1 _smi_desc = None _smi_desc = smi_desc() @@ -608,7 +611,7 @@ def test_fuzz(self, thread_id, smic_start, smic_end, _addr, _addr1, scan_mode=Tr if scan and scan.skip(): break if scan_mode: - msg = scan.log_smi_result(self.logger) + scan.log_smi_result(self.logger) scan.clear() return bad_ptr_cnt, scan @@ -709,12 +712,13 @@ def run(self, module_argv): bad_ptr_cnt, _ = self.test_fuzz(thread_id, smic_start, smic_end, _addr, _addr1) elif test_mode in ['scan']: scan_mode = True + scan = None bad_ptr_cnt, scan = self.test_fuzz(thread_id, smic_start, smic_end, _addr, _addr1, True) except BadSMIDetected as msg: bad_ptr_cnt = 1 self.logger.log_important("Potentially bad SMI detected! Stopped fuzing (see FUZZ_BAIL_ON_1ST_DETECT option)") - if scan_mode: + if scan_mode and scan: self.logger.log_good(f'<<< Done: found {scan.get_total_outliers()} long-running SMIs') if bad_ptr_cnt > 0: self.logger.log_bad(f'<<< Done: found {bad_ptr_cnt:d} potential occurrences of unchecked input pointers')