Hello,
I know about existence of this piece of code (I think that something similar was present in the old rootkits book written by Hoglund and Butler), however, I hardly doubt it is legal.
First, there is a call to
MmBuildMdlForNonPagedPool which (I think) can be called only with MDLs describing nonpaged pool memory. But SSDT is pageable. Because this data structure can hardly be ever paged out, nothing wrong usually happens.
Second, documentation of
MmMapLockedPagesSpecifyCache says:
Code: Select allA driver must not try to create more than one system-address-space mapping for an MDL. Additionally, because an MDL that is built by the MmBuildMdlForNonPagedPool routine is already mapped to the system address space, a driver must not try to map this MDL into the system address space again by using the MmMapLockedPagesSpecifyCache routine (although creating user-address-space mappings is allowed). If it is not known whether a locked-down MDL already has a system-address-space mapping, a driver can use the MmGetSystemAddressForMdlSafe macro instead of MmMapLockedPagesSpecifyCache. If the MDL is already mapped into the system address space, MmGetSystemAddressForMdlSafe will return the existing system-address-space mapping instead of creating a new mapping.
So it seems that you should map SSDT into usermode part of the address space. System process might be ideal place for this operation.
I know that the code works well on current versions of Windows (except Windows 8, you say). But it seems that it works only because implementation of Mm routines was quite liberal.