Index: Makefile =================================================================== RCS file: /mnt/ext/cvs/ports/lang/node/Makefile,v diff -u -p -r1.169 Makefile --- Makefile 30 Jun 2026 18:46:22 -0000 1.169 +++ Makefile 5 Jul 2026 12:20:53 -0000 @@ -13,6 +13,7 @@ DIST_TUPLE = github qbit node-pledge 1. DISTNAME = node-${NODE_VERSION} PKGNAME = ${DISTNAME:S/v//g} EPOCH = 0 +REVISION = 0 CATEGORIES = lang devel Index: patches/patch-deps_v8_src_base_platform-posix_cc =================================================================== RCS file: /mnt/ext/cvs/ports/lang/node/patches/patch-deps_v8_src_base_platform-posix_cc,v diff -u -p -r1.8 patch-deps_v8_src_base_platform-posix_cc --- patches/patch-deps_v8_src_base_platform-posix_cc 9 May 2026 13:26:47 -0000 1.8 +++ patches/patch-deps_v8_src_base_platform-posix_cc 5 Jul 2026 13:24:14 -0000 @@ -43,6 +43,15 @@ Index: deps/v8/src/base/platform/platfor return true; #else // TODO(bbudge) Return true for all POSIX platforms. +@@ -1258,7 +1266,7 @@ bool Thread::Start() { + if (result != 0) return false; + size_t stack_size = stack_size_; + if (stack_size == 0) { +-#if V8_OS_DARWIN ++#if V8_OS_DARWIN || V8_OS_OPENBSD + // Default on Mac OS X is 512kB -- bump up to 1MB + stack_size = 1 * 1024 * 1024; + #elif V8_OS_AIX @@ -1358,7 +1366,7 @@ void Thread::SetThreadLocal(LocalStorageKey key, void* // keep this version in POSIX as most Linux-compatible derivatives will // support it. MacOS and FreeBSD are different here. Index: patches/patch-deps_v8_src_snapshot_embedded_platform-embedded-file-writer-generic_h =================================================================== RCS file: patches/patch-deps_v8_src_snapshot_embedded_platform-embedded-file-writer-generic_h diff -N patches/patch-deps_v8_src_snapshot_embedded_platform-embedded-file-writer-generic_h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-deps_v8_src_snapshot_embedded_platform-embedded-file-writer-generic_h 5 Jul 2026 09:33:14 -0000 @@ -0,0 +1,13 @@ +Index: deps/v8/src/snapshot/embedded/platform-embedded-file-writer-generic.h +--- deps/v8/src/snapshot/embedded/platform-embedded-file-writer-generic.h.orig ++++ deps/v8/src/snapshot/embedded/platform-embedded-file-writer-generic.h +@@ -19,7 +19,8 @@ class PlatformEmbeddedFileWriterGeneric + : target_arch_(target_arch), target_os_(target_os) { + DCHECK(target_os_ == EmbeddedTargetOs::kChromeOS || + target_os_ == EmbeddedTargetOs::kFuchsia || +- target_os_ == EmbeddedTargetOs::kGeneric); ++ target_os_ == EmbeddedTargetOs::kGeneric || ++ target_os_ == EmbeddedTargetOs::kOpenBSD); + } + + void SectionText() override; Index: patches/patch-deps_v8_src_wasm_jump-table-assembler_cc =================================================================== RCS file: patches/patch-deps_v8_src_wasm_jump-table-assembler_cc diff -N patches/patch-deps_v8_src_wasm_jump-table-assembler_cc --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-deps_v8_src_wasm_jump-table-assembler_cc 5 Jul 2026 16:35:06 -0000 @@ -0,0 +1,54 @@ +Fatal error in ../deps/v8/src/wasm/jump-table-assembler.h, line 163 +Debug check failed: kJumpTableSlotSize == jtasm.pc_offset() (16 vs. 24). +Trace/BPT trap (core dumped) + +This needs x64/amd64 with V8_ENABLE_CET_IBT and a code-space layout where the +compiled Wasm target is outside the rel32 range of its primary jump-table slot. +With CET, an x64 Wasm jump-table slot is 16 bytes: +endbr64; nop; jmp rel32; int3 padding. + +The buggy path tries a direct jump first. EmitJumpSlot() writes endbr64; nop +before checking rel32 reachability. If the target is too far, it returns false +after advancing pc_ by 8 bytes. The far-jump fallback then emits another +endbr64; nop and the final jmp starts at slot+16, overwriting the next slot. +Keep EmitJumpSlot() side-effect-free on failure and compute the rel32 +displacement from the real jmp location, i.e. after the CET marker. + +Index: deps/v8/src/wasm/jump-table-assembler.cc +--- deps/v8/src/wasm/jump-table-assembler.cc.orig ++++ deps/v8/src/wasm/jump-table-assembler.cc +@@ -115,15 +115,14 @@ void JumpTableAssembler::EmitLazyCompileJumpSlot(uint3 + + bool JumpTableAssembler::EmitJumpSlot(Address target) { + #ifdef V8_ENABLE_CET_IBT +- uint32_t endbr_insn = 0xfa1e0ff3; +- uint32_t nop = 0x00401f0f; +- emit(endbr_insn, kRelaxedStore); +- // Add a nop to ensure that the next block is 8 byte aligned. +- emit(nop, kRelaxedStore); ++ static constexpr int kCodeEntryMarkerSize = 2 * kInt32Size; ++#else ++ static constexpr int kCodeEntryMarkerSize = 0; + #endif + + intptr_t displacement = +- target - (pc_ + MacroAssembler::kIntraSegmentJmpInstrSize); ++ target - (pc_ + kCodeEntryMarkerSize + ++ MacroAssembler::kIntraSegmentJmpInstrSize); + if (!is_int32(displacement)) return false; + + uint8_t inst[kJumpTableSlotSize] = { +@@ -134,6 +133,13 @@ bool JumpTableAssembler::EmitJumpSlot(Address target) + memcpy(&inst[1], &displacement32, sizeof(int32_t)); + + // The jump table is updated live, so the write has to be atomic. ++#ifdef V8_ENABLE_CET_IBT ++ uint32_t endbr_insn = 0xfa1e0ff3; ++ uint32_t nop = 0x00401f0f; ++ emit(endbr_insn, kRelaxedStore); ++ // Add a nop to ensure that the next block is 8 byte aligned. ++ emit(nop, kRelaxedStore); ++#endif + emit(*reinterpret_cast(inst), kRelaxedStore); + + return true; Index: patches/patch-deps_v8_src_wasm_stacks_cc =================================================================== RCS file: patches/patch-deps_v8_src_wasm_stacks_cc diff -N patches/patch-deps_v8_src_wasm_stacks_cc --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-deps_v8_src_wasm_stacks_cc 5 Jul 2026 16:18:52 -0000 @@ -0,0 +1,50 @@ +Index: deps/v8/src/wasm/stacks.cc +--- deps/v8/src/wasm/stacks.cc.orig ++++ deps/v8/src/wasm/stacks.cc +@@ -4,6 +4,10 @@ + + #include "src/wasm/stacks.h" + ++#if V8_OS_OPENBSD ++#include ++#endif ++ + #include "src/base/platform/platform.h" + #include "src/execution/simulator.h" + #include "src/wasm/wasm-engine.h" +@@ -66,9 +70,18 @@ StackMemory::StackSegment::StackSegment(size_t pages) + DCHECK_GE(pages, 1); + PageAllocator* allocator = GetPlatformPageAllocator(); + size_ = pages * allocator->AllocatePageSize(); ++#if V8_OS_OPENBSD ++ limit_ = static_cast(mmap(nullptr, size_, PROT_READ | PROT_WRITE, ++ MAP_PRIVATE | MAP_ANON | MAP_STACK, -1, ++ 0)); ++ if (limit_ == MAP_FAILED) { ++ limit_ = nullptr; ++ } ++#else + limit_ = static_cast( + allocator->AllocatePages(nullptr, size_, allocator->AllocatePageSize(), + PageAllocator::kReadWrite)); ++#endif + if (limit_ == nullptr) { + V8::FatalProcessOutOfMemory(nullptr, + "StackMemory::StackSegment::StackSegment"); +@@ -76,10 +89,16 @@ StackMemory::StackSegment::StackSegment(size_t pages) + } + + StackMemory::StackSegment::~StackSegment() { ++#if V8_OS_OPENBSD ++ if (munmap(limit_, size_) != 0) { ++ V8::FatalProcessOutOfMemory(nullptr, "Release stack memory"); ++ } ++#else + PageAllocator* allocator = GetPlatformPageAllocator(); + if (!allocator->DecommitPages(limit_, size_)) { + V8::FatalProcessOutOfMemory(nullptr, "Decommit stack memory"); + } ++#endif + } + + bool StackMemory::Grow(Address current_fp) { Index: patches/patch-deps_v8_src_wasm_wasm-objects_cc =================================================================== RCS file: patches/patch-deps_v8_src_wasm_wasm-objects_cc diff -N patches/patch-deps_v8_src_wasm_wasm-objects_cc --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-deps_v8_src_wasm_wasm-objects_cc 5 Jul 2026 16:19:05 -0000 @@ -0,0 +1,19 @@ +Index: deps/v8/src/wasm/wasm-objects.cc +--- deps/v8/src/wasm/wasm-objects.cc.orig ++++ deps/v8/src/wasm/wasm-objects.cc +@@ -2855,7 +2855,15 @@ DirectHandle WasmContinuationO + wasm::JumpBuffer::StackState state, DirectHandle parent, + AllocationType allocation_type) { + stack->jmpbuf()->stack_limit = stack->jslimit(); ++#if V8_OS_OPENBSD ++ // OpenBSD MAP_STACK mappings cannot be entered with rsp exactly equal to the ++ // high end of the mapping. The first push from that value traps with ++ // SEGV_ACCERR, even though push would write below rsp. Keep the initial stack ++ // pointer strictly inside the mapped stack. ++ stack->jmpbuf()->sp = stack->base() - kSystemPointerSize; ++#else + stack->jmpbuf()->sp = stack->base(); ++#endif + stack->jmpbuf()->fp = kNullAddress; + stack->jmpbuf()->state = state; + DirectHandle result =