[PATCH 02/10] mm: Export copy_to_kernel_nofault()

Tetsuo Handa penguin-kernel at I-love.SAKURA.ne.jp
Wed Nov 2 17:10:17 UTC 2022


LSM modules which can be loaded using /sbin/insmod need to be able to
modify security_hook_heads. Since security_hook_heads might be read-only
due to being marked as __lsm_ro_after_init, and writing to read-only memory
crashes the kernel, such LSM modules need to test whether memory pages
containing security_hook_heads is read-only.

Signed-off-by: Tetsuo Handa <penguin-kernel at I-love.SAKURA.ne.jp>
---
 mm/maccess.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/mm/maccess.c b/mm/maccess.c
index 5f4d240f67ec..f75447b13034 100644
--- a/mm/maccess.c
+++ b/mm/maccess.c
@@ -75,6 +75,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)
 {
-- 
2.18.4



More information about the Linux-security-module-archive mailing list