5.1 advanced operating systems operating systems bugs linux's code has been significantly...
TRANSCRIPT
5.1 Advanced Operating Systems
Operating Systems Bugs
Linux's code has been significantly growing during last years.
Is this code bugs free? Obviously no.
How many bugs does Linux have?
How long do they live?
5.2 Advanced Operating Systems
Linux Kernel Size
Linux kernel has some main components:– drivers (Device Drivers).– fs (File System).– net (Networking).– Other (Main Kernel, Memory Management, IPC and
Architecture Specific Code).
The kernel size has grown from about 105K lines on version 1.0 (1994) to about 1.6M lines on version 2.4.1 (2001).The size of the device drivers code is always more than a half of the whole kernel and can reach even 70%.
5.3 Advanced Operating Systems
Linux Kernel Division
5.4 Advanced Operating Systems
Types of Bugs on 2.4.1 Version
Null – No check for potentially NULL pointers returned from functions.– 391 instances.
Block – Causing deadlock by calling of blocking function with interrupts disabled or spinlock held.– 293 instances.
Var – Allocation of large stack variables (>1K) on the fixed size kernel stack.– 102 instances.
Inull - Inconsistent assumptions about whether a pointer is NULL.– 69 instances.
5.5 Advanced Operating Systems
Types of Bugs (Cont.)
Range – No check for bounds of array indices or loop bounds derived from the user data.– 54 instances.
Intr – Disabled interrupts has not been restored.– 27 instances.
Lock - No release of acquired locks; or a double-acquire lock.– 26 instances.
Free – Reuse of freed memory.– 17 instances.
Other – 46 instances.
5.6 Advanced Operating Systems
Where are the Bugs?
5.7 Advanced Operating Systems
Device Driver Bugs
Device Drivers are the buggiest section of the kernel.– Over 90% of Block, Free and Intr.– Over 70% of Lock, Null and Var.
Device Drivers have 3 to 7 times (depends on the bug) higher error rate than the rest of the kernel code.Device Drivers are written by many developers who may understand the device more than the kernel.Only a few users may have a given device.
5.8 Advanced Operating Systems
Bugs Distribution
On 2002 Chou showed that the distribution of bugs is according to the formula:
This means that more than 60% of the files of the kernel code contain at least one bug and more than 20% contain at least 2 bugs.
k
kkx 567.02.1]Pr[
5.9 Advanced Operating Systems
Bugs Distribution (Cont.)
O – Actual Bugs, X – Expected Bugs
5.10 Advanced Operating Systems
Bugs Clusters
Many bugs are not independent.
One file usually written by one programmer.
Poor programmers writes buggy code, with no specific reason.
Some programmers are unaware of relevant system rules.
A seldom executed code is more likely to have bugs.
5.11 Advanced Operating Systems
Cut-and-Paste bugs
Cut-and-Paste bugs are very common in device drivers and elsewhere. On 2004 Li reported on 28 Cut-and-Paste bugs in Linux kernel (2.6.6) and 23 in FreeBSD kernel.On 2001 Chou reported on one source file of Linux device driver that has 35 bugs whereas 34 out of them are Cut-and-Paste bugs. – one of the bugs was copied 24 times and the other 10
times.
"working" code is not always a correct one and it is not always placed in the right context.
5.12 Advanced Operating Systems
Bugs Lifetime
5.13 Advanced Operating Systems
Bugs Lifetime Statistics
On 2001 Chou gave these figures:The average bugs Lifetime is 1.8 years.The median is 1.25 years.The average age of a bug is 1 year.– The explanation for this young age is the
many newborn bugs.
Most of the bugs are fixed quickly. There are a few who make the average higher.
5.14 Advanced Operating Systems
Where do Bugs Stem From?
5.15 Advanced Operating Systems
Bugs' Way of Life
5.16 Advanced Operating Systems
What about Microsoft?
The code of Microsoft is commercial; hence confidential.
On 2001 Murphy from Microsoft Research Center in Cambridge UK gave some details (they are on next slide); however, no absolute numbers, just percents.
On 2003 Swift claimed that the Device Drivers of WindowsXP are the reason for 85% of the failures.
5.17 Advanced Operating Systems
Windows Failures
WindowsNT fails because of:– 16% Microsoft Device Drivers.– 16% External Device Drivers.– 43% Internal Kernel faults.– 25% other (HW failures etc.).
Windows2000 fails because of:– 7% Microsoft Device Drivers.– 20% External Device Drivers.– 34% Internal Kernel faults.– 39% other (HW failures etc.).