260 likes | 466 Views
Creating User-Mode Drivers with a Proxy ( or How to Look Smarter Than You Really Are). Galen C. Hunt Microsoft Research and the University of Rochester Department of Computer Science. Problem. NT Drivers Difficulties: Kernel-Mode Environment: Minimal (12K) Stack,
E N D
Creating User-Mode Drivers with a Proxy(or How to Look Smarter Than You Really Are) Galen C. Hunt Microsoft Research and the University of Rochester Department of Computer Science
Problem • NT Drivers Difficulties: • Kernel-Mode Environment: • Minimal (12K) Stack, • Paged and Non-Paged Memory Pools, • Crashes are Globally Fatal, • Two (2) Machines for Debugging. • Packet-Driven I/O Model: • Fully re-entrant code, • Take extreme care when blocking.
Solution • Write User-Mode Device Drivers. • Use Proxy for a Kernel-Mode Presence.
Outline • Introduction • Outline • NT Driver & Proxy Architecture • Implementation Details • Performance Measurements • Related Work • Conclusions
NT Kernel-Mode I/O Architecture I/O Manager = I/O Request Packet Crypto - Filter Driver NTFS - File-System Driver Stripe (RAID) - Intermediate Driver SCSI - Port Driver Adaptec - Miniport (Adapter) Driver
Kernel-Mode Driver Architecture Application and Win32 Subsystem User Mode APIs NT Executive (I/O Manager) Kernel Mode IRPs Device Entry Device Driver
Proxy Driver Architecture App. & Win32 User-Mode Driver User Mode COM COM Service APIs APIs NT I/O Manager Kernel Mode IRPs IRPs Stub Entry Host Entry Proxy Driver
Proxy Details App. & Win32 User-Mode Driver COM Service 1 NT I/O Manager Stub Entry Host Entry Proxy Driver
Proxy Details App. & Win32 User-Mode Driver COM Service 1 NT I/O Manager 2 Stub Entry Host Entry Proxy Driver
Proxy Details App. & Win32 User-Mode Driver COM Service 1 NT I/O Manager 2 Stub Entry Host Entry Proxy Driver 3
Proxy Details App. & Win32 User-Mode Driver COM Service 4 1 NT I/O Manager 2 Stub Entry Host Entry Proxy Driver 3
Proxy Details App. & Win32 User-Mode Driver COM Service 4 1 NT I/O Manager 5 2 Stub Entry Host Entry Proxy Driver 3
Proxy Details App. & Win32 User-Mode Driver COM Service 4 1 NT I/O Manager 5 2 Stub Entry Host Entry Proxy Driver 6 3
Proxy Details App. & Win32 User-Mode Driver COM Service 4 1 NT I/O Manager 7 5 2 Stub Entry Host Entry Proxy Driver 6 3
Proxy Details App. & Win32 User-Mode Driver 8 COM Service 4 1 NT I/O Manager 7 5 2 Stub Entry Host Entry Proxy Driver 6 3
Proxy Details App. & Win32 User-Mode Driver 9 8 COM Service 4 1 NT I/O Manager 7 5 2 Stub Entry Host Entry Proxy Driver 6 3
Proxy Details App. & Win32 User-Mode Driver 9 8 COM Service 4 1 NT I/O Manager 7 5 2 Stub Entry Host Entry 10 Proxy Driver 6 3
Proxy Details App. & Win32 User-Mode Driver 9 8 COM Service 4 1 11 NT I/O Manager 7 5 2 Stub Entry Host Entry 10 Proxy Driver 6 3
Proxy Details Summary App. & Win32 User-Mode Driver 9 COM Service 8 1 4 NT I/O Manager 11 5 Stub Entry Host Entry 2 7 10 Proxy Driver 6 3
Null (Raw) Device Latency = 14s
Related Work • Watchdogs [Bershad & Pinkerton, 1988] • Semantic File System [Gifford et al, 1991] • HURD Translators [Bushnell, 1994] • Frigate [Kim and Popek, 1997] • Rialto [Draves and Cutshall, 1997]
Conclusion • Drivers Create with Proxy include: • HTTP/FTP File System • Virtual Memory Disk • Further Information: • http://research.microsoft.com/~galenh/proxy
Appendix A: IDeviceFileSink interface IDeviceFileSink : IUnknown { HRESULT Create ([in] IDevIrp *pIrp, [in] IDevSecurityContext *pCtxt,... HRESULT Cleanup ([in] IDevIrp *pIrp); HRESULT Close ([in] IDevIrp *pIrp); HRESULT Shutdown ([in] IDevIrp *pIrp); HRESULT Read ([in] IDevIrp *pIrp, [in] LARGE_INTEGER ByteOffset,... HRESULT Write ([in] IDevIrp *pIrp, [in] LARGE_INTEGER ByteOffset,... HRESULT DeviceControl ([in] IDevIrp *pIrp, [in] ULONG IoControlCode,... HRESULT QueryInformation([in] IDevIrp *pIrp, [in] ULONG Length,... HRESULT SetInformation ([in] IDevIrp *pIrp, [in] ULONG Length,... HRESULT FlushBuffers ([in] IDevIrp *pIrp); };