Search code examples
windowswinapikerneldevice-driver

MmAllocateContiguousMemory default permissions


Does anyone know what are the default permissions on the page, returned by this routine. Is there any chance of putting some code section on this page.

Thanks


Solution

  • Short answer is no - there is no safe, documented way of manipulating page protection bits from kernel mode. These bits are owned by the memory manager.

    That said, since memory allocated in this fashion does not have the NX bit set, there is nothing to stop you from executing code from memory allocated via this API.

    EDIT: I stand corrected - I was unaware of the API mentioned in Alex's answer above. You learn something new everyday!