]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
livepatch/klp-build: support patches that add/remove files
authorJoe Lawrence <joe.lawrence@redhat.com>
Tue, 10 Mar 2026 20:37:42 +0000 (16:37 -0400)
committerJosh Poimboeuf <jpoimboe@kernel.org>
Mon, 16 Mar 2026 19:46:48 +0000 (12:46 -0700)
commit757bd10ff0f015d83481d39a266eb752dbbfce33
treea8f3b61910f47a300532b966fd60bfb0c12ed717
parent4b57e97be22fb8332d05ee1d0fe3c0dd43c828bf
livepatch/klp-build: support patches that add/remove files

The klp-build script prepares a clean patch by populating two temporary
directories ('a' and 'b') with source files and diffing the result.
However, this process fails when a patch introduces a new source file,
as the script attempts to copy files that do not yet exist in the
original source tree.  Likewise, it fails when a patch removes a source
file and the script attempts to copy a file that no longer exists.

Refactor the file-gathering logic to distinguish between original input
files and patched output files:

- Split get_patch_files() into get_patch_input_files() and
  get_patch_output_files() to identify which files exist before and
  after patch application.
- Filter out "/dev/null" from both to handle file creation/deletion.
- Update refresh_patch() to only copy existing input files to the 'a'
  directory and the resulting output files to the 'b' directory.

Acked-by: Song Liu <song@kernel.org>
Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
Link: https://patch.msgid.link/20260310203751.1479229-4-joe.lawrence@redhat.com
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
scripts/livepatch/klp-build