My question is about this blurb from MSDN:
If AccessMode is UserMode, be aware of the following details:
The routine returns a user address that is valid in the context of the process in which the driver is running. For example, if a 64-bit driver is running in the context of a 32-bit application, the buffer is mapped to an address in the 32-bit address range of the application.
Note that if the call to MmMapLockedPages or MmMapLockedPagesSpecifyCache specified user mode, the caller must be in the context of the original process before calling MmUnmapLockedPages. This is because the unmapping operation occurs in the context of the calling process, and, if the context is incorrect, the unmapping operation could delete the address range of a random process.
What are the side-effects of not calling MmUnmapLockedPages? Lets assume that MmUnlockPages was already called from another thread and calling MmUnmapLockedPages would cause a system crash. If we can safely detect this case, avoiding the call to MmUnmapLockedPages would save us from the crash but could be considered a resource leak. Is it though? What kind of resources?
I realize that I have a design problem. I just want to know how to measure the impact and prioritize.