Hi,
tom9876543 wrote:There is an easy solution... require open source drivers. This solution is also "portable" - it works on any CPU!
In general there's 3 reasons for security/protection:
- - restricting problems caused by malicious code
- restricting problems caused by buggy code
- getting immediate feedback when something goes wrong (including what went wrong and exactly which piece of code the problem is in) to make it extremely easy to debug.
Does open source restrict problems caused malicious code? In some situations (e.g. someone trying to submit a suspicious kernel patch to the Linux kernel maintainers) it definately does prevent malicious code. Of course most commercial companies do code audits, quality checks, etc that would also find something so blatant. In other situations (e.g. a disgruntled system adminstrator downloading the source code, modifying it, and installing their malicious/modified version on the company's server) it doesn't help at all, and actually makes it easier for the disgruntled system adminstrator.
Does open source restrict problems caused by buggy code? In theory, thousands of times more people checking the code make it thousands of times more likely that a bug will be spotted. In practice very few people actually do read the code unless they're the ones writing/maintaining it. For example, I'm a programmer who's quite interested in OS programming, I've been using Gentoo for years and I've got (several versions of) the Linux kernel source code sitting on my hard drive. Despite this I've read less than 200 lines of the (over 6 million lines of) source code. Did I do a detailed analysis of the SCSI driver that this kernel uses on my machine to find out if there's a bug somewhere? No. If I did do a detailed analysis would I actually find a bug if there was one? Probably not - I could spend months and still might not find the bug (if there was one). So, does open source help find the bugs? Mostly it's just marketting hype - most bugs are found when users complain that something didn't work (and the authors find and fix the bug). The users don't find the bugs themselves.
Does open source give you immediate feedback when something goes wrong (including what went wrong and exactly which piece of code the problem is in) to make it extremely easy to debug? No. For something like an intermittent bug in a device driver's DMA handling, you might just have random processes crashing occasionally where no-one has any idea which piece of code is causing the problem.
Imagine something like an "off by one" error in a network driver, where it transfers 4097 bytes instead of 4096 bytes, trashing one byte in next physical page Sometimes the next physical page will be free and nothing happens, sometimes an unused byte is trashed and nothing happens, sometimes an unimportant byte is trashed (a pixel in some graphics data might change colour, a sound might have an unnoticeable "click", etc), sometimes some random process crashes unexpectedly, and sometimes the kernel behaves erratically. If all you see is the symptoms, how would you find this bug? I'd probably start by doing RAM testing for 2 days, then I guess I'd try removing as many devices and drivers as I could to see if the problem goes away when a specific device is removed. If the OS crashes once per day (on average), it could take a month or more just to find out which device driver has the bug (without actually finding the bug).
Alternatively, imagine a nice dialog box that pops up as soon as the bug occurs, saying "The network driver tried to do a DMA transfer into page it doesn't have access to and has been terminated." and asking you if you want to send an automated bug report, or view details (register contents, etc), or do a core dump of the process, etc. Even an ugly blue screen of death would be much much more useful than trying to guess what happened with no information to rely on.
tom9876543 wrote:Trying to make an operating system with "untrusted" drivers seems like a waste of time to me.
Trying to trust millions of lines of code seems like a waste of time to me....
Here's
an interesting summary I found (part of a University course AFAIK). Some interesting quotes:
Device drivers are the biggest cause of crashes
– Drivers cause 85% of Windows XP crashes
– Drivers in Linux are 7 times buggier than the kernel
• 10s of thousands of device drivers exist
– Over 35K drivers on Win/XP!
This may or may not be accurate, but think about it. Millions of lines of code (that are "less well tested" because most people don't use most device drivers), written by thousands of different people (with varying skills), running in kernel mode with no protection at all? IMHO this sounds entirely insane, but it also describes most modern OSs fairly well.
Put it like this, if open source does help, then combining open source and protection will help more.
Cheers,
Brendan