lowRISC / lowRISC/opentitan

[rom_ext] switch on machine mode lockdown epmp mode (mseccfg.MML)

Open
#5,653 5 comments 2 reactions 0 assignees View on GitHub
Component:Software SW:ROM_EXT
Dominant language
SystemVerilog
Stars
3.6k
Forks
1.1k
Avg merge
2d 22h
Merged PRs (30d)
141

Description

This a proposal to switch on machine mode lockdown (MML) during CRT in the mask ROM. Machine mode lockdown is described in more detail here: https://ibex-core.readthedocs.io/en/latest/_downloads/adbc55b5b9bad5f92968b58e7b12fc57/riscv-epmp.pdf. Enabling MML in the mask ROM would have two main advantages:

* Enabled but unlocked (i.e. `A != OFF` and `L = 0`) entries would no longer confer full read-write-execute access in machine mode. The ePMP library will already prevent this in software but having the hardware do it too seems beneficial, especially since some entries will be configured in assembly. MML makes it impossible to have regions that are both simultaneously writable and executable.
* Machine mode lockdown is sticky (once set cannot be unset) and so the whole system would only ever be using a single memory protection scheme. There would be no need to consider how a transition from 'classic' PMP mode into MML would affect existing entries.

There are however some disadvantages:

* If this proposal is accepted it will mean that the system cannot be booted into 'classic' PMP mode. This could have software compatibility implications. Although the proposed use of the machine mode whitelisting policy (MMWP) feature during boot would technically already break full compatibility anyway.
* The meaning of permissions is no longer quite as simple and may require looking up in a table. In practice all of the permissions combinations that are likely to be required during boot are still self explanatory though so I don't think this is a significant problem. The permissions exposed by the ePMP library will be almost the same, in fact the only change would be that the `Unlocked` value representing `L=0 R=0 W=0 X=0` would be replaced by a proper `UnlockedNoAccess` value representing the same permission bits.

Overall I think that we should enable MML in the mask ROM CRT code _unless_ we want to be able to boot into 'classic' PMP mode.

Contributor guide

Open the contributing guide

Research direction

Start by reading the mask ROM CRT code and the ePMP library, then review the linked ePMP documentation for the MML behavior described here. Determine whether booting only in MML mode is compatible with the intended classic PMP behavior and update the CRT configuration and related permission handling if the project accepts the proposal.

Written by the indexing model from the issue text.

Assessment

Domain
security
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.