From ee06064b9f3ccbd3303e2adb1d7d9750d436fb68 Mon Sep 17 00:00:00 2001 From: Gabriel Schulhof Date: Wed, 9 Oct 2019 15:50:21 -0700 Subject: [PATCH] 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 ! --- src/large_pages/node_large_page.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/large_pages/node_large_page.cc b/src/large_pages/node_large_page.cc index f6f5e72c283632..220f71fa105ff5 100644 --- a/src/large_pages/node_large_page.cc +++ b/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);