[PATCH/RFC 1/4] maccess: add weak attribute to probe_kernel_write

From: Heiko Carstens
Date: Tue Jun 02 2009 - 07:05:53 EST


From: Heiko Carstens <heiko.carstens@xxxxxxxxxx>

probe_kernel_write() gets used to write to the kernel address space.
E.g. to patch the kernel (kgdb, ftrace, kprobes...). Some architectures
however enable write protection for the kernel text section, so that
writes to this region would fault.
This patch allows to specify an architecture specific version of
probe_kernel_write() which allows to handle and bypass write protection
of the text segment.
That way it is still possible to catch random writes to kernel text
and explicitly allow writes via this interface.

Signed-off-by: Heiko Carstens <heiko.carstens@xxxxxxxxxx>
---

mm/maccess.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff -urpN linux-2.6/mm/maccess.c linux-2.6-patched/mm/maccess.c
--- linux-2.6/mm/maccess.c 2009-03-24 00:12:14.000000000 +0100
+++ linux-2.6-patched/mm/maccess.c 2009-06-02 10:40:04.000000000 +0200
@@ -39,7 +39,7 @@ EXPORT_SYMBOL_GPL(probe_kernel_read);
* Safely write to address @dst from the buffer at @src. If a kernel fault
* happens, handle that and return -EFAULT.
*/
-long probe_kernel_write(void *dst, void *src, size_t size)
+long notrace __weak probe_kernel_write(void *dst, void *src, size_t size)
{
long ret;
mm_segment_t old_fs = get_fs();

--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/