2aba169072
mprotect it RX to support x-only idea from deraadt@, diff from kettenis@
48 lines
1.6 KiB
Plaintext
48 lines
1.6 KiB
Plaintext
Index: deps/v8/src/snapshot/embedded/platform-embedded-file-writer-generic.cc
|
|
--- deps/v8/src/snapshot/embedded/platform-embedded-file-writer-generic.cc.orig
|
|
+++ deps/v8/src/snapshot/embedded/platform-embedded-file-writer-generic.cc
|
|
@@ -10,6 +10,10 @@
|
|
#include "src/common/globals.h"
|
|
#include "src/objects/code.h"
|
|
|
|
+#if V8_OS_OPENBSD
|
|
+#include <sys/param.h>
|
|
+#endif
|
|
+
|
|
namespace v8 {
|
|
namespace internal {
|
|
|
|
@@ -36,6 +40,8 @@ const char* DirectiveAsString(DataDirective directive)
|
|
void PlatformEmbeddedFileWriterGeneric::SectionText() {
|
|
if (target_os_ == EmbeddedTargetOs::kChromeOS) {
|
|
fprintf(fp_, ".section .text.hot.embedded\n");
|
|
+ } else if (target_os_ == EmbeddedTargetOs::kOpenBSD) {
|
|
+ fprintf(fp_, ".section .openbsd.mutable,\"a\"\n");
|
|
} else {
|
|
fprintf(fp_, ".section .text\n");
|
|
}
|
|
@@ -74,7 +80,9 @@ void PlatformEmbeddedFileWriterGeneric::DeclareSymbolG
|
|
}
|
|
|
|
void PlatformEmbeddedFileWriterGeneric::AlignToCodeAlignment() {
|
|
-#if V8_TARGET_ARCH_X64
|
|
+#if V8_OS_OPENBSD
|
|
+ fprintf(fp_, ".balign %d\n", PAGE_SIZE);
|
|
+#elif V8_TARGET_ARCH_X64
|
|
// On x64 use 64-bytes code alignment to allow 64-bytes loop header alignment.
|
|
STATIC_ASSERT(64 >= kCodeAlignment);
|
|
fprintf(fp_, ".balign 64\n");
|
|
@@ -96,6 +104,12 @@ void PlatformEmbeddedFileWriterGeneric::AlignToDataAli
|
|
// load target to be aligned at 8 bytes (2^3).
|
|
STATIC_ASSERT(8 >= Code::kMetadataAlignment);
|
|
fprintf(fp_, ".balign 8\n");
|
|
+}
|
|
+
|
|
+void PlatformEmbeddedFileWriterGeneric::PaddingAfterCode() {
|
|
+#if V8_OS_OPENBSD
|
|
+ fprintf(fp_, ".balign %d\n", PAGE_SIZE);
|
|
+#endif
|
|
}
|
|
|
|
void PlatformEmbeddedFileWriterGeneric::Comment(const char* string) {
|