History log of /linux/tools/objtool/Documentation/klp-test-design.txt (Results 1 – 4 of 4)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 5b6dca02 21-Oct-2026 Linus Torvalds <torvalds@linux-foundation.org>

Merge tag 'objtool-core-2026-10-18' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull objtool updates from Ingo Molnar:

- Add unit test suite for objtool klp functionality and
known

Merge tag 'objtool-core-2026-10-18' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull objtool updates from Ingo Molnar:

- Add unit test suite for objtool klp functionality and
known failure modes (by Song Liu and Puranjay Mohan,
with fixes by Joe Lawrence)

* tag 'objtool-core-2026-10-18' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (58 commits)
objtool/klp: Add test for ThinLTO symbols sharing a demangled name
objtool/klp: Add test for Clang switch jump tables
objtool/klp: Add test for UBSAN metadata in an unchanged function
objtool/klp: Add test for absolute and __ADDRESSABLE symbols
objtool/klp: Add test for a patch which strips a data annotation
objtool/klp: Add test for the alignment of cloned data sections
objtool/klp: Add test for alternative replacement code in checksums
objtool/klp: Add test for instruction operand checksums
objtool/klp: Add test for a static call introduced by the patch
objtool/klp: Add test for tracepoint and pr_debug static branch keys
objtool/klp: Add test for a static branch introduced by the patch
objtool/klp: Add test for symbols with no checksum entry of their own
objtool/klp: Add test for data object checksums
objtool/klp: Test text annotations on alternative replacements
objtool/klp: Test a hand-built livepatch module's static call keys
objtool/klp: Test rejection of a file-local static branch key
objtool/klp: Add test for symbols whose linkage the patch changes
objtool/klp: Add test for kCFI prefix symbols and traps
objtool/klp: Add test for __bug_table, __ex_table and __mcount_loc extraction
objtool/klp: Add test for static locals which must not be correlated
...

show more ...


Revision tags: v7.3, v7.3-rc7, v7.3-rc6, v7.3-rc5, v7.3-rc4
# 913bf39f 16-Sep-2026 Joe Lawrence <joe.lawrence@redhat.com>

objtool: Forward toolchain variables to the klp test runner

The tests target already passes ARCH and CROSS_COMPILE into
run-tests.sh. lib.sh uses those to pick a default compiler and
binutils:

C

objtool: Forward toolchain variables to the klp test runner

The tests target already passes ARCH and CROSS_COMPILE into
run-tests.sh. lib.sh uses those to pick a default compiler and
binutils:

CC=${CC:-${CROSS_COMPILE}gcc}
LD=${LD:-${CROSS_COMPILE}ld}
READELF=${READELF:-${CROSS_COMPILE}readelf}
OBJCOPY=${OBJCOPY:-${CROSS_COMPILE}objcopy}

Those defaults only apply when the variables reach the shell that sources
lib.sh. The recipe passed OBJTOOL, ARCH and CROSS_COMPILE explicitly, but
not CC or the binutils. Makefile-assigned values (e.g. from LLVM=1) are
not visible in the recipe environment unless forwarded:

$ LLVM=1 make -C tools/objtool tests
...
# preflight
# compiler gcc (GCC) ...

Pass CC, LD, READELF and OBJCOPY the same way as ARCH and CROSS_COMPILE,
so fixtures are built and inspected with the toolchain make selected:

$ LLVM=1 make -C tools/objtool tests
...
# preflight
# compiler clang version 21.1.8 ...

Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
Signed-off-by: Song Liu <song@kernel.org>
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Assisted-by: Claude:claude-opus-5
Link: https://patch.msgid.link/20260916184351.2720310-12-song@kernel.org

show more ...


# 9b11acaa 16-Sep-2026 Joe Lawrence <joe.lawrence@redhat.com>

objtool: Keep failing test workdirs by default

The klp test runner deletes each test's working directory when the test
finishes. On failure that removes diff.log, out.o and the fixture objects
befo

objtool: Keep failing test workdirs by default

The klp test runner deletes each test's working directory when the test
finishes. On failure that removes diff.log, out.o and the fixture objects
before the developer can look at them, and the only hint was to re-run
(something) with --keep:

$ make -C tools/objtool tests
...
not ok - test-special-section: expected section '.kcfi_traps' in output
...
# pass:49 fail:1 static-skip:1 probe-skip:0 xfail:0 xpass:0
# re-run with --keep to hold on to what a failing test built

Change the default behavior to save failing test working directories. This
is friendlier to the drive-by tester. Provide the power-user with a KEEP
Makefile variable that can optionally retain 'all' or 'none' of those
directories. run-tests.sh --keep remains an alias for KEEP=all.

Now that a run can be holding objects worth looking at, say where they are
when it is cut short. A Ctrl-C left the run directory behind -- the tests
clean up after themselves as they exit, but the two levels the runner made
are its own to answer for, and nothing removed them. Take them away from
a trap if the tests left them empty, and print the path if they did not:
under the new default the test that was running keeps what it had built,
and that is the run most worth being told about.

The trap only ever rmdirs, so it cannot overrule what a test decided to
keep; the same helper now serves the end of a normal run.

Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
Signed-off-by: Song Liu <song@kernel.org>
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Assisted-by: Claude:claude-opus-5
Link: https://patch.msgid.link/20260916184351.2720310-11-song@kernel.org

show more ...


# 2ab23a58 16-Sep-2026 Song Liu <song@kernel.org>

objtool/klp: Document the klp test harness

Two documents, for two different readers.

klp-test-design.txt is for someone deciding whether to trust the suite or
change it: what makes unit tests possi

objtool/klp: Document the klp test harness

Two documents, for two different readers.

klp-test-design.txt is for someone deciding whether to trust the suite or
change it: what makes unit tests possible for a pipeline that normally
needs two kernel builds (objtool has no configuration-dependent logic, so a
test reproduces a configuration by reproducing its input), how tests are
selected per architecture, and what the outcome classification is for.

klp-write-tests.txt is the procedure for adding one, and is written to be
handed to someone -- or something -- with the instruction "follow this and
write a test for commit <sha>", or "port the case at <location> from
another harness". It leads with the rule that matters: a test is not
finished until you have watched it fail with the code broken. Then the
traps, each of which this suite has already fallen into -- a fixture the
compiler optimised away, a named char[] which never reaches the string path
because that keys on SHF_STRINGS, per-function sections hiding the movement
a test was about.

Some of this was previously written as comments in lib.sh. That was the
wrong place: guidance on how to write a test is read once by an author,
while every comment in the harness is read by everyone who opens it.
Explanations of why the code is as it is stay where they were.

Signed-off-by: Song Liu <song@kernel.org>
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Assisted-by: Claude:claude-opus-5
Link: https://patch.msgid.link/20260916184351.2720310-10-song@kernel.org

show more ...