Skip to content
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

Add 4-byte alignment check on pc in branching instructions #102

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mininny
Copy link
Collaborator

@mininny mininny commented Dec 10, 2024

Description

The RISC-V specifications indicate the following in section "2.5.2. Conditional Branches".

The conditional branch instructions will generate an instruction-address-misaligned exception if the
target address is not aligned to a four-byte boundary and the branch condition evaluates to true
. If the
branch condition evaluates to false, the instruction-address-misaligned exception will not be raised.

However, the three implementations (fast, slow, solidity) succeed when a conditional branch instruction sets a program counter pc not aligned on 4 bytes.

The branching opcode (0x63) implementation should raise an exception when the new program counter pc is not aligned on 4 bytes.

@codecov-commenter
Copy link

codecov-commenter commented Dec 10, 2024

Codecov Report

Attention: Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.

Project coverage is 61.80%. Comparing base (8ff9318) to head (ba4ab1a).

Files with missing lines Patch % Lines
rvgo/fast/vm.go 0.00% 2 Missing and 1 partial ⚠️
rvgo/slow/vm.go 0.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #102      +/-   ##
==========================================
- Coverage   61.89%   61.80%   -0.10%     
==========================================
  Files          27       27              
  Lines        4091     4097       +6     
==========================================
  Hits         2532     2532              
- Misses       1427     1431       +4     
- Partials      132      134       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mininny mininny requested review from clabby and ImTei December 13, 2024 06:52
@BlocksOnAChain BlocksOnAChain added the Audit finding grouping for our audit findings label Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Audit finding grouping for our audit findings
Projects
Development

Successfully merging this pull request may close these issues.

3 participants