Skip to content

Commit f3115c4

Browse files
Gabriel Schulhoftargos
Gabriel Schulhof
authored andcommitted
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]>! 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]>
1 parent 2695f82 commit f3115c4

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/large_pages/node_large_page.cc

+1-2
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,7 @@ MoveTextRegionToLargePages(const text_region& r) {
359359
}
360360
return -1;
361361
}
362+
memcpy(start, nmem, size);
362363
#elif defined(__FreeBSD__)
363364
tmem = mmap(start, size,
364365
PROT_READ | PROT_WRITE | PROT_EXEC,
@@ -393,8 +394,6 @@ MoveTextRegionToLargePages(const text_region& r) {
393394
return -1;
394395
}
395396
memcpy(start, tmem, size);
396-
#else
397-
memcpy(start, nmem, size);
398397
#endif
399398

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

0 commit comments

Comments
 (0)