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

v2.1: Memory syscalls cannot start in an account and end outside of it (backport of #3744) #3885

Merged
merged 2 commits into from
Dec 6, 2024

Conversation

mergify[bot]
Copy link

@mergify mergify bot commented Dec 3, 2024

The input area of the address space contains things like the instruction data and the accounts passed into the program, including the account data itself. From the perspective of the SBF program, all these are stored back-to-back in memory, but with direct mapping, the account data is actually stored in a separate memory region.

Previously, memcpy, memmove, memcmp, and memset can start and stop anywhere in memory; it is possible to start in account data, and give a length beyond the end of the account data; it would cross into a new region. Conversely, it possible to start before account data and up within the account data.

This change restricts these four syscalls so that memory regions are entirely inside account data or outside of it.

There is no reason why you require this and no mainnet program does this. This change was requested by Firedancer for direct mapping.

This is part of the stricter VM verfication SIMD which is required for direct mapping.


This is an automatic backport of pull request #3744 done by [Mergify](https://mergify.com).

* Memory syscalls cannot start in an account and end outside of it

In the same way, a memory syscall cannot start outside of an account and
up within one.

(cherry picked from commit 36d1017)
@mergify mergify bot requested a review from a team as a code owner December 3, 2024 12:56
Copy link
Author

mergify bot commented Dec 3, 2024

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 e44d872 into v2.1 Dec 6, 2024
29 checks passed
@seanyoung seanyoung deleted the mergify/bp/v2.1/pr-3744 branch December 6, 2024 19:15
KirillLykov pushed a commit that referenced this pull request Dec 9, 2024
…t (backport of #3744) (#3885)

* Memory syscalls cannot start in an account and end outside of it (#3744)

* Memory syscalls cannot start in an account and end outside of it

In the same way, a memory syscall cannot start outside of an account and
up within one.

(cherry picked from commit 36d1017)

* Update Cargo.lock

---------

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
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants