Re:Device drivers <-> kernel protection
Posted: Tue May 11, 2004 4:43 am
Hi,
BTW if you where a malicious virus writer how much fun could you have with win95's VxD's? I'd start by re-directing the interrupt vectors for the API's...
Cheers,
Brendan
In general you're right, but some things can be done to minimize the risk. In my OS the only way that a device driver can get a physical address is to use the "void *alloc_DMA_buffer(linear_address, pages)" function. It doesn't prevent all DMA problems, but if the device driver can't keep track of it's own buffer it wouldn't pass basic beta testing. It does mean that a device driver can't be tricked into using incorrect physical address ranges by external code. For ISA DMA the kernel can check that the DMA transfer is going to a buffer that was allocated specifically for DMA (my kernel sets a flag in the page table entries).Pype.Clicker wrote: Now, consider this: in order to perform a UtlraDMA disk request, i need to write the physical address of the target memory area into the memory-mapped 'buffer' of the busmaster device. How would the microkernel ensure that the disk driver isn't evilly writing a microkernel frame number there, or a random number (likely to come from another process) ?
Same for ISA DMA ports: the Soundblaster driver shouldn't be allowed to toy with them directly, but rather use a trusted service to program the DMA on its behalf, no ?
Using a kernel plugin wouldn't make any sense at all (most programmers would plugin the entire driver instead). While it's not 100% bullet-proof it's a lot better than a wet paper bag (device drivers at CPL=0) in terms of security, as long as you can accept the performance implications.And as such DMA things cannot be reliably performed at user level, why not simply moving the whole 'lower level' part of the driver at the kernel level ? What sense does it make to have a user-level driver that need a kernel plugin to make its job ?
BTW if you where a malicious virus writer how much fun could you have with win95's VxD's? I'd start by re-directing the interrupt vectors for the API's...
Cheers,
Brendan