[PATCH] Adds vm_operations_struct.access to vm_ops, allowing access via ptrace (and thus, gdb) and /dev/mem
Markus Dreseler
pmfs at dreseler.de
Fri Mar 21 11:19:21 EDT 2014
Exporting generic_access_phys is already in the linux sources as of
1d1fdd95df681f0c065d90ffaafa215a0e8825e2.
VM_IO was added so that get_user_pages uses vm_ops.access.
---
fs/pmfs/xip.c | 8 +++++++-
mm/memory.c | 1 +
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/fs/pmfs/xip.c b/fs/pmfs/xip.c
index c7471be..f29f6f5 100644
--- a/fs/pmfs/xip.c
+++ b/fs/pmfs/xip.c
@@ -643,10 +643,16 @@ static int pmfs_xip_file_hpage_fault(struct
vm_area_struct *vma,
static const struct vm_operations_struct pmfs_xip_vm_ops = {
.fault = pmfs_xip_file_fault,
+ #ifdef CONFIG_HAVE_IOREMAP_PROT
+ .access = generic_access_phys,
+ #endif
};
static const struct vm_operations_struct pmfs_xip_hpage_vm_ops = {
.fault = pmfs_xip_file_hpage_fault,
+ #ifdef CONFIG_HAVE_IOREMAP_PROT
+ .access = generic_access_phys,
+ #endif
};
static inline int pmfs_has_huge_mmap(struct super_block *sb)
@@ -664,7 +670,7 @@ int pmfs_xip_file_mmap(struct file *file, struct
vm_area_struct *vma)
file_accessed(file);
- vma->vm_flags |= VM_MIXEDMAP;
+ vma->vm_flags |= (VM_MIXEDMAP | VM_IO);
block_sz = pmfs_data_block_size(vma, vma->vm_start, 0);
if (pmfs_has_huge_mmap(file->f_mapping->host->i_sb) &&
diff --git a/mm/memory.c b/mm/memory.c
index 6e91ac7..45ba28e 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -4248,6 +4248,7 @@ int generic_access_phys(struct vm_area_struct
*vma, unsigned long addr,
return len;
}
+EXPORT_SYMBOL_GPL(generic_access_phys);
#endif
/*
--
1.7.9.5
More information about the Linux-pmfs
mailing list