The document discusses variability anomalies in the Linux kernel caused by inconsistencies between code, Kconfig files, and Makefiles. The researchers conducted two studies to understand the causes and fixes of such anomalies. They found that incomplete Kconfig patches often cause referential anomalies, accounting for an average of 14% of cases. Referential anomalies are commonly fixed by code patches (26% of the time) rather than Kconfig patches (3% of the time). On average, anomalies last for 6 releases before being fixed. The findings suggest that changes to Kconfig are sometimes not fully propagated and that anomalies from incomplete changes are hard to catch during review.
How AI, OpenAI, and ChatGPT impact business and software.
Linux Variability Anomalies: Causes, Fixes and Duration
1. Linux Variability Anomalies:
What Causes Them?
How do They Get Fixed?
MSR 2013, May 18th 2013 -- San Francisco, USA
Sarah Nadi, Christian Dietrich, Reinhard Tartler,
Richard C. Holt, Daniel Lohmann
2. Configuring the Linux Kernel
Nadi et al. - MSR 2013 Causes & Fixes of Variability Anomalies 2
User
Selection
Linux Kernel
Configuration
Customized
KernelLinux User
I’ll customize this
kernel for my
specific needs!
3. Variability in Linux (e.g.,Adding New Driver)
Nadi et al. - MSR 2013 Causes & Fixes of Variability Anomalies 3
New driver to
add?… Here we
go again!
Linux
Developer
...
#ifdef USB
void put_usb(...);
….
#endif
...
usb_foo.c
...
obj-$(USB_FOO) += usb_foo.o
...
Kbuild
(Makefile)
...
config USB_FOO
bool “FOO Support”
depends on USB
...
Kconfig
Maintaining Consistency is hard!!
4. Variability Anomalies
• Inconsistencies between the 3 artifacts leads to dead and
undead CPP code [Tartler et al., EUROSYS ‘11][Nadi & Holt, CSMR‘12]
• In Linux v3.6, 1,077 variability anomalies detected!
Nadi et al. - MSR 2013 Causes & Fixes of Variability Anomalies 4
Linux Developer
OK, help me
avoid them!
How do these anomalies get
introduced?
How do these anomalies get
fixed?
Avoid future anomalies
Automatically suggest solutions
5. Study Overview
Nadi et al. - MSR 2013 Causes & Fixes of Variability Anomalies 5
Exploratory Case Study
Study set of 106 existing
patches (51% accepted)
1
Patterns
Confirmatory Case Study
a) Use undertaker to
detect anomalies
b) Mine git repository over
several releases to
confirm patterns
2
undertaker
6. Undertaker
• Detects dead & undead
code blocks
• Uses SAT solver
for consistency
checking
• Developed at FAU
[Tartler et al., Eurosys ‘11]
Nadi et al. - MSR 2013 Causes & Fixes of Variability Anomalies 6
7. Referential Variability Anomalies
Nadi et al. - MSR 2013 Causes & Fixes of Variability Anomalies 7
Referential
Anomalies
• Caused by missing feature definitions
• Missing features can never be selected
• Almost 40% of detected anomalies are referential
#ifdef USB
//B1
#else
//B2
#endif
8. Observations from Exploratory Study
Nadi et al. - MSR 2013 Causes & Fixes of Variability Anomalies 8
Incorrect Feature
Names
1 2
Incomplete Kconfig
Patches
• Code is not useless – incorrect
feature was used
• Some incorrect features were
typos
• Responses suggest that several
of missing features were
previously renamed/deleted
9. Research Questions
RQ1: Are misspellings a common cause of variability
anomalies?
RQ2: Are incomplete Kconfig patches a common cause of
variability anomalies?
RQ3: How are variability anomalies fixed?
RQ4: How long do variability anomalies last in Linux?
Nadi et al. - MSR 2013 Causes & Fixes of Variability Anomalies 9
10. Confirmatory Case Study - Overview
Nadi et al. - MSR 2013 Causes & Fixes of Variability Anomalies 10
- Feature_X
+Feature_Y
25,410
CPP/Code Patches
- Feature_X
+Feature_Y
10,263
Kconfig Patches
Feature_X
missing
Referential
Anomalies
undertaker
v2.6.37 – v3.6
Kconfig
Patches
Time
cause
Mapping
CPP Patches
Kconfig Patches
Time
fix
11. Results: Causes of Variability Anomalies
Nadi et al. - MSR 2013 Causes & Fixes of Variability Anomalies 11
Incomplete Kconfig patches often cause referential anomalies.
An average of 14% of referential anomalies are caused by
changes to Kconfig that are not completely propagated to
source code.
Incomplete
Kconfig
patches
Time
cause
12. Results: Fixes for Variability Anomalies
Nadi et al. - MSR 2013 Causes & Fixes of Variability Anomalies 12
Referential anomalies are commonly fixed by CPP patches (26%
of the time) .
Time
fix
Kconfig/CPP
patches
Referential anomalies are seldom fixed by Kconfig patches (3% of
the time).
13. Summary of Results
RQ1: Are misspellings a common cause of variability
anomalies?
RQ2: Are incomplete Kconfig patches a common cause of
variability anomalies?
RQ3: How are variability anomalies fixed?
RQ4: How long do variability anomalies last in Linux?
Nadi et al. - MSR 2013 Causes & Fixes of Variability Anomalies 13
Typos do not commonly cause anomalies
Anomalies are caused by incomplete Kconfig patches 14% of the time
Anomalies are often fixed by CPP patches (26% of the time)
On average, anomalies last for 6 releases
14. What Does it All Mean?
• Strict review process catches spelling mistakes
• Changes to Kconfig are sometimes not properly propagated to
the rest of the kernel
• Anomalies caused by incomplete changes are harder to catch
in the review process
• Developers tend to fix things on the code side since changes to
Kconfig have potentially cross-cutting concerns
• Developers have difficulty keeping everything consistent.
Providing them with automatic tools for these tasks may help.
Nadi et al. - MSR 2013 Causes & Fixes of Variability Anomalies 14
15. Nadi et al. - MSR 2013 Causes & Fixes of Variability Anomalies 15
Questions?
snadi@uwaterloo.ca
http://swag.uwaterloo.ca/~snadi
Incomplete
configuration
patches
Code (CPP)
patches
Time
cause fix
14% 26%