# Kees Cook details workflow for verifying Linux kernel binary changes

> **Key takeaway:** Kernel developers can use diffoscope and objdump to ensure source code refactoring does not introduce unintended executable changes.

**Published:** 2022-06-24T20:11:48+00:00 
**Source:** Kees Cook (Linux Kernel Security) 
**Category:** pioneer-voices 
**Canonical URL:** https://fosswire.org/news/kees-cook-linux-kernel-security-finding-binary-differences.html 

## Summary
Linux kernel security engineer Kees Cook describes a methodology for verifying that source code changes, specifically when replacing 1-element arrays with flexible array members, do not alter the resulting binary code. The process involves using diffoscope to compare builds and objdump to isolate executable differences. This approach helps identify subtle bugs where structure size calculations might be incorrectly updated during refactoring.

## Verifying refactoring with binary diffing
- Uses **diffoscope** to compare object files between a 'before' and 'after' build.
- Employs specific **KBUILD** flags (e.g., fixed timestamps and user/host info) to ensure reproducible build conditions.
- Utilizes **objdump** with flags like `--disassemble`, `--demangle`, and `--no-show-raw-insn` to inspect the `.text` section without line number noise.
- Identifies potential bugs in size calculations, such as failing to adjust `kmalloc` arguments when moving from `data[1]` to `data[]`.
- Recommends using kernel helpers like **struct_size()** to prevent arithmetic overflows.

## Why it matters
This workflow provides a rigorous way for kernel maintainers to ensure that large-scale code cleanups do not introduce regressions or subtle memory calculation bugs.