elfloader: band-aid handling of PHDRs that span flash pages

- inspect the PHDR p_type field without copying the entire header
  when checking if a PHDR is loadable (we assume the PHDR is
  word-aligned which is probably ok)
- advance to a new flash page--as needed--when reading a PHDR
- add an assert with an informative message when checking for a
  PHDR that spans flash pages; previously this would trigger an
  obscure assert when constructing the slice of raw bytes
- add Elf32Phdr::get_type() to return just the p_type field of a PHDR
- change Elf32Phdr::from_bytes() to take an immutable ref

This hacks around problems where the latest CHERIoT lld appends PHDRs
that require multiple flash pages but are not loaded. A better fix would
assemble PHDR's that span flash pages.

Change-Id: I1cfdc93ecb79fa7008bdfcab8a9210fbaaf89baf
2 files changed
tree: 40cc5983128f415529fa477fc561a54095069ea1
  1. app/
  2. blob_fs/
  3. capsules/
  4. config/
  5. hal/
  6. platform/
  7. utils/
  8. .gitignore
  9. CONTRIBUTING.md
  10. LICENSE
  11. matcha.code-workspace
  12. README.md
README.md

Matcha SW Repository

This project contains the support needed to build a TockOS artifact that can run on the Matcha security core, and integrated as part of the Shodan repository.

Prerequisite

If you get this project from Project Shodan manifest, you are all set.

This project needs to be at <dir>/sw/matcha.

Code structure

  • app: TockOS applications (including the boot loader)
  • blob_fs: prototype implementation of a Blob filesystem (unused)
  • capsules: TockOS capsules
  • config: TockOS configuration for Matcha
  • hal: TockOS hal crates
  • platform: TockOS Matcha platform support
  • utils: utility code for apps & capsules