-
Notifications
You must be signed in to change notification settings - Fork 31
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
Implement Zicfiss
and Zicfilp
extensions for Control-Flow Integrity
#47
base: astral
Are you sure you want to change the base?
Conversation
core/cfi_landingpad_port.sv
Outdated
always_comb begin : landingpad_port | ||
elp_o = elp_i; | ||
lpl_o = lpl_i; | ||
commit_ack_o = commit_ack_i; | ||
we_gpr_o = we_gpr_i; | ||
lp_fault_o = 'b0; | ||
end |
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.
[verible-verilog-format] reported by reviewdog 🐶
always_comb begin : landingpad_port | |
elp_o = elp_i; | |
lpl_o = lpl_i; | |
commit_ack_o = commit_ack_i; | |
we_gpr_o = we_gpr_i; | |
lp_fault_o = 'b0; | |
end | |
always_comb begin : landingpad_port | |
elp_o = elp_i; | |
lpl_o = lpl_i; | |
commit_ack_o = commit_ack_i; | |
we_gpr_o = we_gpr_i; | |
lp_fault_o = 'b0; | |
end |
eda1b97
to
d74f5af
Compare
d74f5af
to
43ed429
Compare
menvcfg_q <= menvcfg_d; | ||
henvcfg_q <= henvcfg_d; | ||
senvcfg_q <= senvcfg_d; |
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.
[verible-verilog-format] reported by reviewdog 🐶
menvcfg_q <= menvcfg_d; | |
henvcfg_q <= henvcfg_d; | |
senvcfg_q <= senvcfg_d; | |
menvcfg_q <= menvcfg_d; | |
henvcfg_q <= henvcfg_d; | |
senvcfg_q <= senvcfg_d; |
localparam logic [63:0] ENVCFG_FIOM = 64'h0000000000000001; | ||
localparam logic [63:0] ENVCFG_LPE = 64'h0000000000000004; | ||
localparam logic [63:0] ENVCFG_SSE = 64'h0000000000000008; | ||
localparam logic [63:0] ENVCFG_CBIE = 64'h0000000000000030; | ||
localparam logic [63:0] ENVCFG_CBFE = 64'h0000000000000040; | ||
localparam logic [63:0] ENVCFG_CBZE = 64'h0000000000000080; |
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.
[verible-verilog-format] reported by reviewdog 🐶
localparam logic [63:0] ENVCFG_FIOM = 64'h0000000000000001; | |
localparam logic [63:0] ENVCFG_LPE = 64'h0000000000000004; | |
localparam logic [63:0] ENVCFG_SSE = 64'h0000000000000008; | |
localparam logic [63:0] ENVCFG_CBIE = 64'h0000000000000030; | |
localparam logic [63:0] ENVCFG_CBFE = 64'h0000000000000040; | |
localparam logic [63:0] ENVCFG_CBZE = 64'h0000000000000080; | |
localparam logic [63:0] ENVCFG_FIOM = 64'h0000000000000001; | |
localparam logic [63:0] ENVCFG_LPE = 64'h0000000000000004; | |
localparam logic [63:0] ENVCFG_SSE = 64'h0000000000000008; | |
localparam logic [63:0] ENVCFG_CBIE = 64'h0000000000000030; | |
localparam logic [63:0] ENVCFG_CBFE = 64'h0000000000000040; | |
localparam logic [63:0] ENVCFG_CBZE = 64'h0000000000000080; |
localparam logic [63:0] ENVCFG_CBFE = 64'h0000000000000040; | ||
localparam logic [63:0] ENVCFG_CBZE = 64'h0000000000000080; | ||
localparam logic [63:0] ENVCFG_PBMTE = 64'h4000000000000000; | ||
localparam logic [63:0] ENVCFG_STCE = 64'h8000000000000000; |
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.
[verible-verilog-format] reported by reviewdog 🐶
localparam logic [63:0] ENVCFG_STCE = 64'h8000000000000000; | |
localparam logic [63:0] ENVCFG_STCE = 64'h8000000000000000; |
localparam logic [63:0] SECCFG_MML = 64'h0000000000000001; | ||
localparam logic [63:0] SECCFG_MMWP = 64'h0000000000000002; | ||
localparam logic [63:0] SECCFG_RLP = 64'h0000000000000004; |
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.
[verible-verilog-format] reported by reviewdog 🐶
localparam logic [63:0] SECCFG_MML = 64'h0000000000000001; | |
localparam logic [63:0] SECCFG_MMWP = 64'h0000000000000002; | |
localparam logic [63:0] SECCFG_RLP = 64'h0000000000000004; | |
localparam logic [63:0] SECCFG_MML = 64'h0000000000000001; | |
localparam logic [63:0] SECCFG_MMWP = 64'h0000000000000002; | |
localparam logic [63:0] SECCFG_RLP = 64'h0000000000000004; |
localparam logic [63:0] SECCFG_RLP = 64'h0000000000000004; | ||
localparam logic [63:0] SECCFG_USEED = 64'h0000000000000100; | ||
localparam logic [63:0] SECCFG_SSEED = 64'h0000000000000200; | ||
localparam logic [63:0] SECCFG_MLPE = 64'h0000000000000400; |
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.
[verible-verilog-format] reported by reviewdog 🐶
localparam logic [63:0] SECCFG_MLPE = 64'h0000000000000400; | |
localparam logic [63:0] SECCFG_MLPE = 64'h0000000000000400; |
Implement the
Zicfiss
andZicfilp
ISA extensions for Control-Flow Integrity.Zicfiss
The Zicfiss extension introduces a shadow stack to enforce backward-edge control-flow integrity. A shadow stack is a second stack used to store a shadow copy of the return address in the link register if it needs to be spilled. The shadow stack is designed to provide integrity to control transfers performed using a return, where the return may be from a procedure invoked using an indirect call or a direct call, and this is referred to as backward-edge protection. The extension adds the following instructions:
SSPUSH x1
,SSPUSH x5
C.SSPUSH x1
SSPOPCHK x1
,SSPOPCHK x5
C.SSPOPCHK x5
SSRDP
SSAMOSWAP.W
,SSAMOSWAP.D
Zicfilp
To enforce forward-edge control-flow integrity, the
Zicfilp
extension introduces a landing pad (LPAD
) instruction. TheLPAD
instruction must be placed at the program locations that are valid targets of indirect jumps or calls. TheLPAD
instruction is encoded using theAUIPC
major opcode withrd
=x0
.Relevant links: