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

Memory write xor execute #617

Merged
merged 9 commits into from
Oct 27, 2023
Merged

Memory write xor execute #617

merged 9 commits into from
Oct 27, 2023

Conversation

Dentosal
Copy link
Member

@Dentosal Dentosal commented Oct 27, 2023

Closes #616. Closes #564.

This PR makes attempting to execute opcodes outside $is..$ssp range panic with MemoryNotExecutable error. It also separates ErrorFlag into InvalidFlags and InvalidInstruction, which make more sense. Then finally it fixes some tests that incorrectly assumed that any of these were equivalent, and some that had even weirder misconceptions.

@Dentosal Dentosal added breaking A breaking api change fuel-vm Related to the `fuel-vm` crate. fuel-asm Related to the `fuel-asm` crate. audit-report Issue from the audit report labels Oct 27, 2023
@Dentosal Dentosal self-assigned this Oct 27, 2023
@Dentosal Dentosal marked this pull request as ready for review October 27, 2023 21:43
@Dentosal Dentosal requested a review from a team October 27, 2023 22:07
xgreenx
xgreenx previously approved these changes Oct 27, 2023
0, // The value is meaningless since fetch was out-of-bounds
)),
)?;
if pc < self.registers[RegId::IS] || pc >= self.registers[RegId::SSP] {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about the solution to update all places where we modify $pc. But it also works=)

I don't know how it affects the performance, but we can try to optimize it later=)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all jmp opcodes use the same inner fn, so it would be an easy place to centralize that logic.

@xgreenx
Copy link
Collaborator

xgreenx commented Oct 27, 2023

Hmm, it is a huge breaking change for any bytecode that doesn't return from the execution=)

@Dentosal Dentosal added this pull request to the merge queue Oct 27, 2023
Merged via the queue into master with commit 5015d7d Oct 27, 2023
37 checks passed
@Dentosal Dentosal deleted the dento/write-xor-exec branch October 27, 2023 22:40
@xgreenx xgreenx mentioned this pull request Oct 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
audit-report Issue from the audit report breaking A breaking api change fuel-asm Related to the `fuel-asm` crate. fuel-vm Related to the `fuel-vm` crate.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Limit $pc to always stay within $is..$ssp TOB-FUEL-26: Memory is executable
3 participants