lowRISC / opentitan

OpenTitan: Open source silicon root of trust
https://www.opentitan.org
Apache License 2.0
2.55k stars 759 forks source link

[rv_dm] D2S Signoff #22356

Closed andreaskurth closed 5 months ago

andreaskurth commented 6 months ago

As part of Earlgrey-PROD.M2, we signed rv_dm off at D2 but not yet at D2S. We have to go through the D2S checklist focusing on the changes since Earlgrey-ES TO. In particular, https://github.com/lowRISC/opentitan/commit/94612fe0957eb151866d32dc99eeab6ffb4e6e6e needs to be reviewed for security impact.

andreaskurth commented 5 months ago

@vogelpi to review RTL code and hand over to @rswarbrick; expected early next week

vogelpi commented 5 months ago

I've finally managed to do the security review of 94612fe (late debug enable), a49f888 (update pulp_riscv_dbg) and b3c7206 (implement NDM reset tracking). These are the main changes since ES as outlined in https://github.com/lowRISC/opentitan/issues/20972#issuecomment-2000634000 .

In my view, these commits don't contain anything unexpected and don't add risk. 94612fe (late debug enable) has been very carefully implemented given the relevance/impact of the feature. All relevant checks have been implemented using hardening comparators and prim_bufs in between to avoid aggressive synthesis optimizations defeating the hardening.

In short, I am happy to sign RV_DM off at D2S. @rswarbrick , would you mind moving this forward and taking care of the remaining steps for the sign-off please?

rswarbrick commented 5 months ago

Here are some notes that I have made following the light-weight signoff process (applying it to D2S for rv_dm). The structure starts with the flow described in the light-weight signoff, but then works through the standard D2S signoff procedure, focused on changes since ES.

To avoid duplicating the work that has already been done for D2 (see issue notes for #20972), I'm pointing there for the full list of commits, issues closed etc. This was made using version b3c7206.

Of course, there might be a further delta since then. The current head of master is 6e8108c51.

Light-weight signoff flow

Commits since ES that are relevant to D2S signoff

The D2 signoff review listed commits since ES. Filtering this, I find the following commits that I believe might affect D2S status for rv_dm:

A list of all further changes can be found with git log b3c7206..6e8108c51 --oneline hw/ip/rv_dm:

None of these changes touch the RTL, so these do not need further discussion for D2S.

Issues closed since the Earlgrey-ES tapeout

Most of the closed issues listed in the D2 signoff are unrelated to D2S. Only the following issue seems worth tracking for D2S signoff:

A list of issues closed in the intervening time can be found with the filter is:issue is:closed closed:>2024-03-14 rv_dm:

The two issues relevant to D2S are fixed by code that will be discussed properly below.

Currently open issues

There is a list of open issues in the D2 signoff (for "then-open issues"). Looking through the list, none of them seem relevant for D2S signoff. Running the search again and discarding "signoff" items gives the following list of new issues:

Summary

Following the light-weight signoff flow, the only two items that are worth investigating in detail are the NDM reset tracking and late debug enablement mechanism changes. The text below goes through the standard D2S signoff items, but focusing on those changes.

"Less light-weight" signoff (focusing on the changes found above)

SEC_CM_ASSETS_LISTED

Looking through the two changes found above results in some countermeasure work that has been described (and implemented):

I'm convinced that any new assets are indeed listed. The new items in the list are:

SEC_CM_IMPLEMENTED

This analysis matches the results of the review that @vogelpi has done (described here).

SEC_CM_RND_CNST

The changes since ES have not added any compile-time random netlist constants, so this item does not apply to the changes.

SEC_CM_NON_RESET_FLOPS

No change since ES: there is no new security-critical information being stored.

SEC_CM_SHADOW_REGS

The only state that was added that is security-critical has been added with multi-bit encodings and replicated. There are no registers storing this state, so no shadow registers needed.

SEC_CM_RTL_REVIEWED

This has been performed by @vogelpi.

SEC_CM_COUNCIL_REVIEWED

This task was performed for ES and I don't believe there have been any substantive changes since which would need a follow-up review from the security council.

Summary

I am now convinced that rv_dm is at the D2S lifecycle stage again and will file a PR bumping the hjson stage accordingly.

vogelpi commented 5 months ago

Thanks @rswarbrick for putting this together. I agree with your assessment. Regarding the SEC_CM_COUNCIL_REVIEWED item it's worth noting that the relevant changes have been implemented in accordance with the RFC reviewed by security folks (in particular @moidx @johannheyszl and myself), the Security WG and TC. Thus, I believe these changes had sufficient visibility.