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 JAL/JALR instructions #97

Merged
merged 3 commits into from
Jan 8, 2025

Conversation

mininny
Copy link
Collaborator

@mininny mininny commented Dec 10, 2024

Description

The RISC-V specifications indicate the following in section "2.5.1. Unconditional Jumps".

The JAL and JALR instructions will generate an instruction-address-misaligned exception if the target
address is not aligned to a four-byte boundary
.

However, the three implementations (fast, slow, solidity) succeed when a unconditional jump instruction (JAL or JALR) sets a program counter pc not aligned on 4 bytes.

The jump opcodes (0x67 and 0x6F) 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 50.00000% with 12 lines in your changes missing coverage. Please review.

Project coverage is 61.78%. Comparing base (8ff9318) to head (83efd3a).

Files with missing lines Patch % Lines
rvgo/fast/vm.go 50.00% 4 Missing and 2 partials ⚠️
rvgo/slow/vm.go 50.00% 4 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #97      +/-   ##
==========================================
- Coverage   61.89%   61.78%   -0.11%     
==========================================
  Files          27       27              
  Lines        4091     4111      +20     
==========================================
+ Hits         2532     2540       +8     
- Misses       1427     1435       +8     
- Partials      132      136       +4     

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

@mininny mininny requested a review from ImTei December 13, 2024 06:52
@BlocksOnAChain BlocksOnAChain added the Audit finding grouping for our audit findings label Dec 16, 2024
@mininny mininny added this pull request to the merge queue Jan 8, 2025
Merged via the queue into master with commit 5b45a35 Jan 8, 2025
8 checks passed
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
Development

Successfully merging this pull request may close these issues.

4 participants