Search code examples
windowskerneldriverdevice-driver

How come private data is executable


I was looking into private data for different applications using vmmap for windows. And I found lot of apps have private data marked as executable. I also found dynamically allocated pages from non paged pool of kernel are also executable. How come windows allows to execute code from data pages. Or there are some specific cases where this is required.

Thanks


Solution

  • Any dynamically generated code has to live in an executable page.

    This is quite common. For example, any .Net app, Java app or web browser will have plenty of JITted code; ATL code uses dynamically generated trampolines for window procedures; any app that redirects an API (e.g. using Detours) will create trampolines for the redirected functions.

    I don't know what the kernel is doing but maybe (like ATL) it uses trampolines for performance critical code to avoid a table lookup.