Skip to content

Update adapter with the memory shift fix#538

Merged
chenyan2002 merged 2 commits intomainfrom
yan/shift-mm-2
Oct 6, 2025
Merged

Update adapter with the memory shift fix#538
chenyan2002 merged 2 commits intomainfrom
yan/shift-mm-2

Conversation

@chenyan2002
Copy link
Contributor

Propagating changes from https://github.com/fastly/ExecuteD/pull/5528.

The adapter module takes a fixed two pages of memory. It gets this memory either via cabi_realloc exported from the main module or memory.grow at the beginning of the component instantiation. The is not a safe assumption for managed languages like Go or Python.

This PR avoids this problem by rewriting the main module to always access the memory with a 2 page offset. In this way, the first two pages of the memory is never touched by the main module. Then the adapter can safely write its state and stack to the first two pages without corrupting user memory.

Copy link
Contributor

@dgohman-fastly dgohman-fastly left a comment

Choose a reason for hiding this comment

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

Thanks!

@chenyan2002 chenyan2002 merged commit 92a76f4 into main Oct 6, 2025
13 checks passed
@chenyan2002 chenyan2002 deleted the yan/shift-mm-2 branch October 6, 2025 22:11
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