|
Packit Service |
80a84b |
## Synopsis
|
|
Packit Service |
80a84b |
|
|
Packit Service |
80a84b |
The aim of **kabi-dw** is to detect any changes in the ABI between the successive builds of the Linux kernel.
|
|
Packit Service |
80a84b |
This is done by dumping the DWARF type information (the .debug\_info section) for the specific symbols into the text files and later comparing the text files.
|
|
Packit Service |
80a84b |
|
|
Packit Service |
80a84b |
## Example
|
|
Packit Service |
80a84b |
|
|
Packit Service |
80a84b |
Build your kernel with CONFIG\_DEBUG\_INFO set:
|
|
Packit Service |
80a84b |
|
|
Packit Service |
80a84b |
```
|
|
Packit Service |
80a84b |
git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
|
|
Packit Service |
80a84b |
cd linux && git checkout v4.5
|
|
Packit Service |
80a84b |
make allyesconfig
|
|
Packit Service |
80a84b |
make
|
|
Packit Service |
80a84b |
```
|
|
Packit Service |
80a84b |
|
|
Packit Service |
80a84b |
Get all the modules *and* vmlinux into single directory
|
|
Packit Service |
80a84b |
|
|
Packit Service |
80a84b |
```
|
|
Packit Service |
80a84b |
make modules_install && cp vmlinux /usr/lib/modules/4.5.0
|
|
Packit Service |
80a84b |
```
|
|
Packit Service |
80a84b |
|
|
Packit Service |
80a84b |
... build another kernel you want to compare to, lets say v4.6.
|
|
Packit Service |
80a84b |
|
|
Packit Service |
80a84b |
Build a list of symbols you want to monitor:
|
|
Packit Service |
80a84b |
|
|
Packit Service |
80a84b |
~~~
|
|
Packit Service |
80a84b |
cat > symbols << EOF
|
|
Packit Service |
80a84b |
init_task
|
|
Packit Service |
80a84b |
schedule
|
|
Packit Service |
80a84b |
dev_queue_xmit
|
|
Packit Service |
80a84b |
__kmalloc
|
|
Packit Service |
80a84b |
printk
|
|
Packit Service |
80a84b |
EOF
|
|
Packit Service |
80a84b |
~~~
|
|
Packit Service |
80a84b |
|
|
Packit Service |
80a84b |
Generate the type information for both kernels based on the current whitelist
|
|
Packit Service |
80a84b |
|
|
Packit Service |
80a84b |
~~~
|
|
Packit Service |
80a84b |
./kabi-dw generate -s symbols -o kabi-4.5 /usr/lib/modules/4.5.0
|
|
Packit Service |
80a84b |
./kabi-dw generate -s symbols -o kabi-4.6 /usr/lib/modules/4.6.0
|
|
Packit Service |
80a84b |
~~~
|
|
Packit Service |
80a84b |
|
|
Packit Service |
80a84b |
Compare the two type dumps:
|
|
Packit Service |
80a84b |
|
|
Packit Service |
80a84b |
~~~
|
|
Packit Service |
80a84b |
./kabi-dw compare kabi-4.5 kabi-4.6
|
|
Packit Service |
80a84b |
~~~
|
|
Packit Service |
80a84b |
|
|
Packit Service |
80a84b |
## Motivation
|
|
Packit Service |
80a84b |
|
|
Packit Service |
80a84b |
Traditionally Unix System V had a stable ABI to allow external modules to work with the OS kernel without a recompilation called Device Driver Interface.
|
|
Packit Service |
80a84b |
Linux however never developed such stable kernel ABI. Therefore it's vital to monitor all kernel interfaces used by the external module for change, and if such change happens, the module needs to be recompiled.
|
|
Packit Service |
80a84b |
|
|
Packit Service |
80a84b |
Linux has an option (CONFIG\_MODVERSIONS) to generate a checksum identifying all exported symbols through the EXPORT\_SYMBOL() macro. But these checksum are not sufficient to actually identify the scope of the change. For example changing a couple of unused padding bits in a structure to a new field won't break any external modules, but such change changes the checksum of any function which receives such structure through its arguments.
|
|
Packit Service |
80a84b |
|
|
Packit Service |
80a84b |
## Installation
|
|
Packit Service |
80a84b |
|
|
Packit Service |
80a84b |
This program needs elfutils installed. Check out your distribution to figure out how to install elfutils.
|
|
Packit Service |
80a84b |
|
|
Packit Service |
80a84b |
For *Fedora* and *CentOS 7* systems:
|
|
Packit Service |
80a84b |
~~~
|
|
Packit Service |
80a84b |
dnf install kabi-dw
|
|
Packit Service |
80a84b |
~~~
|
|
Packit Service |
80a84b |
|
|
Packit Service |
80a84b |
For *Ubuntu* systems, you need to compile it. Install the dependencies:
|
|
Packit Service |
80a84b |
~~~
|
|
Packit Service |
80a84b |
sudo apt-get install elfutils
|
|
Packit Service |
80a84b |
~~~
|
|
Packit Service |
80a84b |
|
|
Packit Service |
80a84b |
Then just make and run:
|
|
Packit Service |
80a84b |
~~~
|
|
Packit Service |
80a84b |
make
|
|
Packit Service |
80a84b |
./kabi-dw
|
|
Packit Service |
80a84b |
~~~
|
|
Packit Service |
80a84b |
|
|
Packit Service |
80a84b |
## Contributors
|
|
Packit Service |
80a84b |
|
|
Packit Service |
80a84b |
Developed by Stanislav Kozina, Red Hat, Inc. with the help of others.
|
|
Packit Service |
80a84b |
|
|
Packit Service |
80a84b |
## License
|
|
Packit Service |
80a84b |
|
|
Packit Service |
80a84b |
This program is free software: you can redistribute it and/or modify
|
|
Packit Service |
80a84b |
it under the terms of the GNU General Public License as published by
|
|
Packit Service |
80a84b |
the Free Software Foundation, either version 3 of the License, or
|
|
Packit Service |
80a84b |
(at your option) any later version.
|