[RFC PATCH 0/2] livepatch: Clear relocation targets on a module removal

From: Miroslav Benes
Date: Fri Jul 19 2019 - 08:28:45 EST


The second attempt to resolve the issue reported by Josh last year [1]
and also reported earlier this year again [2]. The first attempt [3]
tried to deny the patched modules to be removed. It did not solve the
issue completely. It would be possible, but we decided to try the
arch-specific approach first, which I am sending now.

Sending early as RFC, because I am leaving on holiday tomorrow and it
would be great if you took a look meanwhile.

- I decided not to CC the arch maintainers yet. If we decide that the
approach is feasible first on our livepatch side, I will split the
second patch and resend properly.
- the first patch could go in regardless the rest, I guess.
- I am not sure about the placement in
klp_cleanup_module_patches_limited(). I think it is the best possible,
but I would really appreciate double-checking.
- I am also not sure about the naming, so ideas also welcome

Lightly tested on both x86_64 and ppc64le and it looked ok.

[1] 20180602161151.apuhs2dygsexmcg2@treble
[2] 1561019068-132672-1-git-send-email-cj.chengjian@xxxxxxxxxx
[3] 20180607092949.1706-1-mbenes@xxxxxxx

Miroslav Benes (2):
livepatch: Nullify obj->mod in klp_module_coming()'s error path
livepatch: Clear relocation targets on a module removal

arch/powerpc/kernel/Makefile | 1 +
arch/powerpc/kernel/livepatch.c | 75 +++++++++++++++++++++++++++++++++
arch/powerpc/kernel/module.h | 15 +++++++
arch/powerpc/kernel/module_64.c | 7 +--
arch/x86/kernel/livepatch.c | 67 +++++++++++++++++++++++++++++
include/linux/livepatch.h | 5 +++
kernel/livepatch/core.c | 18 +++++---
7 files changed, 177 insertions(+), 11 deletions(-)
create mode 100644 arch/powerpc/kernel/livepatch.c
create mode 100644 arch/powerpc/kernel/module.h

--
2.22.0