Use a securely seeded global PRNG for the VM.
It's not 2005 anymore.
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
#include "lj_vm.h"
|
||||
#include "lj_vmevent.h"
|
||||
#include "lj_target.h"
|
||||
#include "lj_prng.h"
|
||||
|
||||
/* -- Error handling ------------------------------------------------------ */
|
||||
|
||||
@@ -384,7 +385,7 @@ static void penalty_pc(jit_State *J, GCproto *pt, BCIns *pc, TraceError e)
|
||||
if (mref(J->penalty[i].pc, const BCIns) == pc) { /* Cache slot found? */
|
||||
/* First try to bump its hotcount several times. */
|
||||
val = ((uint32_t)J->penalty[i].val << 1) +
|
||||
LJ_PRNG_BITS(J, PENALTY_RNDBITS);
|
||||
(lj_prng_u64(&J2G(J)->prng) & ((1u<<PENALTY_RNDBITS)-1));
|
||||
if (val > PENALTY_MAX) {
|
||||
blacklist_pc(pt, pc); /* Blacklist it, if that didn't help. */
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user