Skip to content

Commit 588040d

Browse files
committed
v8: reapply floating patches
1 parent 704fd8f commit 588040d

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

deps/v8/src/platform-posix.cc

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,26 @@ void* OS::GetRandomMmapAddr() {
115115
raw_addr &= V8_UINT64_C(0x3ffffffff000);
116116
#else
117117
uint32_t raw_addr = V8::RandomPrivate(isolate);
118+
119+
raw_addr &= 0x3ffff000;
120+
121+
# ifdef __sun
122+
// For our Solaris/illumos mmap hint, we pick a random address in the bottom
123+
// half of the top half of the address space (that is, the third quarter).
124+
// Because we do not MAP_FIXED, this will be treated only as a hint -- the
125+
// system will not fail to mmap() because something else happens to already
126+
// be mapped at our random address. We deliberately set the hint high enough
127+
// to get well above the system's break (that is, the heap); Solaris and
128+
// illumos will try the hint and if that fails allocate as if there were
129+
// no hint at all. The high hint prevents the break from getting hemmed in
130+
// at low values, ceding half of the address space to the system heap.
131+
raw_addr += 0x80000000;
132+
# else
118133
// The range 0x20000000 - 0x60000000 is relatively unpopulated across a
119134
// variety of ASLR modes (PAE kernel, NX compat mode, etc) and on macos
120135
// 10.6 and 10.7.
121-
raw_addr &= 0x3ffff000;
122136
raw_addr += 0x20000000;
137+
# endif
123138
#endif
124139
return reinterpret_cast<void*>(raw_addr);
125140
}

0 commit comments

Comments
 (0)