A modular tool that automates git bisect to find commits that introduced kernel regressions. It supports bisecting both git source trees and lists of pre-built kernel RPMs, with two execution modes: local (using CRIU checkpoint/restore for reboots) and remote (over SSH).
The tool is composed of:
- kab.sh - Main orchestrator that drives the
git bisectloop. - lib.sh - Core library with configuration loading, logging, command execution (
run_cmd), reboot management, CRIU setup, and kdump setup. - criu-daemon.sh - Daemon that handles CRIU checkpoint/restore cycles for local execution. It checkpoints the bisect process before a reboot or kernel panic, then restores it after the system comes back.
- bisect.conf - Configuration file defining strategies and parameters.
- reproducer.sh - Template for user-provided test scripts.
- handlers/ - Pluggable strategy handlers:
install_handler.sh- Kernel installation (from git source or RPM).reboot_handler.sh- Reboot strategies (full reboot or kexec).test_handler.sh- Test execution (kernel panic verification or simple exit-code test).
- Initialize: Load configuration and handlers, set up CRIU and kdump (if using panic test strategy), clone the git repo (or generate a fake git repo from an RPM list).
- Verify: Optionally verify that the GOOD commit actually passes and the BAD commit actually fails.
- Bisect loop: For each commit selected by
git bisect:- Install: Build and install the kernel from source, or install from RPM.
- Reboot: Boot into the new kernel (via CRIU checkpoint/restore locally, or via SSH remotely).
- Test: Run the reproducer script. For panic mode, trigger a kernel panic and verify vmcore creation. For simple mode, check the exit code.
- Mark: Run
git bisect goodorgit bisect badbased on the test result.
- Finish: Generate a final bisect log and reboot to the original kernel.
When no KAB_TEST_HOST is configured, the tool runs directly on the test machine. It uses CRIU to checkpoint the bisect process before rebooting or triggering a kernel panic, then restores it after the system comes back. A crontab entry ensures the CRIU daemon starts on every boot.
When KAB_TEST_HOST is set, kab.sh runs on a controller machine and executes all commands on the remote test host over SSH. Reboots are handled by waiting for the remote host to go down and come back up. This avoids the need for CRIU.
- A RHEL-based system (Fedora, CentOS, RHEL) that uses
grubbyfor managing boot entries. - For local (CRIU) mode:
criuandcroniepackages. - For git source bisection: kernel build dependencies (
gcc,make,flex,bison,openssl-devel, etc.). - For panic test strategy:
kexec-tools(kdump) configured withcrashkernelparameter. - For remote mode: SSH access to the test host (password-less or key-based).
sudo make installThis installs scripts to /usr/local/bin/kernel-auto-bisect/ and copies the default configuration file.
To uninstall:
sudo make uninstallEdit /usr/local/bin/kernel-auto-bisect/bisect.conf after installation.
| Variable | Values | Description |
|---|---|---|
INSTALL_STRATEGY |
git, rpm |
Build from source or install pre-built RPMs |
TEST_STRATEGY |
panic, simple |
Trigger kernel panic and verify vmcore, or just check exit code |
REBOOT_STRATEGY |
reboot, kexec |
Full reboot or kexec (kexec falls back to full reboot with CRIU) |
| Variable | Description |
|---|---|
GIT_REPO_URL |
URL of the kernel git repository to clone |
GIT_REPO_BRANCH |
Branch to clone |
GOOD_COMMIT |
Git commit hash of the known-good commit |
BAD_COMMIT |
Git commit hash of the known-bad commit |
MAKE_JOBS |
Number of parallel make jobs (defaults to nproc) |
| Variable | Description |
|---|---|
KERNEL_RPM_LIST |
Path to a file listing kernel RPM URLs, one per line (ordered from good to bad) |
RPM_CACHE_DIR |
Directory to cache downloaded RPMs |
GOOD_COMMIT |
Kernel release string of the known-good version (e.g. 5.14.0-162.el9.aarch64) |
BAD_COMMIT |
Kernel release string of the known-bad version |
| Variable | Description |
|---|---|
KAB_TEST_HOST |
SSH target for the remote test host (e.g. root@192.168.1.100) |
KAB_TEST_HOST_SSH_KEY |
Path to SSH private key for authentication (optional) |
| Variable | Description |
|---|---|
REPRODUCER_SCRIPT |
Path to the reproducer script |
RUNS_PER_COMMIT |
Number of test runs per commit (for intermittent issues, default: 1) |
VERIFY_COMMITS |
Set to yes to skip initial good/bad commit verification |
The reproducer script must define the following bash functions:
setup_test()- Called before triggering a kernel panic. Use it to load modules, start services, etc. Only used inpanictest strategy.on_test()- Called after reboot to verify the test result. Return 0 for GOOD (commit is OK), non-zero for BAD (commit has the regression).
See reproducer.sh for a template.
sudo /usr/local/bin/kernel-auto-bisect/kab.shProgress is logged to /var/local/kernel-auto-bisect/main.log. The final bisect log is saved to /var/local/kernel-auto-bisect/bisect_final_log.txt.
The project uses tmt for integration testing and ShellSpec for unit tests. Three test plans are provided:
- criu (
plans/criu.fmf) - Single-machine test using CRIU checkpoint/restore with RPM bisection. - ssh (
plans/ssh.fmf) - Two-machine test (client/server) using SSH with RPM bisection. - ssh_src (
plans/ssh_src.fmf) - Two-machine test using SSH with git source bisection.
Run all tests:
make testsIndividual targets:
make format-check # Check formatting with shfmt
make static-analysis # Run shellcheck
make integration-tests # Run tmt integration testsRuntime state is stored in /var/local/kernel-auto-bisect/:
main.log- Main bisect logcriu-daemon.log- CRIU daemon loggit_repo/- Git repository (real or generated from RPM list)dump/- CRIU checkpoint datadump_logs/- CRIU dump/restore logssignal/- IPC signal files between kab.sh and criu-daemon.shbisect_final_log.txt- Finalgit bisect logoutput
See the LICENSE file.