EDN/CSRNG/ES Error States
Once the Error state is entered for the main FSMs in these blocks, the only way to exit this state is to assert reset. I'm wondering if disabling/re-enabling the block should allow it to move to the Idle state, the enable would kind of act like a block reset without having to reset the whole chip/system.
could you clarify what are the errors that caused the entry? is it like sparse fsm decoding error?
I'm just trying to get fsm coverage up and trying to hit transitions from every state to the error state. I wanted to do this, then run a normal testcase but noticed I can't get back to idle from the error state without resetting the block. I'm forcing it to go into a random state, then asserting local_escalate_i to force it into the error state. I was thinking then I could just disable/enable it to get back to normal but this doesn't reset the block.
For all of the entropy blocks, a "local escalation" is done when some counter attach occurs and the two parts of the counter miscompare. This puts the FSM into the error state, and stays there until reset. We were thinking if we make the error state like all of the other states and exist upon module enable de-asserting, then the module would recover, and the FSM coverage would naturally improve. WDYT @tjaychen? Wanted to run this operational model by you since AES, for example, does not work this way.
@johannheyszl @moidx
ah okay. So the local escalation types (stuff like mismatched counters, the fsm being in an invalid state) are considered by us to be fatal attacks. So for those, when the alert gets sent out to the alert handler, it actually causes a full system shutdown and eventual reset. So from a security perspective, it's not really necessary to tie this into an enable/disable.
practically speaking however, a local escalation that is TOO strict has the potential of being a denial of service on ourselves in case we missed a case that could cause a local escalation (bugs or what not).
So I think it's better to have a look a bit first to the causes of your local escalation. If it is comprised entirely of things such as fsm encoding errors, counter mismatch errors or mubi errors, I think it's fine to leave things as is. If there are other less standard errors tied in, then we could either move those out of the local escalate category, or add the enable / disable escape hatch as you suggested.
Let me know if that makes sense.
Johann it would be especially good to get your opinion on this. The idea of local escalation started from here. While I think it is a good idea in general, it leaves the potential of shooting ourselves in the foot if we are not careful. I tend to fall on the more "software debug friendly" side, so let me know what you think.
@senelson7 I agree with @tjaychen that it would we interesting to understand the causes. Do you have more insight there? @moidx will put the issue on this week's agenda of the security WG so we can talk about it more there.
For the causes that relate to attack attempts (as @tjaychen listed), it makes sense to keep the local escalation IMO.
From the discussion in the security WG:
- situation like like mismatched counters, the fsm being in an invalid state etc (as @tjaychen mentioned) are unlikely/impossibly triggered through SW but are rather results from FI/badness. For those, it seems to make sense to keep the fatal alert local escalation.
- on the other side it makes sense to minimize cases where SW could trigger fatal alerts unwittingly to improve debug options.
- it would be interesting @senelson7 if the cases are SW triggered (not FSM invalid, cnter mismatch etc.) and indicate that some alerts need a downgrade (from fatal)
Side note: our current design guidance around recoverable and fatal alerts is captured here.
I'm just trying to get fsm coverage up and trying to hit transitions from every state to the error state. I wanted to do this, then run a normal testcase but noticed I can't get back to idle from the error state without resetting the block. I'm forcing it to go into a random state, then asserting local_escalate_i to force it into the error state. I was thinking then I could just disable/enable it to get back to normal but this doesn't reset the block.
Just to agree/confirm what the others have said - if the error state transitions are because of {invalid state encoding, invalid mubi value, redundant counter mismatch} then those should be fatal/not easily recovered, as they are indicating a potential glitch/fault attack. (In essence, all of these checks chip-wide are acting in concert to try to detect such an attack and prevent the adversary from making progress.) I don't think it would be a good idea to allow disable/enable to recover these. If there are other types of errors that don't fall into the distributed glitch detector paradigm (misconfiguration) then those could be recoverable and we would need a different non-terminal error state to allow them to be cleared.
Could we check with @rasmus-madsen to see how he handled the FSM transition coverage on AES, since there are similar issues with fatal alerts there? Maybe @cindychip has ideas too.
Besides the question whether we have SW triggered alerts that need to be downgraded to recoverable, it looks like this issue is mostly about improving FSM coverage as @cdgori pointed out above.
If we are mainly using standardized countermeasures like prim_count and sparse FSMs, this may actually be covered by the formal mechanisms that the DV team has put in place. @weicaiyang and @cindychip, what is our current approach to FSM coverage related to fatal alerts? do we try to cover all branches in simulation, or do we only exercise a few and rely on formal to cover the rest?
Thanks for tagging us! For DV fatal alert related FSM coverage, because the standard counter measures only cover idle -> FSMErrorSt, we usually waive the other transitions, because they are covered in FPV testbench. So if your issue is: 1). Idle -> FsmErrorSt: covered 2). St1 -> FsmErrorSt: not-covered 3). St2 -> FsmErrorSt: not-covered Then 2) and 3) could be waived so long as FPV covered it in assertions.
A little bit more about how FPV covers it: For example for this assertion: https://github.com/lowRISC/opentitan/blob/master/hw/ip/entropy_src/rtl/entropy_src.sv#L317 FPV will cut the counter logic state_d is randomly driven and does not equal to state_d, then FPV will prove that under any condition, this assertion should be satisfied. And this should cover any state transits to FSMErrorSt.
I just wanted some discussion/thought about allowing enable to get the fsm out of the Error state and the answer seems to be no so I'll close this issue unless anybody has more input.
Are there any fatal alert events in the design that can be triggered by SW? E.g. a SW error or a misconfigured threshold?
If yes, we may want to discuss to make them recoverable (and add a way to move the FSM back to an idle state at runtime, as you described).
If the sources are exclusively from sparse FSMs and redundant counters (meaning that in the absence of glitches in the design these will never trigger), then I think the suggestion is to follow @cindychip's guidance above.
WDYT @moidx @tjaychen @johannheyszl?
I believe the FSM transition coverage is well covered by the following and we can close this issue #14407 PR#14028
Discussed at 8/23 Silicon meeting and summarized in #14407