diff options
| author | Mike Pall <mike> | 2015-01-17 14:57:24 +0100 |
|---|---|---|
| committer | Mike Pall <mike> | 2015-01-17 14:57:24 +0100 |
| commit | 43cb818ba8166edf50d4432cff60b9f83f987d1e (patch) | |
| tree | 97532ad9ab8e48b492579ec97e2a457408489424 | |
| parent | 3e1703895aac84478631d7eba93f3ae4d182f18b (diff) | |
| parent | 7f013005f61b82300d4ec591fd4cec59a74d62ff (diff) | |
| download | luajit-43cb818ba8166edf50d4432cff60b9f83f987d1e.tar.gz luajit-43cb818ba8166edf50d4432cff60b9f83f987d1e.tar.bz2 luajit-43cb818ba8166edf50d4432cff60b9f83f987d1e.zip | |
Merge branch 'master' into v2.1
| -rw-r--r-- | src/lj_mcode.c | 17 | ||||
| -rw-r--r-- | src/lj_record.c | 2 |
2 files changed, 17 insertions, 2 deletions
diff --git a/src/lj_mcode.c b/src/lj_mcode.c index f8f8406a..d95ebeb1 100644 --- a/src/lj_mcode.c +++ b/src/lj_mcode.c | |||
| @@ -145,7 +145,7 @@ static void mcode_free(jit_State *J, void *p, size_t sz) | |||
| 145 | 145 | ||
| 146 | /* -- MCode area protection ----------------------------------------------- */ | 146 | /* -- MCode area protection ----------------------------------------------- */ |
| 147 | 147 | ||
| 148 | /* Define this ONLY if the page protection twiddling becomes a bottleneck. */ | 148 | /* Define this ONLY if page protection twiddling becomes a bottleneck. */ |
| 149 | #ifdef LUAJIT_UNPROTECT_MCODE | 149 | #ifdef LUAJIT_UNPROTECT_MCODE |
| 150 | 150 | ||
| 151 | /* It's generally considered to be a potential security risk to have | 151 | /* It's generally considered to be a potential security risk to have |
| @@ -252,7 +252,20 @@ static void *mcode_alloc(jit_State *J, size_t sz) | |||
| 252 | #else | 252 | #else |
| 253 | 253 | ||
| 254 | /* All memory addresses are reachable by relative jumps. */ | 254 | /* All memory addresses are reachable by relative jumps. */ |
| 255 | #define mcode_alloc(J, sz) mcode_alloc_at((J), 0, (sz), MCPROT_GEN) | 255 | static void *mcode_alloc(jit_State *J, size_t sz) |
| 256 | { | ||
| 257 | #ifdef __OpenBSD__ | ||
| 258 | /* Allow better executable memory allocation for OpenBSD W^X mode. */ | ||
| 259 | void *p = mcode_alloc_at(J, 0, sz, MCPROT_RUN); | ||
| 260 | if (p && mcode_setprot(p, sz, MCPROT_GEN)) { | ||
| 261 | mcode_free(J, p, sz); | ||
| 262 | return NULL; | ||
| 263 | } | ||
| 264 | return p; | ||
| 265 | #else | ||
| 266 | return mcode_alloc_at(J, 0, sz, MCPROT_GEN); | ||
| 267 | #endif | ||
| 268 | } | ||
| 256 | 269 | ||
| 257 | #endif | 270 | #endif |
| 258 | 271 | ||
diff --git a/src/lj_record.c b/src/lj_record.c index 04a4c73c..56038156 100644 --- a/src/lj_record.c +++ b/src/lj_record.c | |||
| @@ -815,6 +815,8 @@ void lj_record_ret(jit_State *J, BCReg rbase, ptrdiff_t gotresults) | |||
| 815 | !bc_isret(bc_op(J->cur.startins))) { | 815 | !bc_isret(bc_op(J->cur.startins))) { |
| 816 | /* Return to lower frame would leave the loop in a root trace. */ | 816 | /* Return to lower frame would leave the loop in a root trace. */ |
| 817 | lj_trace_err(J, LJ_TRERR_LLEAVE); | 817 | lj_trace_err(J, LJ_TRERR_LLEAVE); |
| 818 | } else if (J->needsnap) { /* Tailcalled to ff with side-effects. */ | ||
| 819 | lj_trace_err(J, LJ_TRERR_NYIRETL); /* No way to insert snapshot here. */ | ||
| 818 | } else { /* Return to lower frame. Guard for the target we return to. */ | 820 | } else { /* Return to lower frame. Guard for the target we return to. */ |
| 819 | TRef trpt = lj_ir_kgc(J, obj2gco(pt), IRT_PROTO); | 821 | TRef trpt = lj_ir_kgc(J, obj2gco(pt), IRT_PROTO); |
| 820 | TRef trpc = lj_ir_kptr(J, (void *)frame_pc(frame)); | 822 | TRef trpc = lj_ir_kptr(J, (void *)frame_pc(frame)); |
