generated from riscv/docs-spec-template
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #65 from riscv-non-isa/dev/beeman/v051-recommendat…
…ions Recommended text improvements
- Loading branch information
Showing
7 changed files
with
71 additions
and
187 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,9 @@ | ||
[[threatmodel]] | ||
== External Debug Security Threat model | ||
|
||
Modern SoC development consists of several different actors who may not trust each other, resulting in the need to isolate actors’ assets during the development and debugging phases. The current RISC-V Debug specification cite:[dbgspec] grants external debuggers the highest privilege in the system regardless of the privilege level at which the target system is running. This leads to privilege escalation issues when multiple actors are present. | ||
|
||
For example, the owner of a SoC, who needs to debug their M-mode firmware, may be able to use the external debugger to bypass PMP lock (pmpcfg.L=1) and attack Boot ROM (the SoC creator’s asset). | ||
|
||
Additionally, RISC-V privilege architecture supports multiple software entities or "supervisor domains" that do not trust each other. The supervisor domains are managed by secure monitor running in M-mode, they are isolated from each other by PMP/IOPMP and they may need different debug policies. The entity that owns secure monitor wants to disable external debug when shipping the secure monitor, however, the entity that owns the supervisor domain needs to enable external debug to develop the supervisor domain. Since the external debugger will be the granted highest privilege in the system, a malicious supervisor domain will be able to compromise M-mode secure monitor with the external debugger. | ||
|
||
|
||
|
||
Modern SoC development consists of several different actors who may not trust each other, resulting in the need to isolate actors’ assets during the development and debugging phases. The current RISC-V Debug specification cite:[dbgspec] grants external debuggers the highest privilege in the system, regardless of the privilege level at which the target system is running. This leads to privilege escalation issues when multiple actors are present. | ||
|
||
For example, the owner of an SoC, who needs to debug their M-mode firmware, may be able to use the external debugger to bypass PMP lock (pmpcfg.L=1) and attack Boot ROM (the SoC creator’s asset). | ||
|
||
Additionally, RISC-V privilege architecture supports multiple software entities, or "supervisor domains," that do not trust each other. The supervisor domains are managed by a secure monitor running in M-mode, are isolated from each other by PMP/IOPMP, and may need different debug policies. The entity that owns the secure monitor wants to disable external debug when shipping the secure monitor; however, the entity that owns the supervisor domain needs to enable external debug to develop the supervisor domain. Since the external debugger will be the granted highest privilege in the system, a malicious supervisor domain will be able to compromise M-mode secure monitor with the external debugger. | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,34 @@ | ||
[[intro]] | ||
== Introduction | ||
Debugging and tracing are essential for developers to identify and rectify software and hardware issues, optimize performance, and ensure robust system functionality. The debugging and tracing extensions in RISC-V ecosystem play a pivotal role in enabling these capabilities, allowing developers to monitor and control the execution of programs during the development, testing and production phases. However, the current RISC-V Debug and trace specification grants the external debugger highest privilege in the system, regardless of the privilege level at which the target system is running. It leads to privilege escalation issues when multiple actors are present. | ||
Debugging and tracing are essential for developers to identify and rectify software and hardware issues, optimize performance, and ensure robust system functionality. The debugging and tracing extensions in the RISC-V ecosystem play a pivotal role in enabling these capabilities, allowing developers to monitor and control the execution of programs during the development, testing and production phases. However, the current RISC-V Debug specification grants the external debugger the highest privilege in the system, regardless of the privilege level at which the target system is running. It leads to privilege escalation issues when multiple actors are present. | ||
|
||
|
||
This specification defines non-ISA extension <<dmsext, Debug Module Security Extension (non-ISA extension)>> and ISA extension <<Sdsec, Sdsec (ISA extension)>> to address the above security issues in the current _The RISC-V Debug Specification_ cite:[dbgspec] and trace specifications cite:[etrace] cite:[ntrace]. | ||
This specification defines <<dmsext, Debug Module Security Extension (non-ISA extension)>> and <<Sdsec, Sdsec (ISA extension)>> to address the above security issues in the current _The RISC-V Debug Specification_ cite:[dbgspec] and trace specifications cite:[etrace] cite:[ntrace]. | ||
|
||
A summary of the changes introduced by _The RISC-V External Debug Security Specification_ follows.: | ||
A summary of the changes introduced by _The RISC-V External Debug Security Specification_ follows. | ||
|
||
- *Per-Hart Debug Control:* Introduce per-hart states to control whether external debug is allowed in M-mode and/or supervisor domains cite:[smmtt]. | ||
- *Per-Hart Trace Control:* Introduce per-hart states to control whether tracing is allowed in M-mode and/or supervisor domains. | ||
- *Non-secure debug:* Add a non-secure debug state to relax security constraints. | ||
- *Debug Mode entry:* External debugger can only halt the hart and enter debug mode when debug is allowed in current privilege mode; all operations are executed with <<dbgaccpriv, debug access privilege>> instead of M-mode privilege. | ||
- *Memory Access:* Memory access from a hart’s point of view using the Program Buffer or an Abstract Command must be checked by the hart's memory protection mechanisms as if the hart is running at <<dbgaccpriv, debug access privilege>>; memory access from the Debug Module using System Bus Access must be checked by a system memory protection mechanism, such as IOPMP or WorldGuard. | ||
- *Register Access:* Register access using the Program Buffer or an Abstract Command works as if the hart is running in <<dbgaccpriv, debug access privilege>> instead of M-mode privilege. The debug CSRs (`dcsr` and `dpc` ) are shadowed in supervisor domains while Smtdeleg/Sstcfg extensions expose the trigger CSRs to supervisor domains through indirect CSR access. | ||
- *Triggers:* Triggers (with action=1) can only fire or match when external debug is allowed in current privilege. | ||
- *Debug Mode entry:* An external debugger can only halt the hart and enter debug mode when debug is allowed in current privilege mode. | ||
- *Memory Access:* Memory access from a hart’s point of view, using the Program Buffer or an Abstract Command, must be checked by the hart's memory protection mechanisms as if the hart is running at <<dbgaccpriv, debug access privilege level>>; memory access from the Debug Module using System Bus Access must be checked by a system memory protection mechanism, such as IOPMP or WorldGuard. | ||
- *Register Access:* Register access using the Program Buffer or an Abstract Command works as if the hart is running at <<dbgaccpriv, debug access privilege level>> instead of M-mode privilege level. The debug CSRs (`dcsr` and `dpc` ) are shadowed in supervisor domains while Smtdeleg/Sstcfg extensions expose the trigger CSRs to supervisor domains. | ||
- *Triggers:* Triggers (with action=1) can only fire or match when external debug is allowed in the current privilege mode. | ||
|
||
=== Terminology | ||
|
||
[cols="2*"] | ||
[cols="20%,80%"] | ||
|===================================================================================================================================================== | ||
| Abstract command | A high-level command in Debug Module used to interact with and control harts | ||
| Abstract command | A high-level Debug Module operation used to interact with and control harts | ||
| Debug Access Privilege | The privilege with which an Abstract Command or instructions in the Program Buffer access hardware resources | ||
| Debug Mode | An additional privilege mode to support off-chip debugging | ||
| Hart | A RISC-V hardware thread | ||
| IOPMP | Input-Output Physical Memory Protection unit | ||
| M-mode | The highest privileged mode in the RISC-V privilege model | ||
| PMA | Physical Memory Attributes | ||
| PMP | Physical Memory Protection unit | ||
| Program buffer | A buffer in Debug Module to execute arbitrary instructions on a hart | ||
| Supervisor domain | A isolated supervisor execution context defined in RISC-V Supervisor Domains Access Protection cite:[smmtt] | ||
| Program buffer | A mechanism that allows the Debug Module to execute arbitrary instructions on a hart | ||
| Supervisor domain | An isolated supervisor execution context defined in RISC-V Supervisor Domains Access Protection cite:[smmtt] | ||
| Trace encoder | A piece of hardware that takes in instruction execution information from a RISC-V hart and transforms it into trace packets | ||
|===================================================================================================================================================== |
Oops, something went wrong.