SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.
SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.
Successfully reported this slideshow.
Activate your 14 day free trial to unlock unlimited reading.
Introduction to spartakus and how it can help fight linux kernel ABI breakages
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
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
1.
- 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)
2.
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)
3.
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
4.
Linux kernel ABI?
Binary interface exported by linux kernel and
accompanying kernel modules
6.
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
7.
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
9.
genksyms
●
Generates checksums for exported kernel
symbols during build process
●
Static code analysis
●
Part of the linux kernel source code
●
tools/genksyms/
10.
genksyms - issues
Strict string processing of kernel symbol
definition prototypes leads to false positives at
times
11.
genksyms generates different checksums for
structs/unions for declarations which are
semantically same
genksyms – issues (contd)
12.
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;
};
13.
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'
14.
Possible solution?
spartakus - Using sparse for semantic processing
of linux source code
15.
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
16.
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