FUDCon Pune 2015

Pune, 26th to 28th June, 2015


26th to 28th June, 2015 09:00 am - 06:00 pm

Website: FUDCon Pune 2015


MIT College of Engineering
See map

Subscribe & Share

June 26, 2015, 12:30 pm

spartakus: Fighting kernel ABI breakages through semantic processing of linux source code


I would like to introduce the spartakus project as a possible replacement for genksyms. genksyms is a tool that is currently used by the linux kernel build process to generate CRC checksums for exported kernel symbols that constitute the linux kernel ABI.

spartakus a project that has been forked from upstream sparse. Modifications include addition and modification of some files as mentioned below.

Files added:
1. checksum.h and checksum.c

This contains code taken from genksyms that deals with generation of checksums
for strings.

2. check_kabi.h and check_kabi.c

This contains code that deals with semantic processing of exported kernel
symbols while generating CRC checksums for them.

The following files were modified which were originally part of the sparse
source code:
1. Makefile
2. parse.h and parse.c
3. lib.c
4. tokenize.c

Also a new binary 'check_kabi' upon compilation is added, which can be used during the linux kernel build process to generate the checksums for all the exported symbols. These checksums are stored in Module.symvers file which is generated during the build process.

genksyms has been the tool that had been doing this job of generating the checksums for exported symbols that constitute the kernel ABI so far, but it has several problems/limitations that make the job of developers difficult wrt maintaining the stability of the kernel ABI. A couple of such limitations are as stated below:

1. genksyms generates different checksums for structs/unions for declarations which are semantically similar. For example, for the following 2 declarations for the struct 'list_head':

struct list_head {
struct list_head *next, *prev;

struct list_head {
struct list_head *next;
struct list_head *prev;

both declarations are essentially the same and should not result in a change in kABI wrt 'list_head'.

Sparse treats these 2 declarations as semantically the same and different checksums are not generated.

2. For variable declarations with just unsigned/signed specification with no type specified, sparse considers the type as int by default.


'unsigned foo' is converted to 'unsigned int foo' and then processed to get the corresponding checksum.

On the other hand, genksyms would generate different checksums for different 2 definitions which are semantically the same.


I will touch on the following points during my talk:

* Linux Kernel ABI
- The binary interface exported by the linux kernel and the accompanying modules.
- Module.symvers and CRC checksums for the exported symbols

* Why is kernel ABI stability important and how the kernel ABI stability is maintained currently?
- genksyms
- Limitations of genksyms

* spartakus
- What it is essentially
- Short discussion of the workflow followed to generate the checksums
- How it can provide a better alternative to genksyms
- State of the project and its limitations

* Questions

Hall: D203 [2nd Floor] Track: Main Conference Type: Talk