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 <[email protected]>!

PR-URL: #29914
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: David Carlier <[email protected]>
  • Loading branch information
Gabriel Schulhof committed Oct 12, 2019
1 parent 1447a79 commit 075c7eb
Showing 1 changed file with 1 addition and 2 deletions.
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

0 comments on commit 075c7eb

Please sign in to comment.