fs/proc/kcore.c: Add bounce buffer for ktext data
Changes
1 files changed · +6 −1
| File | Status | Add | Del | Content |
|---|---|---|---|---|
| fs/proc/kcore.c | modified | +6 | −1 | View file |
fs/proc/kcore.c
View filediff --git a/fs/proc/kcore.c b/fs/proc/kcore.c
index bd3ac9d..5c89a07 100644
--- a/fs/proc/kcore.c
+++ b/fs/proc/kcore.c
@@ -509,7 +509,12 @@ read_kcore(struct file *file, char __user *buffer, size_t buflen, loff_t *fpos)
if (kern_addr_valid(start)) {
unsigned long n;
- n = copy_to_user(buffer, (char *)start, tsz);
+ /*
+ * Using bounce buffer to bypass the
+ * hardened user copy kernel text checks.
+ */
+ memcpy(buf, (char *) start, tsz);
+ n = copy_to_user(buffer, buf, tsz);
/*
* We cannot distinguish between fault on source
* and fault on destination. When this happens