The commit is pushed to "branch-rh10-6.12.0-55.13.1.vz10.2.x-ovz" and will appear at g...@bitbucket.org:openvz/vzkernel.git after rh10-6.12.0-55.13.1.el10 ------> commit 265199352a9f5a232d32e7d0677b38ff2248a9f6 Author: Pavel Tikhomirov <ptikhomi...@virtuozzo.com> Date: Tue Aug 12 16:01:54 2025 +0800
readykernel: export symbols to be able to livepatch kfree/kvfree replacement We can't just use normal readykernel patching for kfree/kvfree, as the counterpart with kmalloc/kvmalloc might've allocated non-continious memory and that memory should not be freed with kfree even after readykernel patch was unloaded. So the idea is to make the kfree/kvfree change permanent. For that we need to export: kallsyms_lookup_name, set_memory_ro, set_memory_rw, find_module and copy_to_kernel_nofault. So let's export them to be able to do this trick in future. See prototype implementation here: https://bitbucket.org/openvz/kpatch/branch/vz9-fuse_kio_pcs-kvfree-prototype 85fc534 ("fuse_kio_pcs: Permanently replace kfree with kvfree in pcs_umem_release") 874c2a8 ("Add kpatch_replace_call helper to manualy replace kernel function calls") https://virtuozzo.atlassian.net/browse/RK-536 Signed-off-by: Pavel Tikhomirov <ptikhomi...@virtuozzo.com> Feature: ReadyKernel --- arch/arm/mm/pageattr.c | 2 ++ kernel/kallsyms.c | 1 + kernel/module/main.c | 1 + mm/maccess.c | 1 + 4 files changed, 5 insertions(+) diff --git a/arch/arm/mm/pageattr.c b/arch/arm/mm/pageattr.c index 064ad508c149d..629d3b63cf3df 100644 --- a/arch/arm/mm/pageattr.c +++ b/arch/arm/mm/pageattr.c @@ -76,6 +76,7 @@ int set_memory_ro(unsigned long addr, int numpages) __pgprot(L_PTE_RDONLY), __pgprot(0)); } +EXPORT_SYMBOL_GPL(set_memory_ro); int set_memory_rw(unsigned long addr, int numpages) { @@ -83,6 +84,7 @@ int set_memory_rw(unsigned long addr, int numpages) __pgprot(0), __pgprot(L_PTE_RDONLY)); } +EXPORT_SYMBOL_GPL(set_memory_rw); int set_memory_nx(unsigned long addr, int numpages) { diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c index a9a0ca605d4a8..2d1f3d1276a19 100644 --- a/kernel/kallsyms.c +++ b/kernel/kallsyms.c @@ -242,6 +242,7 @@ unsigned long kallsyms_lookup_name(const char *name) return module_kallsyms_lookup_name(name); } +EXPORT_SYMBOL_GPL(kallsyms_lookup_name); /* * Iterate over all symbols in vmlinux. For symbols from modules use diff --git a/kernel/module/main.c b/kernel/module/main.c index 974e44d94629e..d755a7eb461a0 100644 --- a/kernel/module/main.c +++ b/kernel/module/main.c @@ -368,6 +368,7 @@ struct module *find_module(const char *name) { return find_module_all(name, strlen(name), false); } +EXPORT_SYMBOL_GPL(find_module); #ifdef CONFIG_SMP diff --git a/mm/maccess.c b/mm/maccess.c index 518a25667323e..ec180d956547f 100644 --- a/mm/maccess.c +++ b/mm/maccess.c @@ -76,6 +76,7 @@ long copy_to_kernel_nofault(void *dst, const void *src, size_t size) pagefault_enable(); return -EFAULT; } +EXPORT_SYMBOL_GPL(copy_to_kernel_nofault); long strncpy_from_kernel_nofault(char *dst, const void *unsafe_addr, long count) { _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel