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

src: fix largepages regression #29914

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
src: fix largepages regression
During the addition of macOS support for large pages, a `memcpy` ended
up under the wrong preprocessor directive. As a result, the newly
allocated large pages were not initialized with a copy of the text
section.

Thanks to Suresh Srinivas <[email protected]>!
  • Loading branch information
Gabriel Schulhof committed Oct 9, 2019
commit ee06064b9f3ccbd3303e2adb1d7d9750d436fb68
3 changes: 1 addition & 2 deletions src/large_pages/node_large_page.cc
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ MoveTextRegionToLargePages(const text_region& r) {
}
return -1;
}
memcpy(start, nmem, size);
#elif defined(__FreeBSD__)
tmem = mmap(start, size,
PROT_READ | PROT_WRITE | PROT_EXEC,
Expand Down Expand Up @@ -393,8 +394,6 @@ MoveTextRegionToLargePages(const text_region& r) {
return -1;
}
memcpy(start, tmem, size);
#else
memcpy(start, nmem, size);
#endif

ret = mprotect(start, size, PROT_READ | PROT_EXEC);
Expand Down