diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/lib_jit.c | 7 | ||||
-rw-r--r-- | src/lj_arch.h | 10 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/lib_jit.c b/src/lib_jit.c index 7348ef21..21e01d3e 100644 --- a/src/lib_jit.c +++ b/src/lib_jit.c | |||
@@ -113,6 +113,13 @@ LJLIB_CF(jit_status) | |||
113 | #endif | 113 | #endif |
114 | } | 114 | } |
115 | 115 | ||
116 | LJLIB_CF(jit_security) | ||
117 | { | ||
118 | int idx = lj_lib_checkopt(L, 1, -1, LJ_SECURITY_MODESTRING); | ||
119 | setintV(L->top++, ((LJ_SECURITY_MODE >> (2*idx)) & 3)); | ||
120 | return 1; | ||
121 | } | ||
122 | |||
116 | LJLIB_CF(jit_attach) | 123 | LJLIB_CF(jit_attach) |
117 | { | 124 | { |
118 | #ifdef LUAJIT_DISABLE_VMEVENT | 125 | #ifdef LUAJIT_DISABLE_VMEVENT |
diff --git a/src/lj_arch.h b/src/lj_arch.h index f148b3f7..240d0d16 100644 --- a/src/lj_arch.h +++ b/src/lj_arch.h | |||
@@ -665,4 +665,14 @@ extern void *LJ_WIN_LOADLIBA(const char *path); | |||
665 | #define LUAJIT_SECURITY_MCODE 1 | 665 | #define LUAJIT_SECURITY_MCODE 1 |
666 | #endif | 666 | #endif |
667 | 667 | ||
668 | #define LJ_SECURITY_MODE \ | ||
669 | ( 0u \ | ||
670 | | ((LUAJIT_SECURITY_PRNG & 3) << 0) \ | ||
671 | | ((LUAJIT_SECURITY_STRHASH & 3) << 2) \ | ||
672 | | ((LUAJIT_SECURITY_STRID & 3) << 4) \ | ||
673 | | ((LUAJIT_SECURITY_MCODE & 3) << 6) \ | ||
674 | ) | ||
675 | #define LJ_SECURITY_MODESTRING \ | ||
676 | "\004prng\007strhash\005strid\005mcode" | ||
677 | |||
668 | #endif | 678 | #endif |