mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 23:24:09 +00:00
FFI: Fix blacklisting of C functions calling callbacks.
This commit is contained in:
parent
68ca796d28
commit
cf5a54fedf
@ -18,6 +18,7 @@
|
|||||||
#include "lj_ccallback.h"
|
#include "lj_ccallback.h"
|
||||||
#include "lj_target.h"
|
#include "lj_target.h"
|
||||||
#include "lj_mcode.h"
|
#include "lj_mcode.h"
|
||||||
|
#include "lj_trace.h"
|
||||||
#include "lj_vm.h"
|
#include "lj_vm.h"
|
||||||
|
|
||||||
/* -- Target-specific handling of callback slots -------------------------- */
|
/* -- Target-specific handling of callback slots -------------------------- */
|
||||||
@ -486,6 +487,7 @@ lua_State * LJ_FASTCALL lj_ccallback_enter(CTState *cts, void *cf)
|
|||||||
lua_assert(L != NULL);
|
lua_assert(L != NULL);
|
||||||
if (gcref(cts->g->jit_L))
|
if (gcref(cts->g->jit_L))
|
||||||
lj_err_caller(gco2th(gcref(cts->g->jit_L)), LJ_ERR_FFI_BADCBACK);
|
lj_err_caller(gco2th(gcref(cts->g->jit_L)), LJ_ERR_FFI_BADCBACK);
|
||||||
|
lj_trace_abort(cts->g); /* Never record across callback. */
|
||||||
/* Setup C frame. */
|
/* Setup C frame. */
|
||||||
cframe_prev(cf) = L->cframe;
|
cframe_prev(cf) = L->cframe;
|
||||||
setcframe_L(cf, L);
|
setcframe_L(cf, L);
|
||||||
@ -516,6 +518,7 @@ void LJ_FASTCALL lj_ccallback_leave(CTState *cts, TValue *o)
|
|||||||
L->cframe = cframe_prev(L->cframe);
|
L->cframe = cframe_prev(L->cframe);
|
||||||
L->top -= 2;
|
L->top -= 2;
|
||||||
L->base = obase;
|
L->base = obase;
|
||||||
|
cts->cb.slot = 0; /* Blacklist C function that called the callback. */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -- C callback management ----------------------------------------------- */
|
/* -- C callback management ----------------------------------------------- */
|
||||||
|
Loading…
Reference in New Issue
Block a user