Feature Consistency in Compile-Time–Configurable System Software Facing the Linux 10000 Feature Problem Reinhard Tartler , Daniel Lohmann, Julio Sincero, Wolfgang Schr¨ oder-Preikschat System Software Group Friedrich-Alexander University Erlangen-Nuremberg April 11, 2011 supported by
System Software is Configurable System Software is incredibly configurable R. Tartler Feature Consistency in Compile-Time–Configurable System Software (April 11, 2011) 2 – 19
System Software is Configurable System Software is incredibly configurable Complexity increases considerably R. Tartler Feature Consistency in Compile-Time–Configurable System Software (April 11, 2011) 2 – 19
System Software is Configurable System Software is incredibly configurable Complexity increases considerably � Source of bugs ! R. Tartler Feature Consistency in Compile-Time–Configurable System Software (April 11, 2011) 2 – 19
System Software is Configurable System Software is incredibly configurable Linux v2.6.35 contains: Complexity increases considerably 11.057 Features � Source of bugs ! 27.166 Source files 82.116 #ifdef blocks R. Tartler Feature Consistency in Compile-Time–Configurable System Software (April 11, 2011) 2 – 19
Variability Implementation in Linux configuration space configuration variant user selection 1 config HOTPLUG_CPU bool "Support for ..." depends on SMP && ... 2 Kbuild KConfig files auto.make Kconfig 4 #define CONFIG_HOTPLUG_CPU #define CONFIG_SMP 3 ... #ifdef CONFIG_HOTPLUG_CPU ... #endif autoconf.h gcc source files implementation space implementation variant R. Tartler Feature Consistency in Compile-Time–Configurable System Software (April 11, 2011) 3 – 19
Variability Implementation in Linux R. Tartler Feature Consistency in Compile-Time–Configurable System Software (April 11, 2011) 3 – 19
Variability Implementation in Linux R. Tartler Feature Consistency in Compile-Time–Configurable System Software (April 11, 2011) 3 – 19
Variability Implementation in Linux R. Tartler Feature Consistency in Compile-Time–Configurable System Software (April 11, 2011) 3 – 19
Variability Implementation in Linux R. Tartler Feature Consistency in Compile-Time–Configurable System Software (April 11, 2011) 3 – 19
The Problem Configuration Implementation R. Tartler Feature Consistency in Compile-Time–Configurable System Software (April 11, 2011) 4 – 19
The Problem Configuration Source of Inconsistencies! Implementation R. Tartler Feature Consistency in Compile-Time–Configurable System Software (April 11, 2011) 4 – 19
Finding Bugs with Tools for Static Analysis Bugs in declaration and implementation Excellent tool support for static analysis: Dingo: Taming Device Drivers (EuroSys’09) KLEE: Automatic generation of high-coverage tests (EuroSys’08) RWset: Attacking path explosion (TACAS’08) EXE: Automatically generating inputs of death (CCS’06) ... R. Tartler Feature Consistency in Compile-Time–Configurable System Software (April 11, 2011) 5 – 19
Finding Bugs with Tools for Static Analysis Bugs in declaration and implementation Excellent tool support for static analysis: Dingo: Taming Device Drivers (EuroSys’09) KLEE: Automatic generation of high-coverage tests (EuroSys’08) RWset: Attacking path explosion (TACAS’08) EXE: Automatically generating inputs of death (CCS’06) ... Each of them is configuration agnostic: R. Tartler Feature Consistency in Compile-Time–Configurable System Software (April 11, 2011) 5 – 19
Outline 1. Introduction 2. Analysis 3. Approach and Implementation 4. Results 5. Future Work and Conclusions R. Tartler Feature Consistency in Compile-Time–Configurable System Software (April 11, 2011) 6 – 19
Problem Analysis Configuration Implementation
Problem Analysis Configuration Implementation symbols symbols constraints constraints
Problem Analysis Configuration Implementation config HOTPLUG_CPU symbols symbols constraints constraints depends on SMP && HOTPLUG
Problem Analysis Configuration Implementation config HOTPLUG_CPU #ifdef CONFIG_CPU_HOTPLUG symbols symbols constraints constraints depends on SMP && HOTPLUG #ifdef CONFIG_CPU_HOTPLUG #else #endif
Problem Analysis Configuration Implementation config HOTPLUG_CPU #ifdef CONFIG_CPU_HOTPLUG symbols symbols constraints constraints depends on SMP && HOTPLUG #ifdef CONFIG_CPU_HOTPLUG #else #endif
Problem Analysis Configuration Implementation config HOTPLUG_CPU #ifdef CONFIG_CPU_HOTPLUG Symbolic � symbols symbols constraints constraints depends on SMP && HOTPLUG #ifdef CONFIG_CPU_HOTPLUG #else #endif
Problem Analysis Configuration Implementation config HOTPLUG_CPU #ifdef CONFIG_CPU_HOTPLUG Symbolic � symbols symbols Logic � constraints constraints depends on SMP && HOTPLUG #ifdef CONFIG_CPU_HOTPLUG #else #endif R. Tartler Feature Consistency in Compile-Time–Configurable System Software (April 11, 2011) 7 – 19
Symbolic Inconsistency config HOTPLUG_CPU bool "Support for hot -pluggable CPUs" depends on SMP && HOTPLUG ---help --- R. Tartler Feature Consistency in Compile-Time–Configurable System Software (April 11, 2011) 8 – 19
Symbolic Inconsistency config HOTPLUG_CPU bool "Support for hot -pluggable CPUs" depends on SMP && HOTPLUG ---help --- static int hotplug_cfd (struct notifier_block *nfb , unsigned long action , void *hcpu) { // [...] switch (action) { case CPU_UP_PREPARE : case CPU_UP_PREPARE_FROZEN : // [...] #ifdef CONFIG_CPU_HOTPLUG case CPU_UP_CANCELED : case CPU_UP_CANCELED_FROZEN : case CPU_DEAD: case CPU_DEAD_FROZEN : free_cpumask_var (cfd ->cpumask ); break; #endif }; return NOTIFY_OK; R. Tartler Feature Consistency in Compile-Time–Configurable System Software (April 11, 2011) 8 – 19
Symbolic Inconsistency config HOTPLUG_CPU bool "Support for hot -pluggable CPUs" depends on SMP && HOTPLUG ---help --- Symbolic � static int hotplug_cfd (struct notifier_block *nfb , unsigned long action , void *hcpu) { // [...] switch (action) { case CPU_UP_PREPARE : case CPU_UP_PREPARE_FROZEN : // [...] #ifdef CONFIG_CPU_HOTPLUG case CPU_UP_CANCELED : case CPU_UP_CANCELED_FROZEN : case CPU_DEAD: case CPU_DEAD_FROZEN : free_cpumask_var (cfd ->cpumask ); break; #endif }; return NOTIFY_OK; Result: Fix for a critical bug R. Tartler Feature Consistency in Compile-Time–Configurable System Software (April 11, 2011) 8 – 19
Logic Inconsistencies #ifdef CONFIG DISCONTIGMEM MEMORY MODEL // Block 1 static . . . int pfn_to_mid ( . . . ) FLATMEM # ifdef CONFIG NUMA // Block 2 SPARSEMEM NUMA # else DISCONTIGMEM // Block 3 d n e o p s e n d # endif #endif R. Tartler Feature Consistency in Compile-Time–Configurable System Software (April 11, 2011) 9 – 19
Logic Inconsistencies #ifdef CONFIG DISCONTIGMEM MEMORY MODEL // Block 1 static . . . int pfn_to_mid ( . . . ) FLATMEM # ifdef CONFIG NUMA // Block 2 SPARSEMEM NUMA # else DISCONTIGMEM // Block 3 d n e o p s e n d # endif #endif Feature DISCONTIGMEM requires NUMA Inner block is not configuration dependent anymore R. Tartler Feature Consistency in Compile-Time–Configurable System Software (April 11, 2011) 9 – 19
Logic Inconsistencies #ifdef CONFIG DISCONTIGMEM MEMORY MODEL // Block 1 static . . . int pfn_to_mid ( . . . ) FLATMEM # ifdef CONFIG NUMA // Block 2 SPARSEMEM NUMA # else DISCONTIGMEM // Block 3 d n e o p s e n d # endif Logic � #endif Feature DISCONTIGMEM requires NUMA Inner block is not configuration dependent anymore R. Tartler Feature Consistency in Compile-Time–Configurable System Software (April 11, 2011) 9 – 19
Logic Inconsistencies #ifdef CONFIG DISCONTIGMEM MEMORY MODEL // Block 1 static . . . int pfn_to_mid ( . . . ) FLATMEM # ifdef CONFIG NUMA // Block 2 SPARSEMEM NUMA # else DISCONTIGMEM // Block 3 d n e o p s e n d # endif Logic � #endif Feature DISCONTIGMEM requires NUMA Inner block is not configuration dependent anymore Result: code cleanup R. Tartler Feature Consistency in Compile-Time–Configurable System Software (April 11, 2011) 9 – 19
Outline 1. Introduction 2. Analysis 3. Approach and Implementation 4. Results 5. Future Work and Conclusions R. Tartler Feature Consistency in Compile-Time–Configurable System Software (April 11, 2011) 10 – 19
General Approach #ifdef CONFIG DISCONTIGMEM MEMORY MODEL // Block 1 static . . . int pfn_to_mid ( . . . ) # ifdef CONFIG NUMA FLATMEM // Block 2 SPARSEMEM NUMA # else DISCONTIGMEM // Block 3 n d o e p s e n d # endif #endif R. Tartler Feature Consistency in Compile-Time–Configurable System Software (April 11, 2011) 11 – 19
General Approach #ifdef CONFIG DISCONTIGMEM MEMORY MODEL // Block 1 static . . . int pfn_to_mid ( . . . ) # ifdef CONFIG NUMA FLATMEM // Block 2 SPARSEMEM NUMA # else DISCONTIGMEM // Block 3 n d o e p s e n d # endif #endif R. Tartler Feature Consistency in Compile-Time–Configurable System Software (April 11, 2011) 11 – 19
Recommend
More recommend