File tree Expand file tree Collapse file tree 2 files changed +16
-10
lines changed Expand file tree Collapse file tree 2 files changed +16
-10
lines changed Original file line number Diff line number Diff line change 409
409
}],
410
410
['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" \
411
411
or OS=="android"' , {
412
- 'cflags!' : [
413
- '-O2' ,
414
- '-Os' ,
415
- ],
416
- 'cflags' : [
417
- '-fdata-sections' ,
418
- '-ffunction-sections' ,
419
- '-O3' ,
420
- ],
421
412
'conditions' : [
422
413
[ 'gcc_version==44 and clang==0' , {
423
414
'cflags' : [
Original file line number Diff line number Diff line change @@ -109,11 +109,26 @@ void* OS::GetRandomMmapAddr() {
109
109
raw_addr &= V8_UINT64_C (0x3ffffffff000 );
110
110
#else
111
111
uint32_t raw_addr = V8::RandomPrivate (isolate);
112
+
113
+ raw_addr &= 0x3ffff000 ;
114
+
115
+ # ifdef __sun
116
+ // For our Solaris/illumos mmap hint, we pick a random address in the bottom
117
+ // half of the top half of the address space (that is, the third quarter).
118
+ // Because we do not MAP_FIXED, this will be treated only as a hint -- the
119
+ // system will not fail to mmap() because something else happens to already
120
+ // be mapped at our random address. We deliberately set the hint high enough
121
+ // to get well above the system's break (that is, the heap); Solaris and
122
+ // illumos will try the hint and if that fails allocate as if there were
123
+ // no hint at all. The high hint prevents the break from getting hemmed in
124
+ // at low values, ceding half of the address space to the system heap.
125
+ raw_addr += 0x80000000 ;
126
+ # else
112
127
// The range 0x20000000 - 0x60000000 is relatively unpopulated across a
113
128
// variety of ASLR modes (PAE kernel, NX compat mode, etc) and on macos
114
129
// 10.6 and 10.7.
115
- raw_addr &= 0x3ffff000 ;
116
130
raw_addr += 0x20000000 ;
131
+ # endif
117
132
#endif
118
133
return reinterpret_cast <void *>(raw_addr);
119
134
}
You can’t perform that action at this time.
0 commit comments