Commit Graph

1318 Commits

Author SHA1 Message Date
Aaron Frinzell 65075eb417 Lets get all corner cases 2022-01-10 15:04:33 -08:00
Aaron Frinzell b0ec47063b Fix scan_image.py arg count check 2022-01-10 15:04:33 -08:00
Aaron Frinzell 8de16fcac9 Better remap.py logic if not reading REMAP registers properly 2022-01-10 15:04:33 -08:00
brentholtsclaw 613bd8e715 Modify is_supported and logic to support other OS
Signed-off-by: brentholtsclaw <brent.holtsclaw@intel.com>
2022-01-10 15:04:33 -08:00
brentholtsclaw 5c0d89738b Handle case when rsdp_pa is not found within
_find_RSDP_in_EFI_config_table

Signed-off-by: brentholtsclaw <brent.holtsclaw@intel.com>
2022-01-10 15:04:33 -08:00
Erik Bjorge 7f106b2962 Added ability to dump unnamed MMIO regions
Signed-off-by: Erik Bjorge <erik.c.bjorge@intel.com>
2022-01-10 15:04:33 -08:00
Nicolas Iooss 4599981389 Use copy_from_kernel_nofault when reading physical memory
Currently Linux driver uses `memcpy` when reading physical memory. This
causes a kernel panic on some systems when trying to access "forbidden"
physical memory. The Linux kernel provides function
`copy_from_kernel_nofault` (previously named `probe_kernel_read`) to read
memory without crashing (and this function is used by the implementation
of `/dev/mem`).

Replace `memcpy` with `copy_from_kernel_nofault`, providing a simple
wrapper for older kernels.

While at it:
- Move the allocation of a bounce buffer outside of the while loop. As
  memory is always read one page at a time, a `PAGE_SIZE` buffer is
  enough.
- Use `size_t` as the type of `sz` instead of the signed type `ssize_t`.
- Replace calls to `min_t` with `if` statements which are easier to read.
- Name the number of written bytes `written` instead of `read`, in
  `write_mem`.
- Remove stray spaces in various places.

By the way, the `write_mem` function was not updated to use
`copy_to_kernel_nofault`, as this function has no longer been exported
since Linux 5.8.

Fixes: https://github.com/chipsec/chipsec/issues/1094
Signed-off-by: Nicolas Iooss <nicolas.iooss_git@polytechnique.org>
2022-01-10 15:04:33 -08:00
Aaron Frinzell 4b79df8784 Move UEFI Shell to Python 3.6.8 2022-01-10 15:04:33 -08:00
Erik Bjorge 8cb1ccda94 Optimized PCI CFG dump
Converted to using DWORD reads to dump PCI configuration space reducing
the total number of reads needed.

Signed-off-by: Erik Bjorge <erik.c.bjorge@intel.com>
2022-01-10 15:04:33 -08:00
Erik Bjorge 60abef2d03 Extended PCI dump functionality
Updated PCI dump to allow for optional device and function parameters.
This allows limiting the dump to a specific bus or bus and device.

Signed-off-by: Erik Bjorge <erik.c.bjorge@intel.com>
2022-01-10 15:04:33 -08:00
Sae86 afd202a861 Add functionality to search for metadata tags in test modules
Signed-off-by: Sae86 <sara.batllori@intel.com>
2022-01-10 15:04:33 -08:00
Aaron Frinzell 2db6dfb1d9 Add usage documentation to smm_dma.py 2022-01-10 15:04:33 -08:00
Aaron Frinzell efd1d4f1d1 Add usage documentation to smrr.py 2022-01-10 15:04:33 -08:00
Nicolas Iooss a6117c27b1 Log QWORD memory read as "qword"
`Memory.read_physical_mem_qword` logged reads of QWORD values as:

    [mem] dword at PA = ...

Use qword instead. While at it, pad values with zeros, like the other
functions which read integers.

Signed-off-by: Nicolas Iooss <nicolas.iooss_git@polytechnique.org>
2022-01-10 15:04:33 -08:00
Nicolas Iooss 762042df59 Revert "Backport patch for DKMS 3.0 regression"
This reverts commit 67912f14b9. Arch Linux
updated package dkms with the fix for the regression. So the fix is no
longer needed in GitHub Action workflow.

Signed-off-by: Nicolas Iooss <nicolas.iooss_git@polytechnique.org>
2022-01-10 15:04:33 -08:00
brentholtsclaw e3de327631 Update version
Signed-off-by: brentholtsclaw <brent.holtsclaw@intel.com>
2021-12-02 16:18:44 -08:00
Nicolas Iooss a936d23874 Backport patch for DKMS 3.0 regression
DKMS 3.0 broke `dkms add drivers/linux` (cf.
https://github.com/chipsec/chipsec/pull/1305#issuecomment-970693380).
This was fixed upstream in https://github.com/dell/dkms/pull/178.

While waiting for a new DKMS release which would be applied by Arch
Linux maintainers, it is possible to work around the issue by removing
some checks from the `dkms` script. Add a `sed` command which does that.

Signed-off-by: Nicolas Iooss <nicolas.iooss_git@polytechnique.org>
2021-12-02 16:18:44 -08:00
Aaron Frinzell 28719fdf75 Some mmio.py enhancements 2021-12-02 16:18:44 -08:00
Sae86 767e413e7f Improvements to sphinx
Signed-off-by: Sae86 <sara.batllori@intel.com>
2021-12-02 16:18:44 -08:00
brentholtsclaw b51edd5444 Fix bugs within locks_cmd
Signed-off-by: brentholtsclaw <brent.holtsclaw@intel.com>
2021-12-02 16:18:44 -08:00
Adrián Herrera Arcila 17abf94ea3 [PATCH] Fix VLA parameter warning (#893)
Make VLA buffer types consistent in declarations and definitions.
Resolves build crash when using -Werror due to "vla-parameter" warning.

Signed-off-by: Adrian Herrera <adr.her.arc.95@gmail.com>
Upstream-status: Backport [https://github.com/google/brotli/commit/0a3944c8c99b8d10cc4325f721b7c273d2b41f7b]
2021-12-02 16:18:44 -08:00
brentholtsclaw 3c12328991 Sync up iobar and mmio bar list routines
Signed-off-by: brentholtsclaw <brent.holtsclaw@intel.com>
2021-12-02 16:18:44 -08:00
brentholtsclaw f4c4802067 Clean up some spacing
Signed-off-by: brentholtsclaw <brent.holtsclaw@intel.com>
2021-12-02 16:18:44 -08:00
brentholtsclaw 2512142949 change read_register memory to return int opposed to bytes
Signed-off-by: brentholtsclaw <brent.holtsclaw@intel.com>
2021-12-02 16:18:44 -08:00
brentholtsclaw e84a52a902 bug fix apic table updates to fadt table
Signed-off-by: brentholtsclaw <brent.holtsclaw@intel.com>
2021-12-02 16:18:44 -08:00
brentholtsclaw 4eab99f160 dev-2.0.0 only load platform and pch files
Signed-off-by: brentholtsclaw <brent.holtsclaw@intel.com>
2021-11-29 17:07:38 -08:00
brentholtsclaw 70a46219a6 Update Unittest framework
Signed-off-by: brentholtsclaw <brent.holtsclaw@intel.com>
2021-10-26 16:48:44 -07:00
brentholtsclaw 2b568a54f8 Fixup config loading for mmio regs
Signed-off-by: brentholtsclaw <brent.holtsclaw@intel.com>
2021-10-26 16:36:25 -07:00
brentholtsclaw 357d7f07ce Changes to get locks fix locks results
Signed-off-by: brentholtsclaw <brent.holtsclaw@intel.com>
2021-10-26 16:36:25 -07:00
brentholtsclaw c4fd9ab605 Make naming consistent within config files
Signed-off-by: brentholtsclaw <brent.holtsclaw@intel.com>
2021-10-26 16:36:25 -07:00
Nathaniel Mitchell da9d2a1493 Update to 1.7.2
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2021-10-11 16:26:41 -07:00
Aaron Frinzell b4fcb8ac60 Merge MMIO multi-bus updates 2021-10-11 16:26:41 -07:00
Sae86 681bbf28f3 Move docstring from class
Update usage in argparser
    Update for more than one class

Signed-off-by: Sae86 <sara.batllori@intel.com>
2021-10-11 16:26:41 -07:00
Aaron Frinzell d7a6dbbed5 Updates to spd_wd.py 2021-10-11 16:26:41 -07:00
Nathaniel Mitchell e4547c9980 Fix exception when loaded config does not have a sku element
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2021-10-11 16:26:41 -07:00
Sae86 579c0dc165 Add docstrings to some HALs
Signed-off-by: Sae86 <sara.batllori@intel.com>
2021-10-11 16:26:41 -07:00
Aaron Frinzell 13234cadcd Expand usage documentation in rogue_mmio_bar.py 2021-10-11 16:26:41 -07:00
brentholtsclaw b8710c5025 Address Comments
Signed-off-by: brentholtsclaw <brent.holtsclaw@intel.com>
2021-10-11 16:26:41 -07:00
brentholtsclaw be2fa7744a Update CONSISTENCY_CHECKING
Signed-off-by: brentholtsclaw <brent.holtsclaw@intel.com>
2021-10-11 16:26:41 -07:00
brentholtsclaw f8aa4341b1 Create hal locks and lock_check_cmd
Signed-off-by: brentholtsclaw <brent.holtsclaw@intel.com>
2021-10-11 16:26:41 -07:00
Nathaniel Mitchell 84121ba735 Remove ubuntu16.04 per support being removed.
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2021-10-11 16:26:41 -07:00
Sae86 c9d004a768 Minor fixes to documentation
Signed-off-by: Sae86 <sara.batllori@intel.com>
2021-10-11 16:26:41 -07:00
Sae86 861038b556 Show only main docstring for modules
Signed-off-by: Sae86 <sara.batllori@intel.com>
2021-10-11 16:26:41 -07:00
brentholtsclaw 686d263f5f dev-2.0.0 branch config fixes
Signed-off-by: brentholtsclaw <brent.holtsclaw@intel.com>
2021-09-27 15:30:30 -07:00
brentholtsclaw 6c3e6f9320 Add register scoping to framework
Signed-off-by: brentholtsclaw <brent.holtsclaw@intel.com>
2021-09-08 11:36:19 -07:00
brentholtsclaw a8cce85f84 Update modules.common to add scope for registers
Signed-off-by: brentholtsclaw <brent.holtsclaw@intel.com>
2021-09-08 11:24:19 -07:00
brentholtsclaw a527215252 Dev-2.0.0 modify configuraiton loading
Signed-off-by: brentholtsclaw <brent.holtsclaw@intel.com>
2021-09-08 11:20:30 -07:00
brentholtsclaw 8874b73da5 Cleanup configs
remove artifacts that are not used/needed
Signed-off-by: brentholtsclaw <brent.holtsclaw@intel.com>
2021-09-08 11:16:12 -07:00
brentholtsclaw 10c2102956 Dev 2.0.0 - reorganize configuration files
Signed-off-by: brentholtsclaw <brent.holtsclaw@intel.com>
2021-09-08 11:16:12 -07:00
Nathaniel Mitchell f6dbffe100 Update to 1.7.1
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2021-08-31 16:35:56 -07:00