#include "mi.h"
Go to the source code of this file.
Defines | |
#define | MM_MAXIMUM_CONCURRENT_SESSIONS 16384 |
#define | MI_SESSION_COMMIT_CHARGE 2 |
Functions | |
VOID | MiSessionAddProcess (PEPROCESS NewProcess) |
VOID | MiSessionRemoveProcess (VOID) |
VOID | MiInitializeSessionIds (VOID) |
NTSTATUS | MiSessionCreateInternal (OUT PULONG SessionId) |
NTSTATUS | MiSessionCommitPageTables (IN PVOID StartVa, IN PVOID EndVa) |
BOOLEAN | MiDereferenceSession (VOID) |
VOID | MiSessionDeletePde (IN PMMPTE Pde, IN BOOLEAN WorkingSetInitialized, IN PMMPTE SelfMapPde) |
VOID | MmSessionLeader (IN PEPROCESS Process) |
VOID | MmSessionSetUnloadAddress (IN PDRIVER_OBJECT pWin32KDevice) |
NTSTATUS | MmSessionCreate (OUT PULONG SessionId) |
NTSTATUS | MmSessionDelete (ULONG SessionId) |
VOID | MiAttachSession (IN PMM_SESSION_SPACE SessionGlobal) |
VOID | MiDetachSession (VOID) |
NTSTATUS | MiSessionCommitImagePages (IN PVOID VirtualAddress, IN SIZE_T NumberOfBytes) |
VOID | MiSessionOutSwapProcess (IN PEPROCESS Process) |
VOID | MiSessionInSwapProcess (IN PEPROCESS Process) |
Variables | |
ULONG | MiSessionCount |
FAST_MUTEX | MiSessionIdMutex |
PRTL_BITMAP | MiSessionIdBitmap |
|
Definition at line 35 of file session.c. Referenced by MiSessionCreateInternal(). |
|
Definition at line 26 of file session.c. Referenced by MiInitializeSessionIds(). |
|
Definition at line 1181 of file session.c. References ASSERT, KeAttachSessionSpace(), MI_SESSION_SPACE_END, MI_SESSION_SPACE_PAGE_TABLES, MI_WRITE_VALID_PTE, MiGetPdeAddress, MiGetPpeAddress, MiHydra, MmSessionBase, PsGetCurrentProcess, TRUE, _MMPTE::u, and ZeroKernelPte. Referenced by MiEmptyAllWorkingSetsWorker(), and MmWorkingSetManager().
|
|
Definition at line 1544 of file session.c. References ASSERT, _MM_SESSION_SPACE::AttachCount, _MM_SESSION_SPACE::AttachEvent, _MM_SESSION_SPACE::CommittedPages, _DRIVER_OBJECT::DriverUnload, Event(), ExDeleteResource, FALSE, _MM_SESSION_SPACE::GlobalPteEntry, _MMWSL::HighestPermittedHashAddress, Index, KeDetachSessionSpace(), KeDisableSessionSharing(), KeEnterCriticalRegion, KeInitializeEvent, KeLeaveCriticalRegion, KernelMode, KeWaitForSingleObject(), LOCK_EXPANSION, LOCK_PFN, LOCK_SESSION, MI_FLUSH_SESSION_TB, MI_FLUSH_SINGLE_SESSION_TB, MI_GET_PAGE_FRAME_FROM_PTE, MI_PFN_ELEMENT, MI_SESSION_IMAGE_SIZE, MI_SESSION_IMAGE_START, MI_SESSION_SPACE_END, MI_SESSION_SPACE_PAGE_TABLES, MI_SESSION_SPACE_WORKING_SET_MINIMUM, MI_SESSION_SPACE_WS, MI_SESSION_VIEW_SIZE, MI_SESSION_VIEW_START, MI_SET_PFN_DELETED, MI_WRITE_INVALID_PTE, MiCheckSessionPoolAllocations(), MiDecrementShareAndValidCount, MiDecrementShareCountOnly, MiFreeSessionPoolBitMaps(), MiFreeSessionSpaceMap(), MiGetPdeAddress, MiGetPdeSessionIndex, MiGetPpeAddress, MiGetPteAddress, MiReleaseSystemPtes(), MiReturnCommitment(), MiSessionCount, MiSessionDeletePde(), MiSessionIdBitmap, MiSessionIdMutex, MiSessionUnloadAllImages(), MM_BUMP_COUNTER, MM_BUMP_SESS_COUNTER, MM_DBG_COMMIT_RETURN_SESSION_DEREFERENCE, MM_DBG_SESSION_INITIAL_PAGE_FREE, MM_DBG_SESSION_PAGETABLE_FREE, MM_DBG_SESSION_WS_PAGE_FREE, MM_SNAP_SESS_MEMORY_COUNTERS, MM_TRACK_COMMIT, MMPTE, MmResidentAvailablePages, MmSessionBase, MmSessionSpace, _MM_SESSION_SPACE::NonPagablePages, NULL, _MM_SESSION_SPACE::PageTables, _MM_SESSION_SPACE::ProcessOutSwapCount, PsGetCurrentProcess, _MMPFN::PteFrame, _MM_SESSION_SPACE::ReferenceCount, RtlClearBits(), SESSION_GLOBAL, _MM_SESSION_SPACE::SessionId, _MM_SESSION_SPACE::SessionPageDirectoryIndex, SystemPteSpace, TRUE, _MMPTE::u, _MMSUPPORT::u, _MM_SESSION_SPACE::u, _MMPFN::u1, _MMPFN::u2, _MMPFN::u3, UNLOCK_EXPANSION, UNLOCK_EXPANSION_AND_THEN_WAIT, UNLOCK_PFN, UNLOCK_SESSION, _MM_SESSION_SPACE::Vm, _EPROCESS::Vm, _MMSUPPORT::VmWorkingSetList, _MM_SESSION_SPACE::Win32KDriverObject, _MMSUPPORT::WorkingSetExpansionLinks, WrVirtualMemory, _MM_SESSION_SPACE::WsListEntry, _MM_SESSION_SPACE::WsLock, and ZeroKernelPte. Referenced by MiSessionRemoveProcess(), MmSessionCreate(), and MmSessionDelete().
|
|
Definition at line 1253 of file session.c. References ASSERT, KeDetachSessionSpace(), MI_FLUSH_SESSION_TB, MI_SESSION_SPACE_END, MI_SESSION_SPACE_PAGE_TABLES, MiGetPdeAddress, MiGetPpeAddress, MiHydra, MmIsAddressValid(), MmSessionBase, MmSessionSpace, PsGetCurrentProcess, TRUE, _MMPTE::u, and ZeroKernelPte. Referenced by MiEmptyAllWorkingSetsWorker(), and MmWorkingSetManager().
|
|
Referenced by MmInitSystem(). |
|
Definition at line 178 of file session.c. References _MMSUPPORT::AllowWorkingSetAdjustment, ASSERT, FALSE, KeAddSessionSpace(), _MMWORKING_SET_EXPANSION_HEAD::ListHead, LOCK_EXPANSION, LOCK_SESSION, MmIsAddressValid(), MmSessionSpace, MmWorkingSetExpansionHead, _EPROCESS::Pcb, _MM_SESSION_SPACE::ProcessList, PsGetCurrentProcess, _MM_SESSION_SPACE::ReferenceCount, SESSION_GLOBAL, _EPROCESS::SessionProcessLinks, TRUE, _MMSUPPORT::u, _MM_SESSION_SPACE::u, UNLOCK_EXPANSION, UNLOCK_SESSION, _EPROCESS::Vm, _MM_SESSION_SPACE::Vm, and _MMSUPPORT::WorkingSetExpansionLinks. Referenced by MmCreateProcessAddressSpace().
|
|
Definition at line 2144 of file session.c. References ASSERT, _MM_SESSION_SPACE::CommittedPages, DbgPrint, FALSE, LOCK_PFN, LOCK_SESSION_SPACE_WS, MI_GET_PAGE_COLOR_FROM_SESSION, MI_NONPAGABLE_MEMORY_AVAILABLE, MI_PFN_ELEMENT, MI_WRITE_VALID_PTE, MiChargeCommitment(), MiEnsureAvailablePageOrWait(), MiGetPteAddress, MiInitializePfn(), MiRemoveAnyPage(), MiRemoveZeroPageIfAny, MiReturnCommitment(), MiSessionCommitPageTables(), MiZeroPhysicalPage(), MM_BUMP_COUNTER, MM_BUMP_SESS_COUNTER, MM_BUMP_SESSION_FAILURES, MM_DBG_COMMIT_RETURN_SESSION_IMAGE_FAILURE1, MM_DBG_COMMIT_SESSION_IMAGE_PAGES, MM_DBG_SESSION_DRIVER_PAGES_LOCKED, MM_DBG_SESSIONS, MM_SESSION_FAILURE_NO_COMMIT, MM_SESSION_FAILURE_NO_RESIDENT, MM_TRACK_COMMIT, MmIsAddressValid(), MmResidentAvailablePages, MmSessionSpace, _MM_SESSION_SPACE::NonPagablePages, NT_SUCCESS, NTSTATUS(), NULL, PAGE_SHIFT, PAGE_SIZE, Status, SYSLOAD_LOCK_OWNED_BY_ME, _MMPTE::u, _MMPFN::u1, UNLOCK_PFN, UNLOCK_SESSION_SPACE_WS, ValidKernelPteLocal, and ZeroKernelPte. Referenced by MiLoadImageSection().
|
|
Definition at line 2318 of file session.c. References ASSERT, CHAR, _MM_SESSION_SPACE::CommittedPages, FALSE, _MMWSL::FirstDynamic, Index, LOCK_PFN, MI_GET_PAGE_COLOR_FROM_SESSION, MI_GET_PAGE_FRAME_FROM_PTE, MI_NONPAGABLE_MEMORY_AVAILABLE, MI_PFN_ELEMENT, MI_SESSION_SPACE_END, MI_SESSION_SPACE_PAGE_TABLES, MI_WRITE_VALID_PTE, MiAddValidPageToWorkingSet(), MiChargeCommitment(), MiEnsureAvailablePageOrWait(), MiGetPdeAddress, MiGetPdeSessionIndex, MiGetVirtualAddressMappedByPte, MiInitializePfnForOtherProcess(), MiLocateWsle(), MiRemoveAnyPage(), MiRemoveZeroPageIfAny, MiReturnCommitment(), MiSwapWslEntries(), MiZeroPhysicalPage(), MM_BUMP_COUNTER, MM_BUMP_SESS_COUNTER, MM_BUMP_SESSION_FAILURES, MM_DBG_COMMIT_RETURN_SESSION_PAGETABLE_PAGES, MM_DBG_COMMIT_SESSION_PAGETABLE_PAGES, MM_DBG_SESSION_PAGETABLE_ALLOC, MM_SESSION_FAILURE_NO_COMMIT, MM_SESSION_FAILURE_NO_RESIDENT, MM_SESSION_SPACE_WS_LOCK_ASSERT, MM_TRACK_COMMIT, MmIsAddressValid(), MmResidentAvailablePages, MmSessionBase, MmSessionSpace, _MM_SESSION_SPACE::NonPagablePages, NULL, _MM_SESSION_SPACE::PageTables, PsGetCurrentThread, _MM_SESSION_SPACE::SessionPageDirectoryIndex, TRUE, _MMPTE::u, _MMWSLE::u1, _MMPFN::u1, UNLOCK_PFN, ValidKernelPdeLocal, _MM_SESSION_SPACE::Vm, _MMSUPPORT::VmWorkingSetList, _MM_SESSION_SPACE::Wsle, and ZeroKernelPte. Referenced by MiSessionCommitImagePages(), and MiShareSessionImage().
|
|
Definition at line 394 of file session.c. References ASSERT, _MM_SESSION_SPACE::Color, _MM_SESSION_SPACE::CommittedPages, DbgPrint, FALSE, _MM_SESSION_SPACE::GlobalPteEntry, _MM_SESSION_SPACE::GlobalVirtualAddress, _MM_SESSION_SPACE::ImageList, KeEnableSessionSharing(), KeInitializeSpinLock(), LOCK_PFN, MI_FLUSH_SINGLE_SESSION_TB, MI_GET_PAGE_COLOR_FROM_VA, MI_NONPAGABLE_MEMORY_AVAILABLE, MI_PFN_ELEMENT, MI_SESSION_COMMIT_CHARGE, MI_SESSION_POOL, MI_SESSION_SPACE_WORKING_SET_MINIMUM, MI_SET_PFN_DELETED, MI_WRITE_VALID_PTE, MiChargeCommitment(), MiDecrementReferenceCount(), MiDecrementShareAndValidCount, MiDecrementShareCountOnly, MiEnsureAvailablePageOrWait(), MiFreeSessionPoolBitMaps(), MiFreeSessionSpaceMap(), MiGetPdeAddress, MiGetPpeAddress, MiGetPteAddress, MiGetVirtualAddressMappedByPte, MiInitializePfn(), MiInitializePfnForOtherProcess(), MiInitializeSessionPool(), MiInitializeSystemSpaceMap(), MiReleaseSystemPtes(), MiRemoveAnyPage(), MiRemoveZeroPageIfAny, MiReserveSystemPtes(), MiReturnCommitment(), MiSessionIdBitmap, MiSessionIdMutex, MiZeroPhysicalPage(), MM_BUMP_COUNTER, MM_BUMP_SESS_COUNTER, MM_BUMP_SESSION_FAILURES, MM_DBG_COMMIT_RETURN_SESSION_CREATE_FAILURE1, MM_DBG_COMMIT_SESSION_CREATE, MM_DBG_SESSION_INITIAL_PAGE_ALLOC, MM_DBG_SESSION_INITIAL_PAGE_FREE_FAIL1, MM_DBG_SESSION_INITIAL_PAGETABLE_ALLOC, MM_DBG_SESSION_INITIAL_PAGETABLE_FREE_FAIL1, MM_DBG_SESSION_INITIAL_PAGETABLE_FREE_RACE, MM_DBG_SESSIONS, MM_DEMAND_ZERO_WRITE_PTE, MM_SESSION_FAILURE_NO_COMMIT, MM_SESSION_FAILURE_NO_IDS, MM_SESSION_FAILURE_NO_RESIDENT, MM_SESSION_FAILURE_NO_SYSPTES, MM_SESSION_FAILURE_RACE_DETECTED, MM_TRACK_COMMIT, MmIsAddressValid(), MmResidentAvailablePages, MmSessionBase, MmSessionSpace, _MM_SESSION_SPACE::NonPagablePages, NT_SUCCESS, NTSTATUS(), NULL, _MMPFN::OriginalPte, _MM_SESSION_SPACE::PageTables, _MM_SESSION_SPACE::ProcessList, _MMPFN::PteFrame, _MM_SESSION_SPACE::ReferenceCount, RtlClearBits(), RtlFindClearBitsAndSet(), _MM_SESSION_SPACE::Session, SESSION_GLOBAL, _MM_SESSION_SPACE::SessionId, _MM_SESSION_SPACE::SessionPageDirectoryIndex, _MM_SESSION_SPACE::SpinLock, StandbyPageList, Status, SystemPteSpace, TRUE, _MM_SESSION_SPACE::u, _MMPTE::u, _MMPFN::u2, _MMPFN::u3, UNLOCK_PFN, ValidKernelPdeLocal, ValidKernelPteLocal, _MM_SESSION_SPACE::WsListEntry, and ZeroKernelPte. Referenced by MmSessionCreate().
|
|
Definition at line 1408 of file session.c. References ASSERT, DbgPrint, FALSE, MI_GET_PAGE_FRAME_FROM_PTE, MI_PFN_ELEMENT, MI_SET_PFN_DELETED, MiDecrementShareAndValidCount, MiDecrementShareCountOnly, MiMapPageInHyperSpace(), MiUnmapPageInHyperSpace, MM_KERNEL_NOACCESS_PTE, MmHighestPhysicalPage, PTE_PER_PAGE, _MMPFN::PteFrame, TRUE, _MMPTE::u, _MMPFN::u1, _MMPFN::u2, _MMPFN::u3, and ZeroKernelPte. Referenced by MiDereferenceSession().
|
|
Definition at line 2737 of file session.c. References ASSERT, DbgPrint, _MM_SESSION_SPACE::GlobalVirtualAddress, LOCK_EXPANSION, MI_GET_DIRECTORY_FRAME_FROM_PROCESS, MI_GET_PAGE_FRAME_FROM_PTE, MiGetPdeOffset, MiGetPpeOffset, MiGetPteAddress, MiGetPteOffset, MiHydra, MiMapPageInHyperSpace(), MiUnmapPageInHyperSpace, MM_DBG_SESSIONS, MmSessionSpace, _MM_SESSION_SPACE::ProcessList, _MM_SESSION_SPACE::ProcessOutSwapCount, _MM_SESSION_SPACE::ReferenceCount, _MM_SESSION_SPACE::SessionId, TRUE, _MMSUPPORT::u, UNLOCK_EXPANSION, _MM_SESSION_SPACE::Vm, and _MMSUPPORT::WorkingSetSize. Referenced by MmInSwapProcess().
|
|
Definition at line 2551 of file session.c. References ASSERT, DbgPrint, _MM_SESSION_SPACE::GlobalVirtualAddress, KeQuerySystemTime(), _MM_SESSION_SPACE::LastProcessSwappedOutTime, LOCK_EXPANSION, MI_GET_DIRECTORY_FRAME_FROM_PROCESS, MI_GET_PAGE_FRAME_FROM_PTE, MiGetPdeOffset, MiGetPpeOffset, MiGetPteAddress, MiGetPteOffset, MiHydra, MiMapPageInHyperSpace(), MiUnmapPageInHyperSpace, MM_DBG_SESSIONS, MmSessionSpace, _MM_SESSION_SPACE::ProcessList, _MM_SESSION_SPACE::ProcessOutSwapCount, _MM_SESSION_SPACE::ReferenceCount, _MM_SESSION_SPACE::SessionId, TRUE, _MMSUPPORT::u, UNLOCK_EXPANSION, _MM_SESSION_SPACE::Vm, and _MMSUPPORT::WorkingSetSize. Referenced by MmOutSwapProcess().
|
|
Referenced by MmCleanProcessAddressSpace(). |
|
Definition at line 974 of file session.c. References ASSERT, FALSE, KeEnterCriticalRegion, KeLeaveCriticalRegion, LOCK_EXPANSION, MI_SESSION_SPACE_END, MiDereferenceSession(), MiGetPdeAddress, MiGetPpeAddress, MiHydra, MiSessionCount, MiSessionCreateInternal(), MiSessionInitializeWorkingSetList(), MmIsAddressValid(), MmSessionBase, MmSessionSpace, NT_SUCCESS, NTSTATUS(), PsGetCurrentProcess, Status, _MM_SESSION_SPACE::u, _MMPTE::u, _MMSUPPORT::u, UNLOCK_EXPANSION, _EPROCESS::Vm, and ZeroKernelPte. Referenced by NtSetSystemInformation().
|
|
Definition at line 1093 of file session.c. References ASSERT, DbgPrint, FALSE, KeEnterCriticalRegion, KeLeaveCriticalRegion, MiDereferenceSession(), MiHydra, MmIsAddressValid(), MmSessionSpace, PsGetCurrentProcess, _MM_SESSION_SPACE::SessionId, TRUE, _MMSUPPORT::u, and _EPROCESS::Vm. Referenced by NtSetSystemInformation().
|
|
Definition at line 109 of file session.c.
|
|
Definition at line 140 of file session.c. References ASSERT, MiHydra, MmIsAddressValid(), MmSessionSpace, PsGetCurrentProcess, TRUE, and _MM_SESSION_SPACE::Win32KDriverObject. Referenced by NtSetSystemInformation().
|
|
Definition at line 24 of file session.c. Referenced by MiDereferenceSession(), and MmSessionCreate(). |
|
Definition at line 30 of file session.c. Referenced by MiDereferenceSession(), MiInitializeSessionIds(), and MiSessionCreateInternal(). |
|
Definition at line 28 of file session.c. Referenced by MiDereferenceSession(), MiInitializeSessionIds(), and MiSessionCreateInternal(). |