lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <4E749003.30909@gmail.com>
Date:	Sat, 17 Sep 2011 14:18:11 +0200
From:	Marco Stornelli <marco.stornelli@...il.com>
To:	Linux FS Devel <linux-fsdevel@...r.kernel.org>
CC:	Linux Kernel <linux-kernel@...r.kernel.org>
Subject: [PATCH] xip: export xip_file_fault

From: Marco Stornelli <marco.stornelli@...il.com>

There aren't sufficient sync points for a fs for xip operations. In 
particular for the mmap case. It can be not sufficient to lock/unlock 
to do some operation inside get_xip_mem callback. For xip_file_read 
it's really easy to write a fs specific wrapper, xip_file_write hold 
i_mutex so no problem. With this patch it's possible to reuse the
generic xip_file_fault, using a wrapper function in a fs, without to
reinvent the wheel.

Signed-off-by: Marco Stornelli <marco.stornelli@...il.com>
---

--- linux-3.1-rc4/mm/filemap_xip.c.orig	2011-09-17 13:58:44.000000000 +0200
+++ linux-3.1-rc4/mm/filemap_xip.c	2011-09-17 13:59:31.000000000 +0200
@@ -218,7 +218,7 @@ retry:
  *
  * This function is derived from filemap_fault, but used for execute in place
  */
-static int xip_file_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
+int xip_file_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 {
 	struct file *file = vma->vm_file;
 	struct address_space *mapping = file->f_mapping;
@@ -296,6 +296,7 @@ out:
 		return ret;
 	}
 }
+EXPORT_SYMBOL_GPL(xip_file_fault);
 
 static const struct vm_operations_struct xip_file_vm_ops = {
 	.fault	= xip_file_fault,
--- linux-3.1-rc4/include/linux/fs.h.orig	2011-09-17 13:59:01.000000000 +0200
+++ linux-3.1-rc4/include/linux/fs.h	2011-09-17 14:00:35.000000000 +0200
@@ -409,6 +409,7 @@ struct pipe_inode_info;
 struct poll_table_struct;
 struct kstatfs;
 struct vm_area_struct;
+struct vm_fault;
 struct vfsmount;
 struct cred;
 
@@ -2403,6 +2404,7 @@ extern int nonseekable_open(struct inode
 extern ssize_t xip_file_read(struct file *filp, char __user *buf, size_t len,
 			     loff_t *ppos);
 extern int xip_file_mmap(struct file * file, struct vm_area_struct * vma);
+extern int xip_file_fault(struct vm_area_struct *vma, struct vm_fault *vmf);
 extern ssize_t xip_file_write(struct file *filp, const char __user *buf,
 			      size_t len, loff_t *ppos);
 extern int xip_truncate_page(struct address_space *mapping, loff_t from);


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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ