Skip to content

Check account boundaries on overlapping memmove syscall#4563

Merged
seanyoung merged 3 commits intoanza-xyz:masterfrom
seanyoung:reverse-limits
Jan 23, 2025
Merged

Check account boundaries on overlapping memmove syscall#4563
seanyoung merged 3 commits intoanza-xyz:masterfrom
seanyoung:reverse-limits

Conversation

@seanyoung
Copy link
Copy Markdown

@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
@mergify
Copy link
Copy Markdown

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.

Comment thread programs/bpf_loader/src/syscalls/mem_ops.rs Outdated
@seanyoung seanyoung merged commit 4b89b0f into anza-xyz:master Jan 23, 2025
@seanyoung seanyoung deleted the reverse-limits branch January 23, 2025 15:19
@seanyoung seanyoung added the v2.1 label Jan 23, 2025
@mergify
Copy link
Copy Markdown

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 <sean@mess.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants