On 26 Oct 2001, at 11:36, Nathan Russell wrote: > >Presumably a badly written Linux driver > >can cause the same problems as a badly written Windows driver.
Yes. There is however a subtle difference. Linux drivers come with source code, so if there is a bug, any competent programmer can fix it. Also there is almost invariably a mechanism for feeding patches back into the source tree. On the other hand, Windows drivers come wreathed in obscurity, usually clouded even further by licenses which prevent disassembly and therefore effectively make it illegal for anyone other than the original author to post a fixed version. > > IIRC, Linux drivers that are kernel modules do run in real mode; > someone on the list please correct me if I'm wrong. No, they don't run in real mode - which gives access to only the bottom megabyte of memory, in 16-bit mode, i.e. you're using the system as a fast 8086. Win 9x/ME drivers _do_ run in real mode! Some parts of some drivers (in proper 32-bit operating systems like linux, also Windows NT/2K/XP) _need_ to run in ring 0, which does allow unrestricted access to all memory, thus allowing the driver to trample on memory belonging to other processes. Part of the art of writing successful drivers is to do as little as possible in ring 0. > > This raises the question of why some folks have mentioned that drivers > under NT/2K don't cause these sorts of problems.... They're much less likely to. For a start, it's easier to write ring 0 code than real mode code on a 32-bit system; e.g. there's less room to confuse 16-bit and 32-bit addressing modes. Secondly, as I pointed out above, you can get out of ring 0 to do most of the work, so most of the time you have full protection from the OS to prevent you from clobbering someone else's memory. Regards Brian Beesley _________________________________________________________________________ Unsubscribe & list info -- http://www.scruz.net/~luke/signup.htm Mersenne Prime FAQ -- http://www.tasam.com/~lrwiman/FAQ-mers
