Skip to content
Permalink
Browse files

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 <suresh.srinivas@intel.com>!

PR-URL: #29914
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
  • Loading branch information
gabrielschulhof authored and targos committed Oct 9, 2019
1 parent 2695f82 commit f3115c4d62b58d166565a821eb60e328d9dd0a4d
Showing with 1 addition and 2 deletions.
  1. +1 −2 src/large_pages/node_large_page.cc
@@ -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,
@@ -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);

0 comments on commit f3115c4

Please sign in to comment.
You can’t perform that action at this time.