JIT Compiler with PAE paging protection

Programming, for all ages and all languages.
Post Reply
azblue
Member
Member
Posts: 147
Joined: Sat Feb 27, 2010 8:55 pm

JIT Compiler with PAE paging protection

Post by azblue »

A JIT compiler will read data (byte code) from one area of the memory, write machine code to another area of the memory, and then execute it.

When PAE is enabled, we have access to the No Execute Bit. I assume any intelligent OS will then make a distinction between pages containing code and pages containing data; I assume code pages would not be writeable and data pages would not be executable.

If a JIT compiler is part of the kernel this is a non-issue, as the kernel has the authority to change page protection at will.

But how does a user-mode program do this? Any area it can write to it cannot execute; any area it can execute it cannot write to.
User avatar
Rusky
Member
Member
Posts: 792
Joined: Wed Jan 06, 2010 7:07 pm

Re: JIT Compiler with PAE paging protection

Post by Rusky »

It asks the kernel nicely to change the permissions for it.
jnc100
Member
Member
Posts: 775
Joined: Mon Apr 09, 2007 12:10 pm
Location: London, UK
Contact:

Re: JIT Compiler with PAE paging protection

Post by jnc100 »

There are various OS-specific syscalls to do this. For example, on Linux have a look at mprotect().

Regards,
John.
azblue
Member
Member
Posts: 147
Joined: Sat Feb 27, 2010 8:55 pm

Re: JIT Compiler with PAE paging protection

Post by azblue »

D'oh, I guess that shouldn't have been too hard to figure out on my own :oops:
Post Reply