зеркало из https://github.com/mozilla/pjs.git
Bug 595033 - nanojit: harden via random function alignment (wmaddox,nnethercote,edwsmith)
Introduce a random number of 'int3' instructions inbetween JIT'd methods. NOTE: this feature is currently disabled --HG-- extra : convert_revision : d75d0a918f8e048b92127188f47f4e1efcee9004
This commit is contained in:
Родитель
c362275ffa
Коммит
f269219ada
|
@ -2815,6 +2815,16 @@ namespace nanojit
|
|||
NanoAssert(!_inExit);
|
||||
if (!_nIns)
|
||||
codeAlloc(codeStart, codeEnd, _nIns verbose_only(, codeBytes));
|
||||
|
||||
// add some random padding, so functions aren't predictably placed.
|
||||
if (_config.harden_function_alignment)
|
||||
{
|
||||
int32_t pad = _noise->getValue(LARGEST_UNDERRUN_PROT);
|
||||
underrunProtect(pad);
|
||||
_nIns -= pad;
|
||||
VMPI_memset(_nIns, INT3_OP, pad);
|
||||
PERFM_NVPROF("hardening:func-align", pad);
|
||||
}
|
||||
}
|
||||
|
||||
// enough room for n bytes
|
||||
|
|
|
@ -92,6 +92,7 @@ namespace nanojit
|
|||
i386_use_cmov = (features & (1<<15)) != 0;
|
||||
i386_fixed_esp = false;
|
||||
#endif
|
||||
harden_function_alignment = false;
|
||||
|
||||
#if defined(NANOJIT_ARM)
|
||||
|
||||
|
|
|
@ -94,6 +94,9 @@ namespace nanojit
|
|||
// If true, use softfloat for all floating point operations,
|
||||
// whether or not an FPU is present. (ARM only for now, but might also includes MIPS in the future)
|
||||
uint32_t soft_float:1;
|
||||
|
||||
// If true, compiler will insert a random amount of space in between functions (x86-32 only)
|
||||
uint32_t harden_function_alignment:1;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче