Commit Graph

309 Commits

Author SHA1 Message Date
Sae86 9f13a489ae Add return codes support to sgx_check, smm, smm_code_check, smm_dma, smrr
Signed-off-by: Sae86 <sara.batllori@intel.com>
2023-10-31 16:36:50 -07:00
Sae86 4f90987931 Add return codes support to sgx_check, smm, smm_code_check, smm_dma, smrr
Signed-off-by: Sae86 <sara.batllori@intel.com>
2023-10-31 16:36:50 -07:00
Nathaniel Mitchell 4c4d8a94ca Fix BaseModule call in vmm modules
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-10-31 16:36:13 -07:00
Sae86 4c582b2573 Add return codes support to ia32cfg, me_mfg_mode, memconfig, memlock, rtclock
Signed-off-by: Sae86 <sara.batllori@intel.com>
2023-10-25 21:22:22 -07:00
Nathaniel Mitchell f47f54d33a Add check to debugenabled for ECTRL register definition
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-10-25 16:35:28 -07:00
Sae86 2c9d457970 Add return codes support to bios_kbrd_buffer, bios_smi, bios_ts, bios_wp and debugenabled
Signed-off-by: Sae86 <sara.batllori@intel.com>
2023-10-25 16:35:08 -07:00
Sae86 ef24524d78 Add return codes support to cpu, secureboot and uefi folders in common
Signed-off-by: Sae86 <sara.batllori@intel.com>
2023-10-25 16:34:21 -07:00
Sae86 4a8057d904 Update remaining SKIPPED results and references
Signed-off-by: Sae86 <sara.batllori@intel.com>
2023-10-17 16:36:31 -07:00
Sae86 715dfbb678 Fix res being referenced before assignment issue
Signed-off-by: Sae86 <sara.batllori@intel.com>
2023-10-16 16:37:40 -07:00
Sae86 2358adfd51 Add module that generates test IDs for return codes
Signed-off-by: Sae86 <sara.batllori@intel.com>
2023-10-09 16:37:28 -07:00
Sae86 c0a488a7c0 Revert "Add return codes support to cpuid_fuzz, ept_finder and hypercallfuzz (tools/vmm)"
This reverts commit 041da2f54485aaf56018df3bfd9e2478190aa680.

Signed-off-by: Sae86 <sara.batllori@intel.com>
2023-09-29 09:01:13 -07:00
Sae86 a8530707e5 Add return codes support to cpuid_fuzz, ept_finder and hypercallfuzz (tools/vmm)
Signed-off-by: Sae86 <sara.batllori@intel.com>
2023-09-29 09:01:13 -07:00
Sae86 85a76f6475 Add return codes support to tools/vmm/hv
Signed-off-by: Sae86 <sara.batllori@intel.com>
2023-09-29 09:01:13 -07:00
Sae86 78834bd04b Add return codes support to cpuid_fuzz, ept_finder and hypercallfuzz (tools/vmm)
Signed-off-by: Sae86 <sara.batllori@intel.com>
2023-09-29 08:28:03 -07:00
Sae86 aaed42dde1 Add return codes support to cpuid_fuzz, ept_finder and hypercallfuzz (tools/vmm)
Signed-off-by: Sae86 <sara.batllori@intel.com>
2023-09-28 21:54:06 -07:00
Sae86 40e544a66f Add return codes support to vbox and xen folders in tools
Signed-off-by: Sae86 <sara.batllori@intel.com>
2023-09-28 21:24:41 -07:00
Sae86 6a32675590 Add return codes support to iofuzz, msr_fuzz, pcie_fuzz, pcie_overlap_fuzz (tools/vmm)
Signed-off-by: Sae86 <sara.batllori@intel.com>
2023-09-28 21:23:34 -07:00
Sae86 24bd626f7e Add return codes support to vmm.venom and wsmt in tools
Signed-off-by: Sae86 <sara.batllori@intel.com>
2023-09-28 21:23:18 -07:00
Nicolas Iooss 9a0f04e2a1 Import modules traceback and errno when they are needed
When loading the kernel module fails on Linux, `chipsec_util.py`
raises an error in

    logger().log_debug(traceback.format_exc())

because `traceback` was not imported.

Fix this issue by importing the missing modules `traceback` and `errno`.
While at it, import `traceback` too in other files where it was missing.

Signed-off-by: Nicolas Iooss <nicolas.iooss_git@polytechnique.org>
2023-09-06 16:37:59 -07:00
Nathaniel Mitchell 89f4be530f Update sgx_check and vbox_crash_apicbase
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-08-15 16:39:01 -07:00
Dan Scott b3d974b51a Update modules and utils to match config parsing update
Signed-off-by: Dan Scott <dan.scott@intel.com>
2023-07-28 09:34:00 -07:00
Nathaniel Mitchell a6ec8e0dd3 Update remap.py for when IBECC is enabled (EHL)
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-07-05 16:37:36 -07:00
Sara Batllori 318b361621 WIP: Add return codes changes to module_common and testcase plus remap support
Signed-off-by: Sara Batllori <sara.batllori@intel.com>
2023-06-27 17:47:46 -07:00
Nicolas Iooss e8d41ab9ee Replace binascii.hexlify with bytes.hex
Python 3.5 introduced `bytes.hex` to represent bytes in hexadecimal:
https://docs.python.org/3.5/library/stdtypes.html#bytes.hex

This function directly returns a string, contrary to `binascii.hexlify`
which returns bytes. Using `binascii.hexlify` without transforming the
output to string actually produced buggy output. For example:

    $ ./chipsec_util.py spidesc spi_rom.bin
    ...
    + 0x0000 Reserved : 0xb'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF'

This `b'` is not desired. Using `bytes.hex` fixes this issue and makes
the code simpler.

Signed-off-by: Nicolas Iooss <nicolas.iooss_git@polytechnique.org>
2023-06-05 16:43:15 -07:00
Nicolas Iooss 9be66dadbd Replace print_buffer(bytestostring(data)) with print_buffer_bytes
`print_buffer_bytes` can directly handle bytes, instead of converting
them to a string.

While at it, replace buggy calls to `print_buffer(buffer)` (when
`buffer` uses type `bytes`) with `print_buffer_bytes(buffer)`.
This fixes `./chipsec_util.py idt 0`. Before it failed with:

    [CHIPSEC] Dumping IDT of 8 CPU threads
    [cpu0] Physical Address: 0x000000036639E000
    [cpu0] # of entries    : 256
    [cpu0] Contents (4 entries):
    Traceback (most recent call last):
      File "./chipsec_util.py", line 210, in <module>
        sys.exit(main())
      File "./chipsec_util.py", line 205, in main
        return chipsecMain.main()
      File "./chipsec_util.py", line 190, in main
        comm.run()
      File "chipsec/utilcmd/desc_cmd.py", line 84, in run
        self.cs.msr.IDT_all(4)
      File "chipsec/hal/msr.py", line 166, in IDT_all
        self.IDT(tid, num_entries)
      File "chipsec/hal/msr.py", line 158, in IDT
        return self.dump_Descriptor_Table(cpu_thread_id, DESCRIPTOR_TABLE_CODE_IDTR, num_entries)
      File "chipsec/hal/msr.py", line 144, in dump_Descriptor_Table
        print_buffer(dt)
      File "chipsec/logger.py", line 493, in print_buffer
        prt_str = bytes2string(arr, length)
      File "chipsec/logger.py", line 466, in bytes2string
        num_string += [f'{ord(c):02X} ']
    TypeError: ord() expected string of length 1, but int found

There was another bug in `hal/msr.py` where `ord(dt[...])` was used
instead of `dt`.

Signed-off-by: Nicolas Iooss <nicolas.iooss_git@polytechnique.org>
2023-05-31 16:39:35 -07:00
Nathaniel Mitchell 0016b0c14c Clean up oshelper
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-05-26 18:32:51 -07:00
nstarke 61fcd60637 Fixing broken 'intelsecurity.com' link with wayback link 2023-05-08 09:05:13 -07:00
Sara Batllori 25a50ac8cc f'string updates to vmm subfolders in tools
Signed-off-by: Sara Batllori <sara.batllori@intel.com>
2023-04-25 15:26:15 -07:00
Sara Batllori 31b7edb884 f'string updates to cpuid
Signed-off-by: Sara Batllori <sara.batllori@intel.com>
2023-04-25 08:32:10 -07:00
Sara Batllori a981fbbd1d f'string updates to msr_fuzz, pcie_fuzz and pcie_overlap_fuzz
Signed-off-by: Sara Batllori <sara.batllori@intel.com>
2023-04-25 08:31:53 -07:00
Nathaniel Mitchell 1ea833bbc0 Clean up memconfig
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-04-25 08:31:11 -07:00
Sara Batllori 152a8c44ec f'string updates to vmm hv folder in tools
Signed-off-by: Sara Batllori <sara.batllori@intel.com>
2023-04-24 14:03:39 -07:00
Nathaniel Mitchell d209262ff6 Add type hinting and f'
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-04-24 14:03:19 -07:00
Nathaniel Mitchell b74183824d Update uefi variable test to not require dbx
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-04-24 14:03:19 -07:00
Dan Scott 54a81b8a78 Add flush method, typehints, fstrings to common.py
Signed-off-by: Dan Scott <dan.scott@intel.com>
2023-04-20 10:26:48 -07:00
Sara Batllori 86ecd5f087 f-string updates for cpu, secureboot and smm folders in tools
Signed-off-by: Sara Batllori <sara.batllori@intel.com>
2023-04-12 09:09:58 -07:00
Sara Batllori 36ca280c8a f-string updates for uefi folder in tools
Signed-off-by: Sara Batllori <sara.batllori@intel.com>
2023-04-12 09:09:05 -07:00
Nathaniel Mitchell 47bc4b2198 Fix issue with modifying variables in variables.py
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2023-01-18 17:42:42 -08:00
brentholtsclaw 7af173a43c Module and command changes to work with hal
Signed-off-by: brentholtsclaw <brent.holtsclaw@intel.com>
2022-12-05 16:34:48 -08:00
Frinzell, Aaron c4f8aa95c2 Removed deprecated logger functions
Signed-off-by: Frinzell, Aaron <aaron.frinzell@intel.com>
2022-12-05 17:41:00 -06:00
Nathaniel Mitchell d6b78e24ac Add fw bleed vuln to scan_blocked tool
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2022-09-30 14:54:17 -07:00
Frinzell, Aaron 0326a20d15 Remove broken link from smm_dma.py
Signed-off-by: Frinzell, Aaron <aaron.frinzell@intel.com>
2022-08-26 09:45:26 -07:00
Frinzell, Aaron 62af364780 Better docstring formatting in smm_dma.py
Signed-off-by: Frinzell, Aaron <aaron.frinzell@intel.com>
2022-08-26 09:45:26 -07:00
Frinzell, Aaron 3ad040e4ec Update is_supported() in memconfig.py
Signed-off-by: Frinzell, Aaron <aaron.frinzell@intel.com>
2022-08-24 16:50:07 -07:00
Frinzell, Aaron a7ca74c120 Clean up py2 class object
Signed-off-by: Frinzell, Aaron <aaron.frinzell@intel.com>
2022-08-24 13:28:16 -07:00
Nathaniel Mitchell 291632c0ee Apply flake8 code formatting rules against repo
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2022-07-28 09:17:10 -07:00
Sara Batllori 89cc29a194 Improve skipped messaging
Signed-off-by: Sara Batllori <sara.batllori@intel.com>
2022-07-25 17:05:29 -07:00
Sara Batllori 344043b37d Remove sphinx warnings
Signed-off-by: Sara Batllori <sara.batllori@intel.com>
2022-07-25 17:05:19 -07:00
Frinzell, Aaron d7349fad14 Move wsmt.py to tools
Signed-off-by: Frinzell, Aaron <aaron.frinzell@intel.com>
2022-07-25 17:03:23 -07:00
Frinzell, Aaron e5af018eb4 Update log_verbose() in bios_ts.py and sgx_check.py
Signed-off-by: Frinzell, Aaron <aaron.frinzell@intel.com>
2022-06-30 10:53:31 -07:00