dotgnu-libjit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-libjit] WIN32 PATCH: Make allocated memory for compiled code act


From: GARCIA DE SORIA LUCENA, JUAN JESUS
Subject: [Dotgnu-libjit] WIN32 PATCH: Make allocated memory for compiled code actually executable under Data-Execution-Prevention enabled versions of Windows.
Date: Fri, 23 May 2008 14:56:57 +0200

Hi again.
 
 
When trying libjit compiled with MinGW on Windows Server 2003, we found
it failing consistently on some machines and working consistently on
others. It turned out that the difference was the activation of Data
Execution Prevention (DEP) at the failing machine.
 
We found that jit_malloc_exec() was simply using malloc() in Windows,
that turned out to be wrong. As specified in
http://technet.microsoft.com/en-us/library/bb457155.aspx, in order to
application-generated code to be runnable under DEP, it has to be
reserved via VirtualAlloc() and freed via VirtualFree(), with flags
specifying the memory to be executable. That's what the attached patch
does.

I've successfully tested the patched libjit tutorials on a Windows
Server 2003 where the unpatched ones do trigger DEP, resulting in
process death.


Best Regards,

    Juan Jesus Garcia de Soria.

Attachment: win32-allocate-executable-memory.patch
Description: win32-allocate-executable-memory.patch


reply via email to

[Prev in Thread] Current Thread [Next in Thread]