Re: SIGSEGV in LuaJIT 2.1 VM
- From: Peter Cawley <corsix@xxxxxxxxxx>
- To: luajit@xxxxxxxxxxxxx
- Date: Fri, 18 Nov 2016 13:06:28 +0000
On Fri, Nov 18, 2016 at 12:31 PM, Igor Ehrlich <igor.a.ehrlich@xxxxxxxxx> wrote:
Is far as I was able to investigate, this issue occurs very rarely when you
run LuaJIT in an x86_64 multi-core environments (recent architectures,
usually core-i5 for some reason) without thread affinity, constant memory
permission flapping causes hardware to malfunction and the application
fails.
If Tomas has a semi-reproducible setup, I'd be interested to know
whether the following has any effect: (if for some reason the hardware
sees this as cross-modifying code rather than self-modifying code,
then some kind of serializing instruction is required for some
hardware models)
diff --git a/src/lj_mcode.c b/src/lj_mcode.c
index 3eaee05..faec202 100644
--- a/src/lj_mcode.c
+++ b/src/lj_mcode.c
@@ -40,6 +40,7 @@ void lj_mcode_sync(void *start, void *end)
#endif
#if LJ_TARGET_X86ORX64
UNUSED(start); UNUSED(end);
+ { uint32_t vendor[4]; lj_vm_cpuid(0, vendor); }
#elif LJ_TARGET_IOS
sys_icache_invalidate(start, (char *)end-(char *)start);
#elif LJ_TARGET_PPC
Other related posts: