-
Notifications
You must be signed in to change notification settings - Fork 560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[rtl] Fix FI vulnerability in RF #2117
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright lowRISC contributors. | ||
// Licensed under the Apache License, Version 2.0, see LICENSE for details. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Abstract primitives wrapper. | ||
// | ||
// This file is a stop-gap until the DV file list is generated by FuseSoC. | ||
// Its contents are taken from the file which would be generated by FuseSoC. | ||
// https://github.com/lowRISC/ibex/issues/893 | ||
|
||
module prim_and2 #( | ||
parameter int Width = 1 | ||
) ( | ||
input [Width-1:0] in0_i, | ||
input [Width-1:0] in1_i, | ||
output logic [Width-1:0] out_o | ||
); | ||
|
||
if (1) begin : gen_generic | ||
prim_generic_and2 #( | ||
.Width(Width) | ||
) u_impl_generic ( | ||
.* | ||
); | ||
end | ||
|
||
endmodule |
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
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
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIUC, it is sufficient to do the one-hot encoding in here (not covered by the lockstep) because the same gates driving the
raddr_a/b_i
signals used here also drive the wires ultimately going into the lockstep comparison. I.e., if someone managed to faultraddr_a_i
here, this would still be caught by the lockstep countermeasure, right?If yes, this would be perfect because it means we don't have to touch the lockstep interfacing and checking logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, exactly.
In
ibex_top.sv
therf_raddr_a/b
signals are generated by the Ibex core:ibex/rtl/ibex_top.sv
Lines 336 to 337 in 38da151
forwarded to the RF:
ibex/rtl/ibex_top.sv
Lines 433 to 435 in 38da151
and buffered for the lockstep:
ibex/rtl/ibex_top.sv
Lines 862 to 863 in 38da151
Inside the lockstep, again the
rf_raddr_a/b
signals are generated by the shadow Ibex core:ibex/rtl/ibex_lockstep.sv
Lines 374 to 375 in 38da151
And finally the comparison happens. Here, the buffered
rf_raddr_a/b
signals from the main core are then compared to the signals generated by the shadow core.If a bit-flip inside the RF manipulates the
rf_raddr_a/b
signals, these faulty signals will get buffered for the lockstep:ibex/rtl/ibex_top.sv
Lines 862 to 863 in 38da151
And the fault is detected when comparing the main vs shadow
rf_raddr_a/b
signals.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing the analysis and writing it up here. LGTM!