Skip to content

livepatch, module: Delete the associated module of disabled livepatch

Yafang Shao linux-modules live-patching 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest2 patches 20 repliesIn review

Changes from the cover letter

- v1->v2:
- Avoid using kpatch utility in the example (Joe, Petr)
- Fix race around changing mod->state (Joe, Petr)
- Don't set mod->state outside of kernel/module dir (Joe, Petr)
- Alter selftests accordingly (Joe)
- Split it into two patches (Petr, Miroslav)
- Don't delete module from the path klp_enable_patch() (Petr, Miroslav)
- Make delete_module() safe (Petr)

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2module: Add a new helper delete_module()include/linux/module.h kernel/module/main.c+65 -185 replies
2/2livepatch: Delete the associated module of disabled livepatchkernel/livepatch/core.c tools/testing/selftests/livepatch/functions.sh tools/testing/selftests/livepatch/test-callbacks.sh +5 more+30 -5014 replies

Reviews trailers per patch

None of the 2 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchJoe Lawrence
SeriesA-b
1/2
2/2

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/2] livepatch, module: Delete the associated module of disabled livepatch

In our production environment, upon loading a new atomic replace livepatch, we encountered an issue where the kernel module of the old livepatch remained, despite being replaced by the new one. The detailed steps to reproduce that issue can be found in patch #2.

Detecting which livepatch will be replaced by the new one from userspace is not reliable, necessitating the need for the operation to be performed within the kernel itself.

This patchset aims to address this issue by automatically deleting the associated module of a disabled livepatch. Since a disabled livepatch can't be enabled again and the kernel module becomes redundant, it is safe to remove it in this manner.

Changes:
- v1->v2:
- Avoid using kpatch utility in the example (Joe, Petr)
- Fix race around changing mod->state (Joe, Petr)
- Don't set mod->state outside of kernel/module dir (Joe, Petr)
- Alter selftests accordingly (Joe)
- Split it into two patches (Petr, Miroslav)
- Don't delete module from the path klp_enable_patch() (Petr, Miroslav)
- Make delete_module() safe (Petr)

Yafang Shao (2):
module: Add a new helper delete_module()
livepatch: Delete the associated module of disabled livepatch

 include/linux/module.h                        |  1 +
 kernel/livepatch/core.c                       | 16 ++--
 kernel/module/main.c                          | 82 +++++++++++++++----
 .../testing/selftests/livepatch/functions.sh  |  2 +
 .../selftests/livepatch/test-callbacks.sh     | 24 ++----
 .../selftests/livepatch/test-ftrace.sh        |  3 +-
 .../selftests/livepatch/test-livepatch.sh     | 11 +--
 .../testing/selftests/livepatch/test-state.sh | 15 +---
 .../selftests/livepatch/test-syscall.sh       |  3 +-
 .../testing/selftests/livepatch/test-sysfs.sh |  6 +-
 10 files changed, 95 insertions(+), 68 deletions(-)
Signature · 1 line
2.39.1