SOURCES (Titanium): kernel-desktop-unionfs.patch - fixed rc2 patch

shadzik shadzik at pld-linux.org
Tue Mar 24 16:35:17 CET 2009


Author: shadzik                      Date: Tue Mar 24 15:35:17 2009 GMT
Module: SOURCES                       Tag: Titanium
---- Log message:
- fixed rc2 patch

---- Files affected:
SOURCES:
   kernel-desktop-unionfs.patch (1.2.2.1 -> 1.2.2.2) 

---- Diffs:

================================================================
Index: SOURCES/kernel-desktop-unionfs.patch
diff -u SOURCES/kernel-desktop-unionfs.patch:1.2.2.1 SOURCES/kernel-desktop-unionfs.patch:1.2.2.2
--- SOURCES/kernel-desktop-unionfs.patch:1.2.2.1	Tue Mar 24 13:38:58 2009
+++ SOURCES/kernel-desktop-unionfs.patch	Tue Mar 24 16:35:11 2009
@@ -532,10 +532,10 @@
 +
 +For more information, see <http://unionfs.filesystems.org/>.
 diff --git a/MAINTAINERS b/MAINTAINERS
-index fbc8fa5..9b7a352 100644
+index 3fe4dc2..168cc4d 100644
 --- a/MAINTAINERS
 +++ b/MAINTAINERS
-@@ -4294,6 +4294,14 @@ L:	linux-kernel at vger.kernel.org
+@@ -4370,6 +4370,14 @@ L:	linux-kernel at vger.kernel.org
  W:	http://www.kernel.dk
  S:	Maintained
  
@@ -543,56 +543,71 @@
 +P:	Erez Zadok
 +M:	ezk at cs.sunysb.edu
 +L:	unionfs at filesystems.org
-+W:	http://unionfs.filesystems.org
++W:	http://unionfs.filesystems.org/
 +T:	git git.kernel.org/pub/scm/linux/kernel/git/ezk/unionfs.git
 +S:	Maintained
 +
  UNSORTED BLOCK IMAGES (UBI)
  P:	Artem Bityutskiy
  M:	dedekind at infradead.org
---- /dev/null	2007-02-13 17:29:53.000000000 +0100
-+++ linux-2.6.29/fs/unionfs/Kconfig	2009-03-24 13:07:49.116382161 +0100
-@@ -0,0 +1,25 @@
+diff --git a/fs/Kconfig b/fs/Kconfig
+index 51307b0..f1a2dbd 100644
+--- a/fs/Kconfig
++++ b/fs/Kconfig
+@@ -740,6 +740,48 @@ config CONFIGFS_FS
+ 
+ endmenu
+ 
++
++menu "Layered filesystems"
++
++config ECRYPT_FS
++	tristate "eCrypt filesystem layer support (EXPERIMENTAL)"
++	depends on EXPERIMENTAL && KEYS && CRYPTO && NET
++	help
++	  Encrypted filesystem that operates on the VFS layer.  See
++	  <file:Documentation/filesystems/ecryptfs.txt> to learn more about
++	  eCryptfs.  Userspace components are required and can be
++	  obtained from <http://ecryptfs.sf.net>.
++
++	  To compile this file system support as a module, choose M here: the
++	  module will be called ecryptfs.
++
 +config UNION_FS
-+       tristate "Union file system (EXPERIMENTAL)"
-+       depends on EXPERIMENTAL
-+       help
-+         Unionfs is a stackable unification file system, which appears to
-+         merge the contents of several directories (branches), while keeping
-+         their physical content separate.
++	tristate "Union file system (EXPERIMENTAL)"
++	depends on EXPERIMENTAL
++	help
++	  Unionfs is a stackable unification file system, which appears to
++	  merge the contents of several directories (branches), while keeping
++	  their physical content separate.
 +
-+         See <http://unionfs.filesystems.org> for details
++	  See <http://unionfs.filesystems.org/> for details.
 +
 +config UNION_FS_XATTR
-+       bool "Unionfs extended attributes"
-+       depends on UNION_FS
-+       help
-+         Extended attributes are name:value pairs associated with inodes by
-+         the kernel or by users (see the attr(5) manual page).
++	bool "Unionfs extended attributes"
++	depends on UNION_FS
++	help
++	  Extended attributes are name:value pairs associated with inodes by
++	  the kernel or by users (see the attr(5) manual page).
 +
-+         If unsure, say N.
++	  If unsure, say N.
 +
 +config UNION_FS_DEBUG
-+       bool "Debug Unionfs"
-+       depends on UNION_FS
-+       help
-+         If you say Y here, you can turn on debugging output from Unionfs.
-+
---- linux-2.6.29/fs/Kconfig~	2009-03-24 13:06:08.609715416 +0100
-+++ linux-2.6.29/fs/Kconfig	2009-03-24 13:08:40.063033558 +0100
-@@ -246,6 +246,7 @@
- source "fs/adfs/Kconfig"
- source "fs/affs/Kconfig"
- source "fs/ecryptfs/Kconfig"
-+source "fs/unionfs/Kconfig"
- source "fs/hfs/Kconfig"
- source "fs/hfsplus/Kconfig"
- source "fs/befs/Kconfig"
++	bool "Debug Unionfs"
++	depends on UNION_FS
++	help
++	  If you say Y here, you can turn on debugging output from Unionfs.
++
++endmenu
++
+ menuconfig MISC_FILESYSTEMS
+ 	bool "Miscellaneous filesystems"
+ 	default y
 diff --git a/fs/Makefile b/fs/Makefile
-index d9f8afe..e7b036c 100644
+index 38bc735..a1b3bda 100644
 --- a/fs/Makefile
 +++ b/fs/Makefile
-@@ -86,6 +86,7 @@ obj-$(CONFIG_ISO9660_FS)	+= isofs/
+@@ -85,6 +85,7 @@ obj-$(CONFIG_ISO9660_FS)	+= isofs/
  obj-$(CONFIG_HFSPLUS_FS)	+= hfsplus/ # Before hfs to find wrapped HFS+
  obj-$(CONFIG_HFS_FS)		+= hfs/
  obj-$(CONFIG_ECRYPT_FS)		+= ecryptfs/
@@ -614,10 +629,10 @@
  out:
  	return rc;
 diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
-index 5e78fc1..3f13ea1 100644
+index 5697899..8a370a1 100644
 --- a/fs/ecryptfs/inode.c
 +++ b/fs/ecryptfs/inode.c
-@@ -589,9 +589,9 @@ ecryptfs_rename(struct inode *old_dir, struct dentry *old_dentry,
+@@ -628,9 +628,9 @@ ecryptfs_rename(struct inode *old_dir, struct dentry *old_dentry,
  			lower_new_dir_dentry->d_inode, lower_new_dentry);
  	if (rc)
  		goto out_lock;
@@ -629,7 +644,7 @@
  out_lock:
  	unlock_rename(lower_old_dir_dentry, lower_new_dir_dentry);
  	dput(lower_new_dentry->d_parent);
-@@ -914,7 +914,7 @@ static int ecryptfs_setattr(struct dentry *dentry, struct iattr *ia)
+@@ -952,7 +952,7 @@ static int ecryptfs_setattr(struct dentry *dentry, struct iattr *ia)
  	rc = notify_change(lower_dentry, ia);
  	mutex_unlock(&lower_dentry->d_inode->i_mutex);
  out:
@@ -639,10 +654,10 @@
  }
  
 diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c
-index 64d2ba9..f91feb3 100644
+index 789cf2e..7f82ed3 100644
 --- a/fs/ecryptfs/main.c
 +++ b/fs/ecryptfs/main.c
-@@ -193,7 +193,7 @@ int ecryptfs_interpose(struct dentry *lower_dentry, struct dentry *dentry,
+@@ -194,7 +194,7 @@ int ecryptfs_interpose(struct dentry *lower_dentry, struct dentry *dentry,
  		d_add(dentry, inode);
  	else
  		d_instantiate(dentry, inode);
@@ -652,10 +667,10 @@
  	 * other metadata */
  	fsstack_copy_inode_size(inode, lower_inode);
 diff --git a/fs/namei.c b/fs/namei.c
-index 3ca2574..c2f5770 100644
+index bbc15c2..7983d41 100644
 --- a/fs/namei.c
 +++ b/fs/namei.c
-@@ -379,6 +379,7 @@ void release_open_intent(struct nameidata *nd)
+@@ -373,6 +373,7 @@ void release_open_intent(struct nameidata *nd)
  	else
  		fput(nd->intent.open.file);
  }
@@ -664,10 +679,10 @@
  static inline struct dentry *
  do_revalidate(struct dentry *dentry, struct nameidata *nd)
 diff --git a/fs/splice.c b/fs/splice.c
-index 1eaef06..53263ac 100644
+index 4ed0ba4..6637e35 100644
 --- a/fs/splice.c
 +++ b/fs/splice.c
-@@ -887,8 +887,8 @@ EXPORT_SYMBOL(generic_splice_sendpage);
+@@ -888,8 +888,8 @@ EXPORT_SYMBOL(generic_splice_sendpage);
  /*
   * Attempt to initiate a splice from pipe to file.
   */
@@ -678,7 +693,7 @@
  {
  	int ret;
  
-@@ -907,13 +907,14 @@ static long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
+@@ -908,13 +908,14 @@ static long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
  
  	return out->f_op->splice_write(pipe, out, ppos, len, flags);
  }
@@ -696,7 +711,7 @@
  {
  	int ret;
  
-@@ -929,6 +930,7 @@ static long do_splice_to(struct file *in, loff_t *ppos,
+@@ -930,6 +931,7 @@ static long do_splice_to(struct file *in, loff_t *ppos,
  
  	return in->f_op->splice_read(in, ppos, pipe, len, flags);
  }
@@ -704,7 +719,7 @@
  
  /**
   * splice_direct_to_actor - splices data directly between two non-pipes
-@@ -998,7 +1000,7 @@ ssize_t splice_direct_to_actor(struct file *in, struct splice_desc *sd,
+@@ -999,7 +1001,7 @@ ssize_t splice_direct_to_actor(struct file *in, struct splice_desc *sd,
  		size_t read_len;
  		loff_t pos = sd->pos, prev_pos = pos;
  
@@ -713,7 +728,7 @@
  		if (unlikely(ret <= 0))
  			goto out_release;
  
-@@ -1057,7 +1059,7 @@ static int direct_splice_actor(struct pipe_inode_info *pipe,
+@@ -1058,7 +1060,7 @@ static int direct_splice_actor(struct pipe_inode_info *pipe,
  {
  	struct file *file = sd->u.file;
  
@@ -722,7 +737,7 @@
  }
  
  /**
-@@ -1131,7 +1133,7 @@ static long do_splice(struct file *in, loff_t __user *off_in,
+@@ -1132,7 +1134,7 @@ static long do_splice(struct file *in, loff_t __user *off_in,
  		} else
  			off = &out->f_pos;
  
@@ -731,7 +746,7 @@
  
  		if (off_out && copy_to_user(off_out, off, sizeof(loff_t)))
  			ret = -EFAULT;
-@@ -1152,7 +1154,7 @@ static long do_splice(struct file *in, loff_t __user *off_in,
+@@ -1153,7 +1155,7 @@ static long do_splice(struct file *in, loff_t __user *off_in,
  		} else
  			off = &in->f_pos;
  
@@ -852,11 +867,11 @@
  EXPORT_SYMBOL_GPL(fsstack_copy_attr_all);
 diff --git a/fs/unionfs/Makefile b/fs/unionfs/Makefile
 new file mode 100644
-index 0000000..5251b87
+index 0000000..27a4781
 --- /dev/null
 +++ b/fs/unionfs/Makefile
 @@ -0,0 +1,17 @@
-+UNIONFS_VERSION="2.5.1 (for 2.6.28.1)"
++UNIONFS_VERSION="2.5.1 (for 2.6.29-rc2)"
 +
 +EXTRA_CFLAGS += -DUNIONFS_VERSION=\"$(UNIONFS_VERSION)\"
 +
@@ -875,10 +890,10 @@
 +endif
 diff --git a/fs/unionfs/commonfops.c b/fs/unionfs/commonfops.c
 new file mode 100644
-index 0000000..63ee085
+index 0000000..e9dc23c
 --- /dev/null
 +++ b/fs/unionfs/commonfops.c
-@@ -0,0 +1,879 @@
+@@ -0,0 +1,880 @@
 +/*
 + * Copyright (c) 2003-2009 Erez Zadok
 + * Copyright (c) 2003-2006 Charles P. Wright
@@ -1059,7 +1074,7 @@
 +		lower_file =
 +			dentry_open(lower_dentry,
 +				    unionfs_lower_mnt_idx(dentry, bindex),
-+				    file->f_flags);
++				    file->f_flags, current_cred());
 +		if (IS_ERR(lower_file)) {
 +			branchput(sb, bindex);
 +			err = PTR_ERR(lower_file);
@@ -1104,7 +1119,7 @@
 +	unionfs_mntget(dentry, bstart);
 +	lower_file = dentry_open(lower_dentry,
 +				 unionfs_lower_mnt_idx(dentry, bstart),
-+				 file->f_flags);
++				 file->f_flags, current_cred());
 +	if (IS_ERR(lower_file)) {
 +		err = PTR_ERR(lower_file);
 +		goto out;
@@ -1338,7 +1353,8 @@
 +		dget(lower_dentry);
 +		unionfs_mntget(file->f_path.dentry, bindex);
 +		mnt = unionfs_lower_mnt_idx(file->f_path.dentry, bindex);
-+		lower_file = dentry_open(lower_dentry, mnt, file->f_flags);
++		lower_file = dentry_open(lower_dentry, mnt, file->f_flags,
++					 current_cred());
 +		if (IS_ERR(lower_file))
 +			return PTR_ERR(lower_file);
 +
@@ -1409,7 +1425,7 @@
 +	lower_file =
 +		dentry_open(lower_dentry,
 +			    unionfs_lower_mnt_idx(file->f_path.dentry, bstart),
-+			    lower_flags);
++			    lower_flags, current_cred());
 +	if (IS_ERR(lower_file))
 +		return PTR_ERR(lower_file);
 +
@@ -1760,10 +1776,10 @@
 +}
 diff --git a/fs/unionfs/copyup.c b/fs/unionfs/copyup.c
 new file mode 100644
-index 0000000..c7d3f9f
+index 0000000..3d0c0ca
 --- /dev/null
 +++ b/fs/unionfs/copyup.c
-@@ -0,0 +1,888 @@
+@@ -0,0 +1,897 @@
 +/*
 + * Copyright (c) 2003-2009 Erez Zadok
 + * Copyright (c) 2003-2006 Charles P. Wright
@@ -1858,10 +1874,19 @@
 +		 * XXX: move entire copyup code to SIOQ.
 +		 */
 +		if (err == -EPERM && !capable(CAP_FOWNER)) {
-+			cap_raise(current->cap_effective, CAP_FOWNER);
++			const struct cred *old_creds;
++			struct cred *new_creds;
++
++			new_creds = prepare_creds();
++			if (unlikely(!new_creds)) {
++				err = -ENOMEM;
++				goto out;
++			}
++			cap_raise(new_creds->cap_effective, CAP_FOWNER);
++			old_creds = override_creds(new_creds);
 +			err = vfs_setxattr(new_lower_dentry, name_list,
 +					   attr_value, size, 0);
-+			cap_lower(current->cap_effective, CAP_FOWNER);
++			revert_creds(old_creds);
 +		}
 +		if (err < 0)
 +			goto out;
@@ -2006,7 +2031,7 @@
 +	/* dentry_open calls dput and mntput if it returns an error */
 +	input_file = dentry_open(old_lower_dentry,
 +				 unionfs_lower_mnt_idx(dentry, old_bindex),
-+				 O_RDONLY | O_LARGEFILE);
++				 O_RDONLY | O_LARGEFILE, current_cred());
 +	if (IS_ERR(input_file)) {
 +		dput(old_lower_dentry);
 +		err = PTR_ERR(input_file);
@@ -2022,7 +2047,7 @@
 +	output_mnt = unionfs_mntget(sb->s_root, new_bindex);
 +	branchget(sb, new_bindex);
 +	output_file = dentry_open(new_lower_dentry, output_mnt,
-+				  O_RDWR | O_LARGEFILE);
++				  O_RDWR | O_LARGEFILE, current_cred());
 +	if (IS_ERR(output_file)) {
 +		err = PTR_ERR(output_file);
 +		goto out_close_in2;
@@ -3904,7 +3929,7 @@
 +};
 diff --git a/fs/unionfs/dirhelper.c b/fs/unionfs/dirhelper.c
 new file mode 100644
-index 0000000..b2c645e
+index 0000000..2ecaafa
 --- /dev/null
 +++ b/fs/unionfs/dirhelper.c
 @@ -0,0 +1,158 @@
@@ -4030,7 +4055,7 @@
 +		dget(lower_dentry);
 +		mnt = unionfs_mntget(dentry, bindex);
 +		branchget(sb, bindex);
-+		lower_file = dentry_open(lower_dentry, mnt, O_RDONLY);
++		lower_file = dentry_open(lower_dentry, mnt, O_RDONLY, current_cred());
 +		if (IS_ERR(lower_file)) {
 +			err = PTR_ERR(lower_file);
 +			branchput(sb, bindex);
@@ -4481,10 +4506,10 @@
 +#endif	/* not _FANOUT_H */
 diff --git a/fs/unionfs/file.c b/fs/unionfs/file.c
 new file mode 100644
-index 0000000..af6f8a7
+index 0000000..281169e
 --- /dev/null
 +++ b/fs/unionfs/file.c
-@@ -0,0 +1,364 @@
+@@ -0,0 +1,380 @@
 +/*
 + * Copyright (c) 2003-2009 Erez Zadok
 + * Copyright (c) 2003-2006 Charles P. Wright
@@ -4587,6 +4612,21 @@
 +	struct dentry *parent;
 +	struct vm_operations_struct *saved_vm_ops = NULL;
 +
++	/*
++	 * Since mm/memory.c:might_fault() (under PROVE_LOCKING) was
++	 * modified in 2.6.29-rc1 to call might_lock_read on mmap_sem, this
++	 * has been causing false positives in file system stacking layers.
++	 * In particular, our ->mmap is called after sys_mmap2 already holds
++	 * mmap_sem, then we lock our own mutexes; but earlier, it's
++	 * possible for lockdep to have locked our mutexes first, and then
++	 * we call a lower ->readdir which could call might_fault.  The
++	 * different ordering of the locks is what lockdep complains about
++	 * -- unnecessarily.  Therefore, we have no choice but to tell
++	 * lockdep to temporarily turn off lockdep here.  Note: the comments
++	 * inside might_sleep also suggest that it would have been
++	 * nicer to only annotate paths that needs that might_lock_read.
++	 */
++	lockdep_off();
 +	unionfs_read_lock(dentry->d_sb, UNIONFS_SMUTEX_PARENT);
 +	parent = unionfs_lock_parent(dentry, UNIONFS_DMUTEX_PARENT);
 +	unionfs_lock_dentry(dentry, UNIONFS_DMUTEX_CHILD);
@@ -4656,6 +4696,7 @@
 +	unionfs_unlock_dentry(dentry);
 +	unionfs_unlock_parent(dentry, parent);
 +	unionfs_read_unlock(dentry->d_sb);
++	lockdep_on();
 +	return err;
 +}
 +
@@ -10445,10 +10486,10 @@
 +}
 diff --git a/fs/unionfs/whiteout.c b/fs/unionfs/whiteout.c
 new file mode 100644
-index 0000000..6f5e19e
+index 0000000..a55684d
 --- /dev/null
 +++ b/fs/unionfs/whiteout.c
-@@ -0,0 +1,577 @@
+@@ -0,0 +1,584 @@
 +/*
 + * Copyright (c) 2003-2009 Erez Zadok
 + * Copyright (c) 2003-2006 Charles P. Wright
@@ -10983,7 +11024,8 @@
 +	struct dentry *lower_dentry, *diropq;
 +	struct inode *lower_dir;
 +	struct nameidata nd;
-+	kernel_cap_t orig_cap;
++	const struct cred *old_creds;
++	struct cred *new_creds;
 +
 +	/*
 +	 * Opaque directory whiteout markers are special files (like regular
@@ -10993,9 +11035,14 @@
 +	 * creation of the .wh.__dir_opaque: file.  Note, this does not
 +	 * circumvent normal ->permission).
 +	 */
-+	orig_cap = current->cap_effective;
-+	cap_raise(current->cap_effective, CAP_DAC_READ_SEARCH);
-+	cap_raise(current->cap_effective, CAP_DAC_OVERRIDE);
++	new_creds = prepare_creds();
++	if (unlikely(!new_creds)) {
++		err = -ENOMEM;
++		goto out_err;
++	}
++	cap_raise(new_creds->cap_effective, CAP_DAC_READ_SEARCH);
++	cap_raise(new_creds->cap_effective, CAP_DAC_OVERRIDE);
++	old_creds = override_creds(new_creds);
 +
 +	lower_dentry = unionfs_lower_dentry_idx(dentry, bindex);
 +	lower_dir = lower_dentry->d_inode;
@@ -11023,7 +11070,8 @@
 +
 +out:
 +	mutex_unlock(&lower_dir->i_mutex);
-+	current->cap_effective = orig_cap;
++	revert_creds(old_creds);
++out_err:
 +	return err;
 +}
 diff --git a/fs/unionfs/xattr.c b/fs/unionfs/xattr.c
@@ -11243,10 +11291,10 @@
  /* inlines */
  static inline void fsstack_copy_attr_atime(struct inode *dest,
 diff --git a/include/linux/magic.h b/include/linux/magic.h
-index f7f3fdd..5f3e56f 100644
+index 0b4df7e..2170b8a 100644
 --- a/include/linux/magic.h
 +++ b/include/linux/magic.h
-@@ -39,6 +39,8 @@
+@@ -42,6 +42,8 @@
  #define REISER2FS_SUPER_MAGIC_STRING	"ReIsEr2Fs"
  #define REISER2FS_JR_SUPER_MAGIC_STRING	"ReIsEr3Fs"
  
@@ -11298,3 +11346,15 @@
 +
 +#endif /* _LINUX_UNIONFS_H */
 +
+diff --git a/security/security.c b/security/security.c
+index c3586c0..17c2cdf 100644
+--- a/security/security.c
++++ b/security/security.c
+@@ -520,6 +520,7 @@ int security_inode_permission(struct inode *inode, int mask)
+ 		return 0;
+ 	return security_ops->inode_permission(inode, mask);
+ }
++EXPORT_SYMBOL(security_inode_permission);
+ 
+ int security_inode_setattr(struct dentry *dentry, struct iattr *attr)
+ {
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/kernel-desktop-unionfs.patch?r1=1.2.2.1&r2=1.2.2.2&f=u



More information about the pld-cvs-commit mailing list