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

fix leaky EOS VM OC executor code mapping #1499

Merged
merged 1 commit into from
Aug 16, 2023
Merged

Conversation

spoonincode
Copy link
Member

executor's ctor creates a shared mapping to the code cache file it is passed,

struct stat s;
FC_ASSERT(fstat(cc.fd(), &s) == 0, "executor failed to get code cache size");
code_mapping = (uint8_t*)mmap(nullptr, s.st_size, PROT_EXEC|PROT_READ, MAP_SHARED, cc.fd(), 0);
FC_ASSERT(code_mapping != MAP_FAILED, "failed to map code cache in to executor");
code_mapping_size = s.st_size;
mapping_is_executable = true;

but its dtor doesn't unmap that mapping. That's sloppy and leaky. Easy enough to fix.

I'm not considering this for stable since realistically nodeos only ever creates one of these per thread for the entire lifetime of the application anyways.

@spoonincode spoonincode merged commit 26542ab into main Aug 16, 2023
22 checks passed
@spoonincode spoonincode deleted the leaky_oc_exec_mapping branch August 16, 2023 14:52
@bhazzard bhazzard added this to the Leap v5.0.0-rc1 milestone Sep 28, 2023
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.

4 participants