C30032

warning C30032: Calling a memory allocating function and forcing the request of executable memory through use of the POOL_NX_OPTOUT directive

BANNED_MEM_ALLOCATION_FORCE_UNSAFE

The preprocessor directive POOL_NX_OPTOUT prevents the auto-promotion of non-safe types (MM_PAGE_PRIORITY and POOL_TYPE) to safe types (for example, NonPagedPool to NonPagedPoolNx). The use of POOL_NX_OPTOUT in your sources is likely by design. If this is by design and executable memory is required, then you can suppress the warning with Pragma Prefast to Suppress Warning Messages. This type of allocation is not permitted on Windows 10 systems that have opted-in to additional memory protections.

Example

The following code generates this warning:

In the sources file:

C_DEFINES=$(C_DEFINES) –DUNICODE -DPOOL_NX_OPTOUT=1

in the code file:

pPtr = MmGetSystemAddressForMdlSafe( pMdl, NormalPagePriority);

The following code avoids this warning:

In the sources file, add:

C_DEFINES=$(C_DEFINES) -DUNICODE -DPOOL_NX_OPTIN_AUTO=1

in the code file:

pPtr = MmGetSystemAddressForMdlSafe( pMdl, NormalPagePriority);