]> git.baikalelectronics.ru Git - kernel.git/commit
powerpc/module_32: Fix livepatching for RO modules
authorChristophe Leroy <christophe.leroy@csgroup.eu>
Mon, 20 Dec 2021 16:38:09 +0000 (16:38 +0000)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 7 Feb 2022 10:03:10 +0000 (21:03 +1100)
commit93831818700a554522f53a17e6ae485efc7d90ff
treeae8d5dad0bc24beac98210cd8ce1e99846c49e3c
parent73b0f6113429cc438aa4bc7a76d85d9e1701285d
powerpc/module_32: Fix livepatching for RO modules

Livepatching a loaded module involves applying relocations through
apply_relocate_add(), which attempts to write to read-only memory when
CONFIG_STRICT_MODULE_RWX=y.

R_PPC_ADDR16_LO, R_PPC_ADDR16_HI, R_PPC_ADDR16_HA and R_PPC_REL24 are
the types generated by the kpatch-build userspace tool or klp-convert
kernel tree observed applying a relocation to a post-init module.

Use patch_instruction() to patch those relocations.

Commit fa8ec6c773d7 ("powerpc/module_64: Fix livepatching for
RO modules") did similar change in module_64.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Acked-by: Joe Lawrence <joe.lawrence@redhat.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/d5697157cb7dba3927e19aa17c915a83bc550bb2.1640017960.git.christophe.leroy@csgroup.eu
arch/powerpc/kernel/module_32.c