Skip to content

Commit

Permalink
src: fix largepages regression
Browse files Browse the repository at this point in the history
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
Gabriel Schulhof authored and targos committed Nov 10, 2019
1 parent 2695f82 commit f3115c4
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/large_pages/node_large_page.cc
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

0 comments on commit f3115c4

Please sign in to comment.