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

Check account boundaries on overlapping memmove syscall #4563

Merged
merged 3 commits into from
Jan 23, 2025

Conversation

seanyoung
Copy link

@seanyoung seanyoung commented Jan 21, 2025

Problem

Since SIMD-0219, any memmove cannot cross account data and non-account data boundaries. This was implemented in PR 3744.

However there was a check missing: memmove may do an overlapping copy which requires reverse iteration, and this code path did not have the check in place.

Summary of Changes

  • Add missing check and add tests
  • Since v2.1 is already on testnet, this needs a new feature
  • Feature can be folded into direct mapping feature in the future
  • Rekey direct mapping

Found by @yufeng-jump and @mjain-jump

@seanyoung seanyoung requested a review from Lichtso January 21, 2025 15:25
@seanyoung seanyoung requested a review from a team as a code owner January 21, 2025 15:25
Copy link

mergify bot commented Jan 21, 2025

The Firedancer team maintains a line-for-line reimplementation of the
native programs, and until native programs are moved to BPF, those
implementations must exactly match their Agave counterparts.
If this PR represents a change to a native program implementation (not
tests), please include a reviewer from the Firedancer team. And please
keep refactors to a minimum.

@seanyoung seanyoung merged commit 4b89b0f into anza-xyz:master Jan 23, 2025
57 checks passed
@seanyoung seanyoung deleted the reverse-limits branch January 23, 2025 15:19
@seanyoung seanyoung added the v2.1 Backport to v2.1 branch label Jan 23, 2025
Copy link

mergify bot commented Jan 23, 2025

Backports to the beta branch are to be avoided unless absolutely necessary for fixing bugs, security issues, and perf regressions. Changes intended for backport should be structured such that a minimum effective diff can be committed separately from any refactoring, plumbing, cleanup, etc that are not strictly necessary to achieve the goal. Any of the latter should go only into master and ride the normal stabilization schedule. Exceptions include CI/metrics changes, CLI improvements and documentation updates on a case by case basis.

mergify bot pushed a commit that referenced this pull request Jan 23, 2025
* fix reverse memmove

(cherry picked from commit 4b89b0f)
seanyoung added a commit that referenced this pull request Jan 26, 2025
…rt of #4563) (#4598)

Check account boundaries on overlapping memmove syscall (#4563)

* fix reverse memmove

(cherry picked from commit 4b89b0f)

Co-authored-by: Sean Young <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v2.1 Backport to v2.1 branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants