Introduction to spartakus and how it can help fight linux kernel ABI breakages
Jun. 22, 2015•0 likes
2 likes
Be the first to like this
Show More
•1,550 views
views
Total views
0
On Slideshare
0
From embeds
0
Number of embeds
0
Download to read offline
Report
Technology
This talk provides an introduction to spartakus and the linux kernel ABI while trying to highlight how the former could help assure the stability of the latter
Introduction to spartakus and how it can help fight linux kernel ABI breakages
- And how it can help fight linux kernel ABI breakages
Samikshan Bairagya
By,
{#,@}samikshan
Introducing 'spartakus'
Content available under Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
Topics to cover
●
What is kernel ABI
●
Why does kABI matter
●
How to track kABI breakages
●
Static code analysis using genksyms
●
Issues with genksyms
●
Semantic code analysis using sparse (spartakus)
What is ABI?
●
ABI == Application Binary Interface
●
Like API, but at binary level
●
Interface for application to use external library,
OS at binary level.
●
If ABI does not change, applications compiled
against that ABI do not need recompilation
Why strive for kABI stability
● kABI instability does not provide a welcoming
third party environment to the hardware
manufacturers
● Stable kABI means
– Third party modules don't break and recompilation
against the changed ABI won't be needed
– Specially important for enterprise Linux vendors
How to track kernel ABI
● ABI checksum information (modversions) for
exported kernel symbols
– Information stored in Module.symvers file
– Generated during kernel build process using genksyms
genksyms
●
Generates checksums for exported kernel
symbols during build process
●
Static code analysis
●
Part of the linux kernel source code
●
tools/genksyms/
genksyms - issues
Strict string processing of kernel symbol
definition prototypes leads to false positives at
times
genksyms generates different checksums for
structs/unions for declarations which are
semantically same
genksyms – issues (contd)
genksyms – issues (contd)
● 2 semantically same
struct declarations
should not lead to a
change in kABI
● But due to strict string
processing in genksyms,
checksums generated
for these 2 declarations
are different
struct list_head {
struct list_head *next,
*prev;
};
struct list_head {
struct list_head *next;
struct list_head *prev;
};
Misleading checksums generated for variables specified as
unsigned/signed of no particular data type.
●
Both declarations above are semantically similar
●
genksyms fails to identify this
genksyms – issues (contd)
'unsigned foo' and 'unsigned int foo'
Using spartakus to generate checksums through semantic
processing of source code eliminates such issues
●
‘unsigned foo’ is converted to ‘unsigned int foo’ and
then processed to get the corresponding checksum
●
Semantically similar struct/union declarations are
treated as same and different checksums are not
generated
Wait, but what is spartakus?
●
A fork of sparse
– 'semantic parser of source files
– creates a semantic parse tree for further
analysis
●
Provides additional binary 'check_kabi'
– Generates checksums for exported kernel
symbols like genksyms during kernel build
time