diff mbox

[RFC,2/9] mm: Implement generic support for revoking a mapping.

Message ID m1iqlb75vg.fsf@fess.ebiederm.org
State RFC, archived
Headers show

Commit Message

Eric W. Biederman April 11, 2009, 12:05 p.m. UTC
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
 include/linux/mm.h |    2 ++
 mm/memory.c        |    9 +++++++++
 2 files changed, 11 insertions(+), 0 deletions(-)
diff mbox

Patch

diff --git a/include/linux/mm.h b/include/linux/mm.h
index 96d8342..3fcbb8e 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -807,6 +807,8 @@  static inline void unmap_shared_mapping_range(struct address_space *mapping,
 
 extern int vmtruncate(struct inode * inode, loff_t offset);
 extern int vmtruncate_range(struct inode * inode, loff_t offset, loff_t end);
+
+extern struct vm_operations_struct revoked_vm_ops;
 extern void remap_file_mappings(struct file *file, struct vm_operations_struct *vm_ops);
 
 #ifdef CONFIG_MMU
diff --git a/mm/memory.c b/mm/memory.c
index dcd0a3c..f68c84e 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -2378,6 +2378,15 @@  out:
 	spin_lock(&mapping->i_mmap_lock);
 }
 
+static int revoked_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
+{
+	return VM_FAULT_SIGBUS;
+}
+
+struct vm_operations_struct revoked_vm_ops = {
+	.fault	= revoked_fault,
+};
+
 void remap_file_mappings(struct file *file, struct vm_operations_struct *vm_ops)
 {
 	/* After file->f_ops has been changed update the vmas */