[packages/kernel] - up to 3.5.3.

arekm arekm at pld-linux.org
Sun Aug 26 09:25:09 CEST 2012


commit 2dfbb2745b90341e805bedf0d3b3bb0a878216c6
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Sun Aug 26 09:25:04 2012 +0200

    - up to 3.5.3.

 kernel-apparmor.patch    |  96 +++++---
 kernel-aufs3.patch       | 399 +++++++++++++-----------------
 kernel-small_fixes.patch | 612 +++++++++++++++++++++++++++++++++++++++++++++++
 kernel.spec              |   8 +-
 4 files changed, 839 insertions(+), 276 deletions(-)
---
diff --git a/kernel.spec b/kernel.spec
index 3a2dfb2..07efdf7 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -91,7 +91,7 @@
 
 %define		rel		1
 %define		basever		3.5
-%define		postver		.2
+%define		postver		.3
 
 # __alt_kernel is list of features, empty string if none set
 # _alt kernel is defined as: %{nil}%{?alt_kernel:-%{?alt_kernel}} (defined in rpm.macros)
@@ -134,7 +134,7 @@ Source0:	http://www.kernel.org/pub/linux/kernel/v3.x/linux-%{basever}.tar.xz
 # Source0-md5:	24153eaaa81dedc9481ada8cd9c3b83d
 %if "%{postver}" != ".0"
 Patch0:		http://www.kernel.org/pub/linux/kernel/v3.x/patch-%{version}.bz2
-# Patch0-md5:	128f05bf03ba7e772286b2066eab439c
+# Patch0-md5:	94115bfe01743bd4326d71f321f2e5ac
 %endif
 
 Source3:	kernel-autoconf.h
@@ -223,7 +223,7 @@ Patch140:	kernel-unionfs.patch
 # Patch creation:
 # git clone git://aufs.git.sourceforge.net/gitroot/aufs/aufs3-standalone.git
 # cd aufs3-standalone
-# git checkout -b aufs3.4 origin/aufs3.4
+# git checkout -b aufs3.5 origin/aufs3.5
 # cat aufs3-kbuild.patch aufs3-base.patch aufs3-standalone.patch > ~/rpm/packages/kernel/kernel-aufs3.patch
 # mkdir linux
 # cp -a Documentation fs include linux
@@ -245,7 +245,7 @@ Patch2000:	kernel-small_fixes.patch
 Patch2001:	kernel-pwc-uncompress.patch
 Patch2003:	kernel-regressions.patch
 
-# http://git.kernel.org/?p=linux/kernel/git/jj/linux-apparmor.git;a=shortlog;h=refs/heads/v3.4-aa2.8
+# http://git.kernel.org/?p=linux/kernel/git/jj/linux-apparmor.git;a=shortlog;h=refs/heads/v3.5-aa2.8
 Patch5000:	kernel-apparmor.patch
 
 # for rescuecd
diff --git a/kernel-apparmor.patch b/kernel-apparmor.patch
index 49f4be3..b5352e4 100644
--- a/kernel-apparmor.patch
+++ b/kernel-apparmor.patch
@@ -1,27 +1,45 @@
-From 8de755e4dfdbc40bfcaca848ae6b5aeaf0ede0e8 Mon Sep 17 00:00:00 2001
+From 05bf1eb7276886a3eda0588a8e012b558b693e96 Mon Sep 17 00:00:00 2001
 From: John Johansen <john.johansen at canonical.com>
 Date: Thu, 22 Jul 2010 02:32:02 -0700
-Subject: [PATCH 1/3] UBUNTU: SAUCE: AppArmor: Add profile introspection file
- to interface
+Subject: [PATCH] UBUNTU: SAUCE: AppArmor: Add profile introspection file to
+ interface
 
 Add the dynamic profiles file to the interace, to allow load policy
 introspection.
 
 Signed-off-by: John Johansen <john.johansen at canonical.com>
 Acked-by: Kees Cook <kees at ubuntu.com>
-Signed-off-by: Tim Gardner <tim.gardner at canonical.com>
 ---
- security/apparmor/apparmorfs.c |  227 ++++++++++++++++++++++++++++++++++++++++
- 1 file changed, 227 insertions(+)
+ security/apparmor/Kconfig      |    9 ++
+ security/apparmor/apparmorfs.c |  231 ++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 240 insertions(+), 0 deletions(-)
 
+diff --git a/security/apparmor/Kconfig b/security/apparmor/Kconfig
+index 9b9013b..51ebf96 100644
+--- a/security/apparmor/Kconfig
++++ b/security/apparmor/Kconfig
+@@ -29,3 +29,12 @@ config SECURITY_APPARMOR_BOOTPARAM_VALUE
+ 	  boot.
+ 
+ 	  If you are unsure how to answer this question, answer 1.
++
++config SECURITY_APPARMOR_COMPAT_24
++	bool "Enable AppArmor 2.4 compatability"
++	depends on SECURITY_APPARMOR
++	default y
++	help
++	  This option enables compatability with AppArmor 2.4.  It is
++          recommended if compatability with older versions of AppArmor
++          is desired.
 diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
-index 16c15ec..89bdc62 100644
+index 16c15ec..42b7c9f 100644
 --- a/security/apparmor/apparmorfs.c
 +++ b/security/apparmor/apparmorfs.c
-@@ -182,6 +182,232 @@ const struct file_operations aa_fs_seq_file_ops = {
+@@ -182,6 +182,234 @@ const struct file_operations aa_fs_seq_file_ops = {
  	.release	= single_release,
  };
  
++#ifdef CONFIG_SECURITY_APPARMOR_COMPAT_24
 +/**
 + * __next_namespace - find the next namespace to list
 + * @root: root namespace to stop search at (NOT NULL)
@@ -247,25 +265,28 @@ index 16c15ec..89bdc62 100644
 +	.llseek = seq_lseek,
 +	.release = profiles_release,
 +};
++#endif /* CONFIG_SECURITY_APPARMOR_COMPAT_24 */
 +
  /** Base file system setup **/
  
  static struct aa_fs_entry aa_fs_entry_file[] = {
-@@ -210,6 +436,7 @@ static struct aa_fs_entry aa_fs_entry_apparmor[] = {
+@@ -210,6 +438,9 @@ static struct aa_fs_entry aa_fs_entry_apparmor[] = {
  	AA_FS_FILE_FOPS(".load", 0640, &aa_fs_profile_load),
  	AA_FS_FILE_FOPS(".replace", 0640, &aa_fs_profile_replace),
  	AA_FS_FILE_FOPS(".remove", 0640, &aa_fs_profile_remove),
++#ifdef CONFIG_SECURITY_APPARMOR_COMPAT_24
 +	AA_FS_FILE_FOPS("profiles", 0640, &aa_fs_profiles_fops),
++#endif
  	AA_FS_DIR("features", aa_fs_entry_features),
  	{ }
  };
 -- 
-1.7.9.5
+1.7.6.5
 
-From 423e2cb454d75d6185eecd0c1b5cf6ccc2d8482d Mon Sep 17 00:00:00 2001
+From 4facdf9db37c12ff655c91270d9030e2ed805ca2 Mon Sep 17 00:00:00 2001
 From: John Johansen <john.johansen at canonical.com>
 Date: Mon, 4 Oct 2010 15:03:36 -0700
-Subject: [PATCH 2/3] UBUNTU: SAUCE: AppArmor: basic networking rules
+Subject: [PATCH] UBUNTU: SAUCE: AppArmor: basic networking rules
 
 Base support for network mediation.
 
@@ -370,10 +391,10 @@ index 806bd19..19daa85 100644
 +	$(call cmd,make-af)
 +	$(call cmd,make-sock)
 diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
-index 89bdc62..c66315d 100644
+index 42b7c9f..114fb23 100644
 --- a/security/apparmor/apparmorfs.c
 +++ b/security/apparmor/apparmorfs.c
-@@ -427,6 +427,7 @@ static struct aa_fs_entry aa_fs_entry_domain[] = {
+@@ -429,6 +429,7 @@ static struct aa_fs_entry aa_fs_entry_domain[] = {
  static struct aa_fs_entry aa_fs_entry_features[] = {
  	AA_FS_DIR("domain",			aa_fs_entry_domain),
  	AA_FS_DIR("file",			aa_fs_entry_file),
@@ -382,10 +403,10 @@ index 89bdc62..c66315d 100644
  	AA_FS_DIR("rlimit",			aa_fs_entry_rlimit),
  	{ }
 diff --git a/security/apparmor/include/audit.h b/security/apparmor/include/audit.h
-index 3868b1e..c1ff09c 100644
+index 4b7e189..17734f9 100644
 --- a/security/apparmor/include/audit.h
 +++ b/security/apparmor/include/audit.h
-@@ -126,6 +126,10 @@ struct apparmor_audit_data {
+@@ -127,6 +127,10 @@ struct apparmor_audit_data {
  			u32 denied;
  			uid_t ouid;
  		} fs;
@@ -475,7 +496,7 @@ index bda4569..eb13a73 100644
  };
  
 diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c
-index ad05d39..3cde194 100644
+index 8ea39aa..f628734 100644
 --- a/security/apparmor/lsm.c
 +++ b/security/apparmor/lsm.c
 @@ -32,6 +32,7 @@
@@ -486,7 +507,7 @@ index ad05d39..3cde194 100644
  #include "include/path.h"
  #include "include/policy.h"
  #include "include/procattr.h"
-@@ -622,6 +623,104 @@ static int apparmor_task_setrlimit(struct task_struct *task,
+@@ -614,6 +615,104 @@ static int apparmor_task_setrlimit(struct task_struct *task,
  	return error;
  }
  
@@ -591,7 +612,7 @@ index ad05d39..3cde194 100644
  static struct security_operations apparmor_ops = {
  	.name =				"apparmor",
  
-@@ -653,6 +752,19 @@ static struct security_operations apparmor_ops = {
+@@ -646,6 +745,19 @@ static struct security_operations apparmor_ops = {
  	.getprocattr =			apparmor_getprocattr,
  	.setprocattr =			apparmor_setprocattr,
  
@@ -613,7 +634,7 @@ index ad05d39..3cde194 100644
  	.cred_prepare =			apparmor_cred_prepare,
 diff --git a/security/apparmor/net.c b/security/apparmor/net.c
 new file mode 100644
-index 0000000..084232b
+index 0000000..003dd18
 --- /dev/null
 +++ b/security/apparmor/net.c
 @@ -0,0 +1,162 @@
@@ -780,7 +801,7 @@ index 0000000..084232b
 +	return error;
 +}
 diff --git a/security/apparmor/policy.c b/security/apparmor/policy.c
-index f1f7506..b8100a7 100644
+index cf5fd22..27c8161 100644
 --- a/security/apparmor/policy.c
 +++ b/security/apparmor/policy.c
 @@ -745,6 +745,7 @@ static void free_profile(struct aa_profile *profile)
@@ -792,7 +813,7 @@ index f1f7506..b8100a7 100644
  
  	aa_free_sid(profile->sid);
 diff --git a/security/apparmor/policy_unpack.c b/security/apparmor/policy_unpack.c
-index deab7c7..8f8e9c1 100644
+index 329b1fd..1b90dfa 100644
 --- a/security/apparmor/policy_unpack.c
 +++ b/security/apparmor/policy_unpack.c
 @@ -193,6 +193,19 @@ fail:
@@ -863,13 +884,12 @@ index deab7c7..8f8e9c1 100644
  		/* generic policy dfa - optional and may be NULL */
  		profile->policy.dfa = unpack_dfa(e);
 -- 
-1.7.9.5
+1.7.7.6
 
-From a94d5e11c0484af59e5feebf144cc48c186892ad Mon Sep 17 00:00:00 2001
+From 888a3d71db1ffd3a19d9f621b07e60c4ab9e1c44 Mon Sep 17 00:00:00 2001
 From: John Johansen <john.johansen at canonical.com>
 Date: Wed, 16 May 2012 10:58:05 -0700
-Subject: [PATCH 3/3] UBUNTU: SAUCE: apparmor: Add the ability to mediate
- mount
+Subject: [PATCH] UBUNTU: SAUCE: apparmor: Add the ability to mediate mount
 
 Add the ability for apparmor to do mediation of mount operations. Mount
 rules require an updated apparmor_parser (2.8 series) for policy compilation.
@@ -937,10 +957,10 @@ index 19daa85..63e0a4c 100644
  clean-files := capability_names.h rlim_names.h net_names.h
  
 diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
-index c66315d..ff19009 100644
+index 114fb23..ee77ec9 100644
 --- a/security/apparmor/apparmorfs.c
 +++ b/security/apparmor/apparmorfs.c
-@@ -424,10 +424,23 @@ static struct aa_fs_entry aa_fs_entry_domain[] = {
+@@ -426,10 +426,23 @@ static struct aa_fs_entry aa_fs_entry_domain[] = {
  	{ }
  };
  
@@ -965,7 +985,7 @@ index c66315d..ff19009 100644
  	AA_FS_DIR("rlimit",			aa_fs_entry_rlimit),
  	{ }
 diff --git a/security/apparmor/audit.c b/security/apparmor/audit.c
-index cc3520d..b9f5ee9 100644
+index 3ae28db..e267963 100644
 --- a/security/apparmor/audit.c
 +++ b/security/apparmor/audit.c
 @@ -44,6 +44,10 @@ const char *const op_table[] = {
@@ -980,7 +1000,7 @@ index cc3520d..b9f5ee9 100644
  	"post_create",
  	"bind",
 diff --git a/security/apparmor/domain.c b/security/apparmor/domain.c
-index 6327685..dfdc47b 100644
+index b81ea10..afa8671 100644
 --- a/security/apparmor/domain.c
 +++ b/security/apparmor/domain.c
 @@ -242,7 +242,7 @@ static const char *next_name(int xtype, const char *name)
@@ -1008,7 +1028,7 @@ index 40aedd9..e243d96 100644
  /* Control parameters settable through module/boot flags */
  extern enum audit_mode aa_g_audit;
 diff --git a/security/apparmor/include/audit.h b/security/apparmor/include/audit.h
-index c1ff09c..7b90900c 100644
+index 17734f9..66a738c 100644
 --- a/security/apparmor/include/audit.h
 +++ b/security/apparmor/include/audit.h
 @@ -73,6 +73,10 @@ enum aa_ops {
@@ -1022,7 +1042,7 @@ index c1ff09c..7b90900c 100644
  	OP_CREATE,
  	OP_POST_CREATE,
  	OP_BIND,
-@@ -121,6 +125,13 @@ struct apparmor_audit_data {
+@@ -122,6 +126,13 @@ struct apparmor_audit_data {
  			unsigned long max;
  		} rlim;
  		struct {
@@ -1110,7 +1130,7 @@ index 0000000..bc17a53
 +
 +#endif /* __AA_MOUNT_H */
 diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c
-index 3cde194..4512cc6 100644
+index f628734..65ff9e4 100644
 --- a/security/apparmor/lsm.c
 +++ b/security/apparmor/lsm.c
 @@ -36,6 +36,7 @@
@@ -1121,7 +1141,7 @@ index 3cde194..4512cc6 100644
  
  /* Flag indicating whether initialization completed */
  int apparmor_initialized __initdata;
-@@ -512,6 +513,60 @@ static int apparmor_file_mprotect(struct vm_area_struct *vma,
+@@ -504,6 +505,60 @@ static int apparmor_file_mprotect(struct vm_area_struct *vma,
  			   !(vma->vm_flags & VM_SHARED) ? MAP_PRIVATE : 0);
  }
  
@@ -1182,7 +1202,7 @@ index 3cde194..4512cc6 100644
  static int apparmor_getprocattr(struct task_struct *task, char *name,
  				char **value)
  {
-@@ -729,6 +784,10 @@ static struct security_operations apparmor_ops = {
+@@ -721,6 +776,10 @@ static struct security_operations apparmor_ops = {
  	.capget =			apparmor_capget,
  	.capable =			apparmor_capable,
  
@@ -1195,7 +1215,7 @@ index 3cde194..4512cc6 100644
  	.path_symlink =			apparmor_path_symlink,
 diff --git a/security/apparmor/mount.c b/security/apparmor/mount.c
 new file mode 100644
-index 0000000..63d8493
+index 0000000..478aa4d
 --- /dev/null
 +++ b/security/apparmor/mount.c
 @@ -0,0 +1,620 @@
@@ -1339,7 +1359,7 @@ index 0000000..63d8493
 +		       struct file_perms *perms, const char *info, int error)
 +{
 +	int audit_type = AUDIT_APPARMOR_AUTO;
-+	struct common_audit_data sa;
++	struct common_audit_data sa = { };
 +	struct apparmor_audit_data aad = { };
 +
 +	if (likely(!error)) {
@@ -1820,5 +1840,5 @@ index 0000000..63d8493
 +	return error;
 +}
 -- 
-1.7.9.5
+1.7.7.6
 
diff --git a/kernel-aufs3.patch b/kernel-aufs3.patch
index 61ba23c..4b8e026 100644
--- a/kernel-aufs3.patch
+++ b/kernel-aufs3.patch
@@ -1,4 +1,4 @@
-aufs3.x-rcN kbuild patch
+aufs3.5 kbuild patch
 
 diff --git a/fs/Kconfig b/fs/Kconfig
 index f95ae3a..6d8a9a5 100644
@@ -33,7 +33,7 @@ index 8760be3..a1b8446 100644
  header-y += auto_fs.h
  header-y += auto_fs4.h
  header-y += auxvec.h
-aufs3.x-rcN base patch
+aufs3.5 base patch
 
 diff --git a/fs/inode.c b/fs/inode.c
 index c99163b..7f772fd 100644
@@ -62,10 +62,10 @@ index 7d69419..18c9782 100644
  	return __lookup_hash(&nd->last, nd->path.dentry, nd);
  }
 diff --git a/fs/splice.c b/fs/splice.c
-index c9f1318..490239f 100644
+index 7bf08fa..e3c40b5 100644
 --- a/fs/splice.c
 +++ b/fs/splice.c
-@@ -1086,8 +1086,8 @@ EXPORT_SYMBOL(generic_splice_sendpage);
+@@ -1090,8 +1090,8 @@ EXPORT_SYMBOL(generic_splice_sendpage);
  /*
   * Attempt to initiate a splice from pipe to file.
   */
@@ -76,7 +76,7 @@ index c9f1318..490239f 100644
  {
  	ssize_t (*splice_write)(struct pipe_inode_info *, struct file *,
  				loff_t *, size_t, unsigned int);
-@@ -1114,9 +1114,9 @@ static long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
+@@ -1118,9 +1118,9 @@ static long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
  /*
   * Attempt to initiate a splice from a file to a pipe.
   */
@@ -114,10 +114,10 @@ index ffc0213..ef35a31 100644
  
  extern int follow_down_one(struct path *);
 diff --git a/include/linux/splice.h b/include/linux/splice.h
-index 26e5b61..3ffef2f 100644
+index 09a545a..1ac5727 100644
 --- a/include/linux/splice.h
 +++ b/include/linux/splice.h
-@@ -91,4 +91,10 @@ extern void splice_shrink_spd(struct pipe_inode_info *,
+@@ -91,4 +91,10 @@ extern void splice_shrink_spd(struct splice_pipe_desc *);
  extern void spd_release_page(struct splice_pipe_desc *, unsigned int);
  
  extern const struct pipe_buf_operations page_cache_pipe_buf_ops;
@@ -128,7 +128,7 @@ index 26e5b61..3ffef2f 100644
 +			 struct pipe_inode_info *pipe, size_t len,
 +			 unsigned int flags);
  #endif
-aufs3.x-rcN standalone patch
+aufs3.5 standalone patch
 
 diff --git a/fs/file_table.c b/fs/file_table.c
 index a305d9e..6a768be 100644
@@ -265,7 +265,7 @@ index f104d56..54f36db 100644
  static int fsnotify_mark_destroy(void *ignored)
  {
 diff --git a/fs/open.c b/fs/open.c
-index d6c79a0..9004a15 100644
+index 1540632..2463289 100644
 --- a/fs/open.c
 +++ b/fs/open.c
 @@ -60,6 +60,7 @@ int do_truncate(struct dentry *dentry, loff_t length, unsigned int time_attrs,
@@ -277,10 +277,10 @@ index d6c79a0..9004a15 100644
  static long do_sys_truncate(const char __user *pathname, loff_t length)
  {
 diff --git a/fs/splice.c b/fs/splice.c
-index 490239f..701d34a 100644
+index e3c40b5..3afc547 100644
 --- a/fs/splice.c
 +++ b/fs/splice.c
-@@ -1110,6 +1110,7 @@ long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
+@@ -1114,6 +1114,7 @@ long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
  
  	return splice_write(pipe, out, ppos, len, flags);
  }
@@ -288,7 +288,7 @@ index 490239f..701d34a 100644
  
  /*
   * Attempt to initiate a splice from a file to a pipe.
-@@ -1136,6 +1137,7 @@ long do_splice_to(struct file *in, loff_t *ppos,
+@@ -1140,6 +1141,7 @@ long do_splice_to(struct file *in, loff_t *ppos,
  
  	return splice_read(in, ppos, pipe, len, flags);
  }
@@ -333,10 +333,10 @@ index 442204c..e644a1c 100644
  int devcgroup_inode_mknod(int mode, dev_t dev)
  {
 diff --git a/security/security.c b/security/security.c
-index 3efc9b1..c7afd35 100644
+index 860aeb3..ffb57bf 100644
 --- a/security/security.c
 +++ b/security/security.c
-@@ -383,6 +383,7 @@ int security_path_rmdir(struct path *dir, struct dentry *dentry)
+@@ -384,6 +384,7 @@ int security_path_rmdir(struct path *dir, struct dentry *dentry)
  		return 0;
  	return security_ops->path_rmdir(dir, dentry);
  }
@@ -344,7 +344,7 @@ index 3efc9b1..c7afd35 100644
  
  int security_path_unlink(struct path *dir, struct dentry *dentry)
  {
-@@ -399,6 +400,7 @@ int security_path_symlink(struct path *dir, struct dentry *dentry,
+@@ -400,6 +401,7 @@ int security_path_symlink(struct path *dir, struct dentry *dentry,
  		return 0;
  	return security_ops->path_symlink(dir, dentry, old_name);
  }
@@ -352,7 +352,7 @@ index 3efc9b1..c7afd35 100644
  
  int security_path_link(struct dentry *old_dentry, struct path *new_dir,
  		       struct dentry *new_dentry)
-@@ -407,6 +409,7 @@ int security_path_link(struct dentry *old_dentry, struct path *new_dir,
+@@ -408,6 +410,7 @@ int security_path_link(struct dentry *old_dentry, struct path *new_dir,
  		return 0;
  	return security_ops->path_link(old_dentry, new_dir, new_dentry);
  }
@@ -360,7 +360,7 @@ index 3efc9b1..c7afd35 100644
  
  int security_path_rename(struct path *old_dir, struct dentry *old_dentry,
  			 struct path *new_dir, struct dentry *new_dentry)
-@@ -425,6 +428,7 @@ int security_path_truncate(struct path *path)
+@@ -426,6 +429,7 @@ int security_path_truncate(struct path *path)
  		return 0;
  	return security_ops->path_truncate(path);
  }
@@ -368,7 +368,7 @@ index 3efc9b1..c7afd35 100644
  
  int security_path_chmod(struct path *path, umode_t mode)
  {
-@@ -432,6 +436,7 @@ int security_path_chmod(struct path *path, umode_t mode)
+@@ -433,6 +437,7 @@ int security_path_chmod(struct path *path, umode_t mode)
  		return 0;
  	return security_ops->path_chmod(path, mode);
  }
@@ -376,7 +376,7 @@ index 3efc9b1..c7afd35 100644
  
  int security_path_chown(struct path *path, uid_t uid, gid_t gid)
  {
-@@ -439,6 +444,7 @@ int security_path_chown(struct path *path, uid_t uid, gid_t gid)
+@@ -440,6 +445,7 @@ int security_path_chown(struct path *path, uid_t uid, gid_t gid)
  		return 0;
  	return security_ops->path_chown(path, uid, gid);
  }
@@ -384,7 +384,7 @@ index 3efc9b1..c7afd35 100644
  
  int security_path_chroot(struct path *path)
  {
-@@ -515,6 +521,7 @@ int security_inode_readlink(struct dentry *dentry)
+@@ -516,6 +522,7 @@ int security_inode_readlink(struct dentry *dentry)
  		return 0;
  	return security_ops->inode_readlink(dentry);
  }
@@ -392,7 +392,7 @@ index 3efc9b1..c7afd35 100644
  
  int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd)
  {
-@@ -529,6 +536,7 @@ int security_inode_permission(struct inode *inode, int mask)
+@@ -530,6 +537,7 @@ int security_inode_permission(struct inode *inode, int mask)
  		return 0;
  	return security_ops->inode_permission(inode, mask);
  }
@@ -400,7 +400,7 @@ index 3efc9b1..c7afd35 100644
  
  int security_inode_setattr(struct dentry *dentry, struct iattr *attr)
  {
-@@ -644,6 +652,7 @@ int security_file_permission(struct file *file, int mask)
+@@ -645,6 +653,7 @@ int security_file_permission(struct file *file, int mask)
  
  	return fsnotify_perm(file, mask);
  }
@@ -408,7 +408,7 @@ index 3efc9b1..c7afd35 100644
  
  int security_file_alloc(struct file *file)
  {
-@@ -704,6 +713,7 @@ int security_mmap_file(struct file *file, unsigned long prot,
+@@ -705,6 +714,7 @@ int security_mmap_file(struct file *file, unsigned long prot,
  		return ret;
  	return ima_file_mmap(file, prot);
  }
@@ -418,7 +418,7 @@ index 3efc9b1..c7afd35 100644
  {
 diff -urN /usr/share/empty/Documentation/ABI/testing/debugfs-aufs linux/Documentation/ABI/testing/debugfs-aufs
 --- /usr/share/empty/Documentation/ABI/testing/debugfs-aufs	1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/ABI/testing/debugfs-aufs	2012-07-22 19:57:03.161004529 +0200
++++ linux/Documentation/ABI/testing/debugfs-aufs	2012-08-26 08:39:00.753841216 +0200
 @@ -0,0 +1,37 @@
 +What:		/debug/aufs/si_<id>/
 +Date:		March 2009
@@ -459,7 +459,7 @@ diff -urN /usr/share/empty/Documentation/ABI/testing/debugfs-aufs linux/Document
 +		will be empty. About XINO files, see the aufs manual.
 diff -urN /usr/share/empty/Documentation/ABI/testing/sysfs-aufs linux/Documentation/ABI/testing/sysfs-aufs
 --- /usr/share/empty/Documentation/ABI/testing/sysfs-aufs	1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/ABI/testing/sysfs-aufs	2012-07-22 19:57:03.161004529 +0200
++++ linux/Documentation/ABI/testing/sysfs-aufs	2012-08-26 08:39:00.753841216 +0200
 @@ -0,0 +1,24 @@
 +What:		/sys/fs/aufs/si_<id>/
 +Date:		March 2009
@@ -487,7 +487,7 @@ diff -urN /usr/share/empty/Documentation/ABI/testing/sysfs-aufs linux/Documentat
 +		will be empty. About XINO files, see the aufs manual.
 diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/01intro.txt linux/Documentation/filesystems/aufs/design/01intro.txt
 --- /usr/share/empty/Documentation/filesystems/aufs/design/01intro.txt	1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/filesystems/aufs/design/01intro.txt	2012-07-22 19:57:03.161004531 +0200
++++ linux/Documentation/filesystems/aufs/design/01intro.txt	2012-08-26 08:39:00.757174634 +0200
 @@ -0,0 +1,162 @@
 +
 +# Copyright (C) 2005-2011 Junjiro R. Okajima
@@ -653,7 +653,7 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/01intro.txt lin
 +about it. But currently I have implemented it in kernel space.
 diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/02struct.txt linux/Documentation/filesystems/aufs/design/02struct.txt
 --- /usr/share/empty/Documentation/filesystems/aufs/design/02struct.txt	1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/filesystems/aufs/design/02struct.txt	2012-07-22 19:57:03.161004531 +0200
++++ linux/Documentation/filesystems/aufs/design/02struct.txt	2012-08-26 08:39:00.757174634 +0200
 @@ -0,0 +1,226 @@
 +
 +# Copyright (C) 2005-2011 Junjiro R. Okajima
@@ -883,7 +883,7 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/02struct.txt li
 +dir, aufs reverts it after copy-up.
 diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/03lookup.txt linux/Documentation/filesystems/aufs/design/03lookup.txt
 --- /usr/share/empty/Documentation/filesystems/aufs/design/03lookup.txt	1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/filesystems/aufs/design/03lookup.txt	2012-07-22 19:57:03.161004531 +0200
++++ linux/Documentation/filesystems/aufs/design/03lookup.txt	2012-08-26 08:39:00.757174634 +0200
 @@ -0,0 +1,106 @@
 +
 +# Copyright (C) 2005-2011 Junjiro R. Okajima
@@ -993,7 +993,7 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/03lookup.txt li
 +   by over-mounting something (or another method).
 diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/04branch.txt linux/Documentation/filesystems/aufs/design/04branch.txt
 --- /usr/share/empty/Documentation/filesystems/aufs/design/04branch.txt	1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/filesystems/aufs/design/04branch.txt	2012-07-22 19:57:03.161004531 +0200
++++ linux/Documentation/filesystems/aufs/design/04branch.txt	2012-08-26 08:39:00.757174634 +0200
 @@ -0,0 +1,76 @@
 +
 +# Copyright (C) 2005-2011 Junjiro R. Okajima
@@ -1073,7 +1073,7 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/04branch.txt li
 +    same named entry on the upper branch.
 diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/05wbr_policy.txt linux/Documentation/filesystems/aufs/design/05wbr_policy.txt
 --- /usr/share/empty/Documentation/filesystems/aufs/design/05wbr_policy.txt	1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/filesystems/aufs/design/05wbr_policy.txt	2012-07-22 19:57:03.161004531 +0200
++++ linux/Documentation/filesystems/aufs/design/05wbr_policy.txt	2012-08-26 08:39:00.757174634 +0200
 @@ -0,0 +1,65 @@
 +
 +# Copyright (C) 2005-2011 Junjiro R. Okajima
@@ -1142,7 +1142,7 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/05wbr_policy.tx
 +  copyup policy.
 diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/06mmap.txt linux/Documentation/filesystems/aufs/design/06mmap.txt
 --- /usr/share/empty/Documentation/filesystems/aufs/design/06mmap.txt	1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/filesystems/aufs/design/06mmap.txt	2012-07-22 19:57:03.161004531 +0200
++++ linux/Documentation/filesystems/aufs/design/06mmap.txt	2012-08-26 08:39:00.757174634 +0200
 @@ -0,0 +1,47 @@
 +
 +# Copyright (C) 2005-2011 Junjiro R. Okajima
@@ -1193,7 +1193,7 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/06mmap.txt linu
 +switching the approach.
 diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/07export.txt linux/Documentation/filesystems/aufs/design/07export.txt
 --- /usr/share/empty/Documentation/filesystems/aufs/design/07export.txt	1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/filesystems/aufs/design/07export.txt	2012-07-22 19:57:03.161004531 +0200
++++ linux/Documentation/filesystems/aufs/design/07export.txt	2012-08-26 08:39:00.757174634 +0200
 @@ -0,0 +1,59 @@
 +
 +# Copyright (C) 2005-2011 Junjiro R. Okajima
@@ -1256,7 +1256,7 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/07export.txt li
 +  lookup_one_len(), vfs_getattr(), encode_fh() and others.
 diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/08shwh.txt linux/Documentation/filesystems/aufs/design/08shwh.txt
 --- /usr/share/empty/Documentation/filesystems/aufs/design/08shwh.txt	1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/filesystems/aufs/design/08shwh.txt	2012-07-22 19:57:03.161004531 +0200
++++ linux/Documentation/filesystems/aufs/design/08shwh.txt	2012-08-26 08:39:00.757174634 +0200
 @@ -0,0 +1,53 @@
 +
 +# Copyright (C) 2005-2011 Junjiro R. Okajima
@@ -1313,7 +1313,7 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/08shwh.txt linu
 +initramfs will use it to replace the old one at the next boot.
 diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/10dynop.txt linux/Documentation/filesystems/aufs/design/10dynop.txt
 --- /usr/share/empty/Documentation/filesystems/aufs/design/10dynop.txt	1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/filesystems/aufs/design/10dynop.txt	2012-07-22 19:57:03.161004531 +0200
++++ linux/Documentation/filesystems/aufs/design/10dynop.txt	2012-08-26 08:39:00.757174634 +0200
 @@ -0,0 +1,47 @@
 +
 +# Copyright (C) 2010-2011 Junjiro R. Okajima
@@ -1364,7 +1364,7 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/10dynop.txt lin
 +vm_operations_struct for regular files only.
 diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/99plan.txt linux/Documentation/filesystems/aufs/design/99plan.txt
 --- /usr/share/empty/Documentation/filesystems/aufs/design/99plan.txt	1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/filesystems/aufs/design/99plan.txt	2012-07-22 19:57:03.161004531 +0200
++++ linux/Documentation/filesystems/aufs/design/99plan.txt	2012-08-26 08:39:00.757174634 +0200
 @@ -0,0 +1,96 @@
 +
 +# Copyright (C) 2005-2011 Junjiro R. Okajima
@@ -1464,7 +1464,7 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/99plan.txt linu
 +Otherwise from /new.
 diff -urN /usr/share/empty/Documentation/filesystems/aufs/README linux/Documentation/filesystems/aufs/README
 --- /usr/share/empty/Documentation/filesystems/aufs/README	1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/filesystems/aufs/README	2012-07-22 19:57:03.161004529 +0200
++++ linux/Documentation/filesystems/aufs/README	2012-08-26 08:39:00.757174634 +0200
 @@ -0,0 +1,330 @@
 +
 +Aufs3 -- advanced multi layered unification filesystem version 3.x
@@ -1777,7 +1777,7 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/README linux/Documenta
 +Pavel Pronskiy made a donation (2011/2).
 +Iridium and Inmarsat satellite phone retailer (www.mailasail.com), Nippy
 +	Networks (Ed Wildgoose) made a donation for hardware (2011/3).
-+Max Lekomcev (DOM-TV project) made a donation (2011/7, 12 and 2012/3).
++Max Lekomcev (DOM-TV project) made a donation (2011/7, 12 and 2012/3, 6).
 +Sam Liddicott made a donation (2011/9).
 +
 +Thank you very much.
@@ -1798,7 +1798,7 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/README linux/Documenta
 +# End: ;
 diff -urN /usr/share/empty/fs/aufs/aufs.h linux/fs/aufs/aufs.h
 --- /usr/share/empty/fs/aufs/aufs.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/aufs.h	2012-07-22 19:57:03.161004531 +0200
++++ linux/fs/aufs/aufs.h	2012-08-26 08:39:00.757174634 +0200
 @@ -0,0 +1,60 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -1862,7 +1862,7 @@ diff -urN /usr/share/empty/fs/aufs/aufs.h linux/fs/aufs/aufs.h
 +#endif /* __AUFS_H__ */
 diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 --- /usr/share/empty/fs/aufs/branch.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/branch.c	2012-07-22 19:57:03.161004531 +0200
++++ linux/fs/aufs/branch.c	2012-08-26 08:39:00.757174634 +0200
 @@ -0,0 +1,1169 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -3035,7 +3035,7 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +}
 diff -urN /usr/share/empty/fs/aufs/branch.h linux/fs/aufs/branch.h
 --- /usr/share/empty/fs/aufs/branch.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/branch.h	2012-07-22 19:57:03.161004531 +0200
++++ linux/fs/aufs/branch.h	2012-08-26 08:39:00.757174634 +0200
 @@ -0,0 +1,230 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -3269,7 +3269,7 @@ diff -urN /usr/share/empty/fs/aufs/branch.h linux/fs/aufs/branch.h
 +#endif /* __AUFS_BRANCH_H__ */
 diff -urN /usr/share/empty/fs/aufs/conf.mk linux/fs/aufs/conf.mk
 --- /usr/share/empty/fs/aufs/conf.mk	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/conf.mk	2012-07-22 19:57:03.161004531 +0200
++++ linux/fs/aufs/conf.mk	2012-08-26 08:39:00.757174634 +0200
 @@ -0,0 +1,38 @@
 +
 +AuConfStr = CONFIG_AUFS_FS=${CONFIG_AUFS_FS}
@@ -3311,7 +3311,7 @@ diff -urN /usr/share/empty/fs/aufs/conf.mk linux/fs/aufs/conf.mk
 +-include ${srctree}/${src}/conf_priv.mk
 diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 --- /usr/share/empty/fs/aufs/cpup.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/cpup.c	2012-07-22 19:57:03.161004531 +0200
++++ linux/fs/aufs/cpup.c	2012-08-26 08:39:00.757174634 +0200
 @@ -0,0 +1,1084 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -4399,7 +4399,7 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 +}
 diff -urN /usr/share/empty/fs/aufs/cpup.h linux/fs/aufs/cpup.h
 --- /usr/share/empty/fs/aufs/cpup.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/cpup.h	2012-07-22 19:57:03.161004531 +0200
++++ linux/fs/aufs/cpup.h	2012-08-26 08:39:00.757174634 +0200
 @@ -0,0 +1,81 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -4484,7 +4484,7 @@ diff -urN /usr/share/empty/fs/aufs/cpup.h linux/fs/aufs/cpup.h
 +#endif /* __AUFS_CPUP_H__ */
 diff -urN /usr/share/empty/fs/aufs/dbgaufs.c linux/fs/aufs/dbgaufs.c
 --- /usr/share/empty/fs/aufs/dbgaufs.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/dbgaufs.c	2012-07-22 19:57:03.161004531 +0200
++++ linux/fs/aufs/dbgaufs.c	2012-08-26 08:39:00.757174634 +0200
 @@ -0,0 +1,334 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -4822,7 +4822,7 @@ diff -urN /usr/share/empty/fs/aufs/dbgaufs.c linux/fs/aufs/dbgaufs.c
 +}
 diff -urN /usr/share/empty/fs/aufs/dbgaufs.h linux/fs/aufs/dbgaufs.h
 --- /usr/share/empty/fs/aufs/dbgaufs.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/dbgaufs.h	2012-07-22 19:57:03.161004531 +0200
++++ linux/fs/aufs/dbgaufs.h	2012-08-26 08:39:00.757174634 +0200
 @@ -0,0 +1,49 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -4875,7 +4875,7 @@ diff -urN /usr/share/empty/fs/aufs/dbgaufs.h linux/fs/aufs/dbgaufs.h
 +#endif /* __DBGAUFS_H__ */
 diff -urN /usr/share/empty/fs/aufs/dcsub.c linux/fs/aufs/dcsub.c
 --- /usr/share/empty/fs/aufs/dcsub.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/dcsub.c	2012-07-22 19:57:03.161004531 +0200
++++ linux/fs/aufs/dcsub.c	2012-08-26 08:39:00.757174634 +0200
 @@ -0,0 +1,243 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -5122,7 +5122,7 @@ diff -urN /usr/share/empty/fs/aufs/dcsub.c linux/fs/aufs/dcsub.c
 +}
 diff -urN /usr/share/empty/fs/aufs/dcsub.h linux/fs/aufs/dcsub.h
 --- /usr/share/empty/fs/aufs/dcsub.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/dcsub.h	2012-07-22 19:57:03.161004531 +0200
++++ linux/fs/aufs/dcsub.h	2012-08-26 08:39:00.757174634 +0200
 @@ -0,0 +1,94 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -5220,7 +5220,7 @@ diff -urN /usr/share/empty/fs/aufs/dcsub.h linux/fs/aufs/dcsub.h
 +#endif /* __AUFS_DCSUB_H__ */
 diff -urN /usr/share/empty/fs/aufs/debug.c linux/fs/aufs/debug.c
 --- /usr/share/empty/fs/aufs/debug.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/debug.c	2012-07-22 19:57:03.161004531 +0200
++++ linux/fs/aufs/debug.c	2012-08-26 08:39:00.757174634 +0200
 @@ -0,0 +1,489 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -5713,7 +5713,7 @@ diff -urN /usr/share/empty/fs/aufs/debug.c linux/fs/aufs/debug.c
 +}
 diff -urN /usr/share/empty/fs/aufs/debug.h linux/fs/aufs/debug.h
 --- /usr/share/empty/fs/aufs/debug.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/debug.h	2012-07-22 19:57:03.161004531 +0200
++++ linux/fs/aufs/debug.h	2012-08-26 08:39:00.757174634 +0200
 @@ -0,0 +1,242 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -5959,7 +5959,7 @@ diff -urN /usr/share/empty/fs/aufs/debug.h linux/fs/aufs/debug.h
 +#endif /* __AUFS_DEBUG_H__ */
 diff -urN /usr/share/empty/fs/aufs/dentry.c linux/fs/aufs/dentry.c
 --- /usr/share/empty/fs/aufs/dentry.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/dentry.c	2012-07-22 19:57:03.161004531 +0200
++++ linux/fs/aufs/dentry.c	2012-08-26 08:39:00.757174634 +0200
 @@ -0,0 +1,1140 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -6338,7 +6338,7 @@ diff -urN /usr/share/empty/fs/aufs/dentry.c linux/fs/aufs/dentry.c
 +	return ia->i_ino != h_inode->i_ino
 +		/* || ia->i_nlink != h_inode->i_nlink */
 +		|| !uid_eq(ia->i_uid, h_inode->i_uid)
-+		|| !uid_eq(ia->i_gid, h_inode->i_gid)
++		|| !gid_eq(ia->i_gid, h_inode->i_gid)
 +		|| ia->i_version != h_inode->i_version
 +/*
 +		|| ia->i_size != h_inode->i_size
@@ -7103,7 +7103,7 @@ diff -urN /usr/share/empty/fs/aufs/dentry.c linux/fs/aufs/dentry.c
 +};
 diff -urN /usr/share/empty/fs/aufs/dentry.h linux/fs/aufs/dentry.h
 --- /usr/share/empty/fs/aufs/dentry.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/dentry.h	2012-07-22 19:57:03.161004531 +0200
++++ linux/fs/aufs/dentry.h	2012-08-26 08:39:00.757174634 +0200
 @@ -0,0 +1,237 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -7344,7 +7344,7 @@ diff -urN /usr/share/empty/fs/aufs/dentry.h linux/fs/aufs/dentry.h
 +#endif /* __AUFS_DENTRY_H__ */
 diff -urN /usr/share/empty/fs/aufs/dinfo.c linux/fs/aufs/dinfo.c
 --- /usr/share/empty/fs/aufs/dinfo.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/dinfo.c	2012-07-22 19:57:03.161004531 +0200
++++ linux/fs/aufs/dinfo.c	2012-08-26 08:39:00.757174634 +0200
 @@ -0,0 +1,543 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -7891,7 +7891,7 @@ diff -urN /usr/share/empty/fs/aufs/dinfo.c linux/fs/aufs/dinfo.c
 +}
 diff -urN /usr/share/empty/fs/aufs/dir.c linux/fs/aufs/dir.c
 --- /usr/share/empty/fs/aufs/dir.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/dir.c	2012-07-22 19:57:03.161004531 +0200
++++ linux/fs/aufs/dir.c	2012-08-26 08:39:00.757174634 +0200
 @@ -0,0 +1,636 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -8531,7 +8531,7 @@ diff -urN /usr/share/empty/fs/aufs/dir.c linux/fs/aufs/dir.c
 +};
 diff -urN /usr/share/empty/fs/aufs/dir.h linux/fs/aufs/dir.h
 --- /usr/share/empty/fs/aufs/dir.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/dir.h	2012-07-22 19:57:03.161004531 +0200
++++ linux/fs/aufs/dir.h	2012-08-26 08:39:00.760508065 +0200
 @@ -0,0 +1,137 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -8672,7 +8672,7 @@ diff -urN /usr/share/empty/fs/aufs/dir.h linux/fs/aufs/dir.h
 +#endif /* __AUFS_DIR_H__ */
 diff -urN /usr/share/empty/fs/aufs/dynop.c linux/fs/aufs/dynop.c
 --- /usr/share/empty/fs/aufs/dynop.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/dynop.c	2012-07-22 19:57:03.161004531 +0200
++++ linux/fs/aufs/dynop.c	2012-08-26 08:39:00.760508065 +0200
 @@ -0,0 +1,377 @@
 +/*
 + * Copyright (C) 2010-2012 Junjiro R. Okajima
@@ -9053,7 +9053,7 @@ diff -urN /usr/share/empty/fs/aufs/dynop.c linux/fs/aufs/dynop.c
 +}
 diff -urN /usr/share/empty/fs/aufs/dynop.h linux/fs/aufs/dynop.h
 --- /usr/share/empty/fs/aufs/dynop.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/dynop.h	2012-07-22 19:57:03.161004531 +0200
++++ linux/fs/aufs/dynop.h	2012-08-26 08:39:00.760508065 +0200
 @@ -0,0 +1,76 @@
 +/*
 + * Copyright (C) 2010-2012 Junjiro R. Okajima
@@ -9133,7 +9133,7 @@ diff -urN /usr/share/empty/fs/aufs/dynop.h linux/fs/aufs/dynop.h
 +#endif /* __AUFS_DYNOP_H__ */
 diff -urN /usr/share/empty/fs/aufs/export.c linux/fs/aufs/export.c
 --- /usr/share/empty/fs/aufs/export.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/export.c	2012-07-22 19:57:03.164337936 +0200
++++ linux/fs/aufs/export.c	2012-08-26 08:39:00.760508065 +0200
 @@ -0,0 +1,810 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -9947,7 +9947,7 @@ diff -urN /usr/share/empty/fs/aufs/export.c linux/fs/aufs/export.c
 +}
 diff -urN /usr/share/empty/fs/aufs/file.c linux/fs/aufs/file.c
 --- /usr/share/empty/fs/aufs/file.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/file.c	2012-07-22 19:57:03.164337936 +0200
++++ linux/fs/aufs/file.c	2012-08-26 08:39:00.760508065 +0200
 @@ -0,0 +1,676 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -10627,8 +10627,8 @@ diff -urN /usr/share/empty/fs/aufs/file.c linux/fs/aufs/file.c
 +};
 diff -urN /usr/share/empty/fs/aufs/file.h linux/fs/aufs/file.h
 --- /usr/share/empty/fs/aufs/file.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/file.h	2012-07-22 19:57:03.164337936 +0200
-@@ -0,0 +1,306 @@
++++ linux/fs/aufs/file.h	2012-08-26 08:39:00.760508065 +0200
+@@ -0,0 +1,298 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
 + *
@@ -10712,14 +10712,6 @@ diff -urN /usr/share/empty/fs/aufs/file.h linux/fs/aufs/file.h
 +int au_do_flush(struct file *file, fl_owner_t id,
 +		int (*flush)(struct file *file, fl_owner_t id));
 +
-+#if defined(CONFIG_SECURITY) && defined(CONFIG_MMU)
-+/* security.c */
-+int au_security_mmap_file(struct file *h_file, struct vm_area_struct *vma);
-+#else
-+AuStubInt0(au_security_mmap_file, struct file *h_file,
-+	   struct vm_area_struct *vma);
-+#endif
-+
 +/* poll.c */
 +#ifdef CONFIG_AUFS_POLL
 +unsigned int aufs_poll(struct file *file, poll_table *wait);
@@ -10937,7 +10929,7 @@ diff -urN /usr/share/empty/fs/aufs/file.h linux/fs/aufs/file.h
 +#endif /* __AUFS_FILE_H__ */
 diff -urN /usr/share/empty/fs/aufs/finfo.c linux/fs/aufs/finfo.c
 --- /usr/share/empty/fs/aufs/finfo.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/finfo.c	2012-07-22 19:57:03.164337936 +0200
++++ linux/fs/aufs/finfo.c	2012-08-26 08:39:00.760508065 +0200
 @@ -0,0 +1,156 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -11097,8 +11089,8 @@ diff -urN /usr/share/empty/fs/aufs/finfo.c linux/fs/aufs/finfo.c
 +}
 diff -urN /usr/share/empty/fs/aufs/f_op.c linux/fs/aufs/f_op.c
 --- /usr/share/empty/fs/aufs/f_op.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/f_op.c	2012-07-22 19:57:03.164337936 +0200
-@@ -0,0 +1,692 @@
++++ linux/fs/aufs/f_op.c	2012-08-26 08:39:00.760508065 +0200
+@@ -0,0 +1,727 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
 + *
@@ -11546,6 +11538,41 @@ diff -urN /usr/share/empty/fs/aufs/f_op.c linux/fs/aufs/f_op.c
 + * The similar scenario is applied to aufs_readlink() too.
 + */
 +
++/* cf. linux/include/linux/mman.h: calc_vm_prot_bits() */
++#define AuConv_VM_PROT(f, b)	_calc_vm_trans(f, VM_##b, PROT_##b)
++
++static unsigned long au_arch_prot_conv(unsigned long flags)
++{
++	/* currently ppc64 only */
++#ifdef CONFIG_PPC64
++	/* cf. linux/arch/powerpc/include/asm/mman.h */
++	AuDebugOn(arch_calc_vm_prot_bits(-1) != VM_SAO);
++	return AuConv_VM_PROT(flags, SAO);
++#else
++	AuDebugOn(arch_calc_vm_prot_bits(-1));
++	return 0;
++#endif
++}
++
++static unsigned long au_prot_conv(unsigned long flags)
++{
++	return AuConv_VM_PROT(flags, READ)
++		| AuConv_VM_PROT(flags, WRITE)
++		| AuConv_VM_PROT(flags, EXEC)
++		| au_arch_prot_conv(flags);
++}
++
++/* cf. linux/include/linux/mman.h: calc_vm_flag_bits() */
++#define AuConv_VM_MAP(f, b)	_calc_vm_trans(f, VM_##b, MAP_##b)
++
++static unsigned long au_flag_conv(unsigned long flags)
++{
++	return AuConv_VM_MAP(flags, GROWSDOWN)
++		| AuConv_VM_MAP(flags, DENYWRITE)
++		| AuConv_VM_MAP(flags, EXECUTABLE)
++		| AuConv_VM_MAP(flags, LOCKED);
++}
++
 +static int aufs_mmap(struct file *file, struct vm_area_struct *vma)
 +{
 +	int err;
@@ -11588,8 +11615,8 @@ diff -urN /usr/share/empty/fs/aufs/f_op.c linux/fs/aufs/f_op.c
 +	lockdep_on();
 +
 +	au_vm_file_reset(vma, h_file);
-+	/* todo: bad approach, I am not sure this is really necessary */
-+	err = au_security_mmap_file(h_file, vma);
++	err = security_mmap_file(h_file, au_prot_conv(vma->vm_flags),
++				 au_flag_conv(vma->vm_flags));
 +	if (!err)
 +		err = h_file->f_op->mmap(h_file, vma);
 +	if (unlikely(err))
@@ -11793,7 +11820,7 @@ diff -urN /usr/share/empty/fs/aufs/f_op.c linux/fs/aufs/f_op.c
 +};
 diff -urN /usr/share/empty/fs/aufs/f_op_sp.c linux/fs/aufs/f_op_sp.c
 --- /usr/share/empty/fs/aufs/f_op_sp.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/f_op_sp.c	2012-07-22 19:57:03.164337936 +0200
++++ linux/fs/aufs/f_op_sp.c	2012-08-26 08:39:00.760508065 +0200
 @@ -0,0 +1,295 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -12092,7 +12119,7 @@ diff -urN /usr/share/empty/fs/aufs/f_op_sp.c linux/fs/aufs/f_op_sp.c
 +}
 diff -urN /usr/share/empty/fs/aufs/fstype.h linux/fs/aufs/fstype.h
 --- /usr/share/empty/fs/aufs/fstype.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/fstype.h	2012-07-22 19:57:03.164337936 +0200
++++ linux/fs/aufs/fstype.h	2012-08-26 08:39:00.760508065 +0200
 @@ -0,0 +1,496 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -12592,7 +12619,7 @@ diff -urN /usr/share/empty/fs/aufs/fstype.h linux/fs/aufs/fstype.h
 +#endif /* __AUFS_FSTYPE_H__ */
 diff -urN /usr/share/empty/fs/aufs/hfsnotify.c linux/fs/aufs/hfsnotify.c
 --- /usr/share/empty/fs/aufs/hfsnotify.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/hfsnotify.c	2012-07-22 19:57:03.164337936 +0200
++++ linux/fs/aufs/hfsnotify.c	2012-08-26 08:39:00.760508065 +0200
 @@ -0,0 +1,257 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -12853,7 +12880,7 @@ diff -urN /usr/share/empty/fs/aufs/hfsnotify.c linux/fs/aufs/hfsnotify.c
 +};
 diff -urN /usr/share/empty/fs/aufs/hfsplus.c linux/fs/aufs/hfsplus.c
 --- /usr/share/empty/fs/aufs/hfsplus.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/hfsplus.c	2012-07-22 19:57:03.164337936 +0200
++++ linux/fs/aufs/hfsplus.c	2012-08-26 08:39:00.760508065 +0200
 @@ -0,0 +1,57 @@
 +/*
 + * Copyright (C) 2010-2012 Junjiro R. Okajima
@@ -12914,7 +12941,7 @@ diff -urN /usr/share/empty/fs/aufs/hfsplus.c linux/fs/aufs/hfsplus.c
 +}
 diff -urN /usr/share/empty/fs/aufs/hnotify.c linux/fs/aufs/hnotify.c
 --- /usr/share/empty/fs/aufs/hnotify.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/hnotify.c	2012-07-22 19:57:03.164337936 +0200
++++ linux/fs/aufs/hnotify.c	2012-08-26 08:39:00.760508065 +0200
 @@ -0,0 +1,712 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -13630,7 +13657,7 @@ diff -urN /usr/share/empty/fs/aufs/hnotify.c linux/fs/aufs/hnotify.c
 +}
 diff -urN /usr/share/empty/fs/aufs/iinfo.c linux/fs/aufs/iinfo.c
 --- /usr/share/empty/fs/aufs/iinfo.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/iinfo.c	2012-07-22 19:57:03.164337936 +0200
++++ linux/fs/aufs/iinfo.c	2012-08-26 08:39:00.760508065 +0200
 @@ -0,0 +1,264 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -13898,8 +13925,8 @@ diff -urN /usr/share/empty/fs/aufs/iinfo.c linux/fs/aufs/iinfo.c
 +}
 diff -urN /usr/share/empty/fs/aufs/inode.c linux/fs/aufs/inode.c
 --- /usr/share/empty/fs/aufs/inode.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/inode.c	2012-07-22 19:57:03.164337936 +0200
-@@ -0,0 +1,471 @@
++++ linux/fs/aufs/inode.c	2012-08-26 08:39:00.760508065 +0200
+@@ -0,0 +1,478 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
 + *
@@ -14228,7 +14255,7 @@ diff -urN /usr/share/empty/fs/aufs/inode.c linux/fs/aufs/inode.c
 +	struct super_block *sb;
 +	struct mutex *mtx;
 +	ino_t h_ino, ino;
-+	int err;
++	int err, lc_idx;
 +	aufs_bindex_t bstart;
 +
 +	sb = dentry->d_sb;
@@ -14269,6 +14296,13 @@ diff -urN /usr/share/empty/fs/aufs/inode.c linux/fs/aufs/inode.c
 +
 +	AuDbg("%lx, new %d\n", inode->i_state, !!(inode->i_state & I_NEW));
 +	if (inode->i_state & I_NEW) {
++		lc_idx = AuLcNonDir_IIINFO;
++		if (S_ISLNK(h_inode->i_mode))
++			lc_idx = AuLcSymlink_IIINFO;
++		else if (S_ISDIR(h_inode->i_mode))
++			lc_idx = AuLcDir_IIINFO;
++		au_rw_class(&au_ii(inode)->ii_rwsem, au_lc_key + lc_idx);
++
 +		ii_write_lock_new_child(inode);
 +		err = set_inode(inode, dentry);
 +		if (!err) {
@@ -14358,7 +14392,7 @@ diff -urN /usr/share/empty/fs/aufs/inode.c linux/fs/aufs/inode.c
 +
 +int au_test_h_perm(struct inode *h_inode, int mask)
 +{
-+	if (current_fsuid() == GLOBAL_ROOT_GID)
++	if (uid_eq(current_fsuid(), GLOBAL_ROOT_UID))
 +		return 0;
 +	return inode_permission(h_inode, mask);
 +}
@@ -14373,7 +14407,7 @@ diff -urN /usr/share/empty/fs/aufs/inode.c linux/fs/aufs/inode.c
 +}
 diff -urN /usr/share/empty/fs/aufs/inode.h linux/fs/aufs/inode.h
 --- /usr/share/empty/fs/aufs/inode.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/inode.h	2012-07-22 19:57:03.164337936 +0200
++++ linux/fs/aufs/inode.h	2012-08-26 08:39:00.760508065 +0200
 @@ -0,0 +1,560 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -14937,7 +14971,7 @@ diff -urN /usr/share/empty/fs/aufs/inode.h linux/fs/aufs/inode.h
 +#endif /* __AUFS_INODE_H__ */
 diff -urN /usr/share/empty/fs/aufs/ioctl.c linux/fs/aufs/ioctl.c
 --- /usr/share/empty/fs/aufs/ioctl.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/ioctl.c	2012-07-22 19:57:03.164337936 +0200
++++ linux/fs/aufs/ioctl.c	2012-08-26 08:39:00.760508065 +0200
 @@ -0,0 +1,196 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -15137,7 +15171,7 @@ diff -urN /usr/share/empty/fs/aufs/ioctl.c linux/fs/aufs/ioctl.c
 +#endif
 diff -urN /usr/share/empty/fs/aufs/i_op_add.c linux/fs/aufs/i_op_add.c
 --- /usr/share/empty/fs/aufs/i_op_add.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/i_op_add.c	2012-07-22 19:57:03.164337936 +0200
++++ linux/fs/aufs/i_op_add.c	2012-08-26 08:39:00.760508065 +0200
 @@ -0,0 +1,712 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -15853,8 +15887,8 @@ diff -urN /usr/share/empty/fs/aufs/i_op_add.c linux/fs/aufs/i_op_add.c
 +}
 diff -urN /usr/share/empty/fs/aufs/i_op.c linux/fs/aufs/i_op.c
 --- /usr/share/empty/fs/aufs/i_op.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/i_op.c	2012-07-22 19:57:03.164337936 +0200
-@@ -0,0 +1,1014 @@
++++ linux/fs/aufs/i_op.c	2012-08-26 08:39:00.760508065 +0200
+@@ -0,0 +1,1009 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
 + *
@@ -16063,18 +16097,13 @@ diff -urN /usr/share/empty/fs/aufs/i_op.c linux/fs/aufs/i_op.c
 +	ret = d_splice_alias(inode, dentry);
 +	if (unlikely(IS_ERR(ret) && inode)) {
 +		ii_write_unlock(inode);
-+		lc_idx = AuLcNonDir_IIINFO;
-+		if (S_ISLNK(inode->i_mode))
-+			lc_idx = AuLcSymlink_IIINFO;
-+		else if (S_ISDIR(inode->i_mode))
-+			lc_idx = AuLcDir_IIINFO;
-+		au_rw_class(&au_ii(inode)->ii_rwsem, au_lc_key + lc_idx);
 +		iput(inode);
++		inode = NULL;
 +	}
 +
 +out_unlock:
 +	di_write_unlock(dentry);
-+	if (unlikely(IS_ERR(ret) && inode)) {
++	if (inode) {
 +		lc_idx = AuLcNonDir_DIINFO;
 +		if (S_ISLNK(inode->i_mode))
 +			lc_idx = AuLcSymlink_DIINFO;
@@ -16871,7 +16900,7 @@ diff -urN /usr/share/empty/fs/aufs/i_op.c linux/fs/aufs/i_op.c
 +};
 diff -urN /usr/share/empty/fs/aufs/i_op_del.c linux/fs/aufs/i_op_del.c
 --- /usr/share/empty/fs/aufs/i_op_del.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/i_op_del.c	2012-07-22 19:57:03.164337936 +0200
++++ linux/fs/aufs/i_op_del.c	2012-08-26 08:39:00.760508065 +0200
 @@ -0,0 +1,478 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -17353,7 +17382,7 @@ diff -urN /usr/share/empty/fs/aufs/i_op_del.c linux/fs/aufs/i_op_del.c
 +}
 diff -urN /usr/share/empty/fs/aufs/i_op_ren.c linux/fs/aufs/i_op_ren.c
 --- /usr/share/empty/fs/aufs/i_op_ren.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/i_op_ren.c	2012-07-22 19:57:03.164337936 +0200
++++ linux/fs/aufs/i_op_ren.c	2012-08-26 08:39:00.760508065 +0200
 @@ -0,0 +1,1026 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -18383,7 +18412,7 @@ diff -urN /usr/share/empty/fs/aufs/i_op_ren.c linux/fs/aufs/i_op_ren.c
 +}
 diff -urN /usr/share/empty/fs/aufs/Kconfig linux/fs/aufs/Kconfig
 --- /usr/share/empty/fs/aufs/Kconfig	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/Kconfig	2012-07-22 19:57:03.161004531 +0200
++++ linux/fs/aufs/Kconfig	2012-08-26 08:39:00.757174634 +0200
 @@ -0,0 +1,203 @@
 +config AUFS_FS
 +	tristate "Aufs (Advanced multi layered unification filesystem) support"
@@ -18590,7 +18619,7 @@ diff -urN /usr/share/empty/fs/aufs/Kconfig linux/fs/aufs/Kconfig
 +endif
 diff -urN /usr/share/empty/fs/aufs/loop.c linux/fs/aufs/loop.c
 --- /usr/share/empty/fs/aufs/loop.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/loop.c	2012-07-22 19:57:03.164337936 +0200
++++ linux/fs/aufs/loop.c	2012-08-26 08:39:00.760508065 +0200
 @@ -0,0 +1,133 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -18727,7 +18756,7 @@ diff -urN /usr/share/empty/fs/aufs/loop.c linux/fs/aufs/loop.c
 +}
 diff -urN /usr/share/empty/fs/aufs/loop.h linux/fs/aufs/loop.h
 --- /usr/share/empty/fs/aufs/loop.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/loop.h	2012-07-22 19:57:03.164337936 +0200
++++ linux/fs/aufs/loop.h	2012-08-26 08:39:00.760508065 +0200
 @@ -0,0 +1,50 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -18781,7 +18810,7 @@ diff -urN /usr/share/empty/fs/aufs/loop.h linux/fs/aufs/loop.h
 +#endif /* __AUFS_LOOP_H__ */
 diff -urN /usr/share/empty/fs/aufs/magic.mk linux/fs/aufs/magic.mk
 --- /usr/share/empty/fs/aufs/magic.mk	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/magic.mk	2012-07-22 19:57:03.164337936 +0200
++++ linux/fs/aufs/magic.mk	2012-08-26 08:39:00.760508065 +0200
 @@ -0,0 +1,54 @@
 +
 +# defined in ${srctree}/fs/fuse/inode.c
@@ -18839,8 +18868,8 @@ diff -urN /usr/share/empty/fs/aufs/magic.mk linux/fs/aufs/magic.mk
 +endif
 diff -urN /usr/share/empty/fs/aufs/Makefile linux/fs/aufs/Makefile
 --- /usr/share/empty/fs/aufs/Makefile	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/Makefile	2012-07-22 19:57:03.161004531 +0200
-@@ -0,0 +1,45 @@
++++ linux/fs/aufs/Makefile	2012-08-26 08:39:00.757174634 +0200
+@@ -0,0 +1,42 @@
 +
 +include ${src}/magic.mk
 +ifeq (${CONFIG_AUFS_FS},m)
@@ -18880,15 +18909,12 @@ diff -urN /usr/share/empty/fs/aufs/Makefile linux/fs/aufs/Makefile
 +aufs-$(CONFIG_AUFS_POLL) += poll.o
 +aufs-$(CONFIG_AUFS_RDU) += rdu.o
 +aufs-$(CONFIG_AUFS_SP_IATTR) += f_op_sp.o
-+ifdef CONFIG_MMU
-+aufs-$(CONFIG_SECURITY) += security.o
-+endif
 +aufs-$(CONFIG_AUFS_BR_HFSPLUS) += hfsplus.o
 +aufs-$(CONFIG_AUFS_DEBUG) += debug.o
 +aufs-$(CONFIG_AUFS_MAGIC_SYSRQ) += sysrq.o
 diff -urN /usr/share/empty/fs/aufs/module.c linux/fs/aufs/module.c
 --- /usr/share/empty/fs/aufs/module.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/module.c	2012-07-22 19:57:03.164337936 +0200
++++ linux/fs/aufs/module.c	2012-08-26 08:39:00.760508065 +0200
 @@ -0,0 +1,196 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -19088,7 +19114,7 @@ diff -urN /usr/share/empty/fs/aufs/module.c linux/fs/aufs/module.c
 +module_exit(aufs_exit);
 diff -urN /usr/share/empty/fs/aufs/module.h linux/fs/aufs/module.h
 --- /usr/share/empty/fs/aufs/module.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/module.h	2012-07-22 19:57:03.164337936 +0200
++++ linux/fs/aufs/module.h	2012-08-26 08:39:00.760508065 +0200
 @@ -0,0 +1,105 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -19197,7 +19223,7 @@ diff -urN /usr/share/empty/fs/aufs/module.h linux/fs/aufs/module.h
 +#endif /* __AUFS_MODULE_H__ */
 diff -urN /usr/share/empty/fs/aufs/opts.c linux/fs/aufs/opts.c
 --- /usr/share/empty/fs/aufs/opts.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/opts.c	2012-07-22 19:57:03.164337936 +0200
++++ linux/fs/aufs/opts.c	2012-08-26 08:39:00.760508065 +0200
 @@ -0,0 +1,1677 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -20878,7 +20904,7 @@ diff -urN /usr/share/empty/fs/aufs/opts.c linux/fs/aufs/opts.c
 +}
 diff -urN /usr/share/empty/fs/aufs/opts.h linux/fs/aufs/opts.h
 --- /usr/share/empty/fs/aufs/opts.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/opts.h	2012-07-22 19:57:03.164337936 +0200
++++ linux/fs/aufs/opts.h	2012-08-26 08:39:00.760508065 +0200
 @@ -0,0 +1,209 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -21091,7 +21117,7 @@ diff -urN /usr/share/empty/fs/aufs/opts.h linux/fs/aufs/opts.h
 +#endif /* __AUFS_OPTS_H__ */
 diff -urN /usr/share/empty/fs/aufs/plink.c linux/fs/aufs/plink.c
 --- /usr/share/empty/fs/aufs/plink.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/plink.c	2012-07-22 19:57:03.164337936 +0200
++++ linux/fs/aufs/plink.c	2012-08-26 08:39:00.763841498 +0200
 @@ -0,0 +1,511 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -21332,7 +21358,7 @@ diff -urN /usr/share/empty/fs/aufs/plink.c linux/fs/aufs/plink.c
 +	h_dir = h_parent->d_inode;
 +	tgtname.len = plink_name(a, sizeof(a), inode, bindex);
 +
-+	if (current_fsuid() != GLOBAL_ROOT_GID) {
++	if (!uid_eq(current_fsuid(), GLOBAL_ROOT_UID)) {
 +		struct au_do_plink_lkup_args args = {
 +			.errp		= &h_dentry,
 +			.tgtname	= &tgtname,
@@ -21417,7 +21443,7 @@ diff -urN /usr/share/empty/fs/aufs/plink.c linux/fs/aufs/plink.c
 +	tgtname.len = plink_name(a, sizeof(a), inode, bindex);
 +
 +	/* always superio. */
-+	if (current_fsuid() != GLOBAL_ROOT_GID) {
++	if (!uid_eq(current_fsuid(), GLOBAL_ROOT_UID)) {
 +		struct do_whplink_args args = {
 +			.errp		= &err,
 +			.tgt		= &tgtname,
@@ -21606,7 +21632,7 @@ diff -urN /usr/share/empty/fs/aufs/plink.c linux/fs/aufs/plink.c
 +}
 diff -urN /usr/share/empty/fs/aufs/poll.c linux/fs/aufs/poll.c
 --- /usr/share/empty/fs/aufs/poll.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/poll.c	2012-07-22 19:57:03.164337936 +0200
++++ linux/fs/aufs/poll.c	2012-08-26 08:39:00.763841498 +0200
 @@ -0,0 +1,56 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -21666,7 +21692,7 @@ diff -urN /usr/share/empty/fs/aufs/poll.c linux/fs/aufs/poll.c
 +}
 diff -urN /usr/share/empty/fs/aufs/procfs.c linux/fs/aufs/procfs.c
 --- /usr/share/empty/fs/aufs/procfs.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/procfs.c	2012-07-22 19:57:03.164337936 +0200
++++ linux/fs/aufs/procfs.c	2012-08-26 08:39:00.763841498 +0200
 @@ -0,0 +1,170 @@
 +/*
 + * Copyright (C) 2010-2012 Junjiro R. Okajima
@@ -21840,7 +21866,7 @@ diff -urN /usr/share/empty/fs/aufs/procfs.c linux/fs/aufs/procfs.c
 +}
 diff -urN /usr/share/empty/fs/aufs/rdu.c linux/fs/aufs/rdu.c
 --- /usr/share/empty/fs/aufs/rdu.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/rdu.c	2012-07-22 19:57:03.164337936 +0200
++++ linux/fs/aufs/rdu.c	2012-08-26 08:39:00.763841498 +0200
 @@ -0,0 +1,384 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -22228,7 +22254,7 @@ diff -urN /usr/share/empty/fs/aufs/rdu.c linux/fs/aufs/rdu.c
 +#endif
 diff -urN /usr/share/empty/fs/aufs/rwsem.h linux/fs/aufs/rwsem.h
 --- /usr/share/empty/fs/aufs/rwsem.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/rwsem.h	2012-07-22 19:57:03.164337936 +0200
++++ linux/fs/aufs/rwsem.h	2012-08-26 08:39:00.763841498 +0200
 @@ -0,0 +1,188 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -22420,7 +22446,7 @@ diff -urN /usr/share/empty/fs/aufs/rwsem.h linux/fs/aufs/rwsem.h
 +#endif /* __AUFS_RWSEM_H__ */
 diff -urN /usr/share/empty/fs/aufs/sbinfo.c linux/fs/aufs/sbinfo.c
 --- /usr/share/empty/fs/aufs/sbinfo.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/sbinfo.c	2012-07-22 19:57:03.164337936 +0200
++++ linux/fs/aufs/sbinfo.c	2012-08-26 08:39:00.763841498 +0200
 @@ -0,0 +1,343 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -22765,105 +22791,9 @@ diff -urN /usr/share/empty/fs/aufs/sbinfo.c linux/fs/aufs/sbinfo.c
 +	p = radix_tree_delete(&sbinfo->au_si_pid.tree, current->pid);
 +	spin_unlock(&sbinfo->au_si_pid.tree_lock);
 +}
-diff -urN /usr/share/empty/fs/aufs/security.c linux/fs/aufs/security.c
---- /usr/share/empty/fs/aufs/security.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/security.c	2012-07-22 19:57:03.164337936 +0200
-@@ -0,0 +1,92 @@
-+/*
-+ * Copyright (C) 2012 Junjiro R. Okajima
-+ *
-+ * This program, aufs is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+ * GNU General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-+ */
-+
-+/*
-+ * securityf_file_mmap
-+ */
-+
-+#include <linux/mman.h>
-+#include <linux/security.h>
-+#include "aufs.h"
-+
-+/* cf. linux/include/linux/mman.h: calc_vm_prot_bits() */
-+#define AuConv_VM_PROT(f, b)	_calc_vm_trans(f, VM_##b, PROT_##b)
-+
-+static unsigned long au_arch_prot_conv(unsigned long flags)
-+{
-+	/* currently ppc64 only */
-+#ifdef CONFIG_PPC64
-+	/* cf. linux/arch/powerpc/include/asm/mman.h */
-+	AuDebugOn(arch_calc_vm_prot_bits(-1) != VM_SAO);
-+	return AuConv_VM_PROT(flags, SAO);
-+#else
-+	AuDebugOn(arch_calc_vm_prot_bits(-1));
-+	return 0;
-+#endif
-+}
-+
-+static unsigned long au_prot_conv(unsigned long flags)
-+{
-+	return AuConv_VM_PROT(flags, READ)
-+		| AuConv_VM_PROT(flags, WRITE)
-+		| AuConv_VM_PROT(flags, EXEC)
-+		| au_arch_prot_conv(flags);
-+}
-+
-+/* cf. linux/include/linux/mman.h: calc_vm_flag_bits() */
-+#define AuConv_VM_MAP(f, b)	_calc_vm_trans(f, VM_##b, MAP_##b)
-+
-+static unsigned long au_flag_conv(unsigned long flags)
-+{
-+	return AuConv_VM_MAP(flags, GROWSDOWN)
-+		| AuConv_VM_MAP(flags, DENYWRITE)
-+		| AuConv_VM_MAP(flags, EXECUTABLE)
-+		| AuConv_VM_MAP(flags, LOCKED);
-+}
-+
-+struct au_security_mmap_file_args {
-+	int *errp;
-+	struct file *h_file;
-+	struct vm_area_struct *vma;
-+};
-+
-+/*
-+ * unnecessary to call security_mmap_file() since it doesn't have file as its
-+ * argument.
-+ */
-+static void au_call_security_mmap_file(void *args)
-+{
-+	struct au_security_mmap_file_args *a = args;
-+	*a->errp = security_mmap_file(a->h_file, au_prot_conv(a->vma->vm_flags),
-+				      au_flag_conv(a->vma->vm_flags));
-+}
-+
-+int au_security_mmap_file(struct file *h_file, struct vm_area_struct *vma)
-+{
-+	int err, wkq_err;
-+	struct au_security_mmap_file_args args = {
-+		.errp	= &err,
-+		.h_file	= h_file,
-+		.vma	= vma
-+	};
-+
-+	wkq_err = au_wkq_wait(au_call_security_mmap_file, &args);
-+	if (unlikely(wkq_err))
-+		err = wkq_err;
-+	return err;
-+}
 diff -urN /usr/share/empty/fs/aufs/spl.h linux/fs/aufs/spl.h
 --- /usr/share/empty/fs/aufs/spl.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/spl.h	2012-07-22 19:57:03.164337936 +0200
++++ linux/fs/aufs/spl.h	2012-08-26 08:39:00.763841498 +0200
 @@ -0,0 +1,62 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -22929,7 +22859,7 @@ diff -urN /usr/share/empty/fs/aufs/spl.h linux/fs/aufs/spl.h
 +#endif /* __AUFS_SPL_H__ */
 diff -urN /usr/share/empty/fs/aufs/super.c linux/fs/aufs/super.c
 --- /usr/share/empty/fs/aufs/super.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/super.c	2012-07-22 19:57:03.164337936 +0200
++++ linux/fs/aufs/super.c	2012-08-26 08:39:00.763841498 +0200
 @@ -0,0 +1,962 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -23895,7 +23825,7 @@ diff -urN /usr/share/empty/fs/aufs/super.c linux/fs/aufs/super.c
 +};
 diff -urN /usr/share/empty/fs/aufs/super.h linux/fs/aufs/super.h
 --- /usr/share/empty/fs/aufs/super.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/super.h	2012-07-22 19:57:03.164337936 +0200
++++ linux/fs/aufs/super.h	2012-08-26 08:39:00.763841498 +0200
 @@ -0,0 +1,546 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -24445,7 +24375,7 @@ diff -urN /usr/share/empty/fs/aufs/super.h linux/fs/aufs/super.h
 +#endif /* __AUFS_SUPER_H__ */
 diff -urN /usr/share/empty/fs/aufs/sysaufs.c linux/fs/aufs/sysaufs.c
 --- /usr/share/empty/fs/aufs/sysaufs.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/sysaufs.c	2012-07-22 19:57:03.167671344 +0200
++++ linux/fs/aufs/sysaufs.c	2012-08-26 08:39:00.763841498 +0200
 @@ -0,0 +1,105 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -24554,7 +24484,7 @@ diff -urN /usr/share/empty/fs/aufs/sysaufs.c linux/fs/aufs/sysaufs.c
 +}
 diff -urN /usr/share/empty/fs/aufs/sysaufs.h linux/fs/aufs/sysaufs.h
 --- /usr/share/empty/fs/aufs/sysaufs.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/sysaufs.h	2012-07-22 19:57:03.167671344 +0200
++++ linux/fs/aufs/sysaufs.h	2012-08-26 08:39:00.763841498 +0200
 @@ -0,0 +1,104 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -24662,7 +24592,7 @@ diff -urN /usr/share/empty/fs/aufs/sysaufs.h linux/fs/aufs/sysaufs.h
 +#endif /* __SYSAUFS_H__ */
 diff -urN /usr/share/empty/fs/aufs/sysfs.c linux/fs/aufs/sysfs.c
 --- /usr/share/empty/fs/aufs/sysfs.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/sysfs.c	2012-07-22 19:57:03.167671344 +0200
++++ linux/fs/aufs/sysfs.c	2012-08-26 08:39:00.763841498 +0200
 @@ -0,0 +1,257 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -24923,7 +24853,7 @@ diff -urN /usr/share/empty/fs/aufs/sysfs.c linux/fs/aufs/sysfs.c
 +}
 diff -urN /usr/share/empty/fs/aufs/sysrq.c linux/fs/aufs/sysrq.c
 --- /usr/share/empty/fs/aufs/sysrq.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/sysrq.c	2012-07-22 19:57:03.167671344 +0200
++++ linux/fs/aufs/sysrq.c	2012-08-26 08:39:00.763841498 +0200
 @@ -0,0 +1,148 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -25075,7 +25005,7 @@ diff -urN /usr/share/empty/fs/aufs/sysrq.c linux/fs/aufs/sysrq.c
 +}
 diff -urN /usr/share/empty/fs/aufs/vdir.c linux/fs/aufs/vdir.c
 --- /usr/share/empty/fs/aufs/vdir.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/vdir.c	2012-07-22 19:57:03.167671344 +0200
++++ linux/fs/aufs/vdir.c	2012-08-26 08:39:00.763841498 +0200
 @@ -0,0 +1,885 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -25964,7 +25894,7 @@ diff -urN /usr/share/empty/fs/aufs/vdir.c linux/fs/aufs/vdir.c
 +}
 diff -urN /usr/share/empty/fs/aufs/vfsub.c linux/fs/aufs/vfsub.c
 --- /usr/share/empty/fs/aufs/vfsub.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/vfsub.c	2012-07-22 19:57:03.167671344 +0200
++++ linux/fs/aufs/vfsub.c	2012-08-26 08:39:00.763841498 +0200
 @@ -0,0 +1,832 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -26800,7 +26730,7 @@ diff -urN /usr/share/empty/fs/aufs/vfsub.c linux/fs/aufs/vfsub.c
 +}
 diff -urN /usr/share/empty/fs/aufs/vfsub.h linux/fs/aufs/vfsub.h
 --- /usr/share/empty/fs/aufs/vfsub.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/vfsub.h	2012-07-22 19:57:03.167671344 +0200
++++ linux/fs/aufs/vfsub.h	2012-08-26 08:39:00.763841498 +0200
 @@ -0,0 +1,252 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -27056,7 +26986,7 @@ diff -urN /usr/share/empty/fs/aufs/vfsub.h linux/fs/aufs/vfsub.h
 +#endif /* __AUFS_VFSUB_H__ */
 diff -urN /usr/share/empty/fs/aufs/wbr_policy.c linux/fs/aufs/wbr_policy.c
 --- /usr/share/empty/fs/aufs/wbr_policy.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/wbr_policy.c	2012-07-22 19:57:03.167671344 +0200
++++ linux/fs/aufs/wbr_policy.c	2012-08-26 08:39:00.763841498 +0200
 @@ -0,0 +1,700 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -27760,7 +27690,7 @@ diff -urN /usr/share/empty/fs/aufs/wbr_policy.c linux/fs/aufs/wbr_policy.c
 +};
 diff -urN /usr/share/empty/fs/aufs/whout.c linux/fs/aufs/whout.c
 --- /usr/share/empty/fs/aufs/whout.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/whout.c	2012-07-22 19:57:03.167671344 +0200
++++ linux/fs/aufs/whout.c	2012-08-26 08:39:00.763841498 +0200
 @@ -0,0 +1,1041 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -28805,7 +28735,7 @@ diff -urN /usr/share/empty/fs/aufs/whout.c linux/fs/aufs/whout.c
 +}
 diff -urN /usr/share/empty/fs/aufs/whout.h linux/fs/aufs/whout.h
 --- /usr/share/empty/fs/aufs/whout.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/whout.h	2012-07-22 19:57:03.167671344 +0200
++++ linux/fs/aufs/whout.h	2012-08-26 08:39:00.763841498 +0200
 @@ -0,0 +1,88 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -28897,7 +28827,7 @@ diff -urN /usr/share/empty/fs/aufs/whout.h linux/fs/aufs/whout.h
 +#endif /* __AUFS_WHOUT_H__ */
 diff -urN /usr/share/empty/fs/aufs/wkq.c linux/fs/aufs/wkq.c
 --- /usr/share/empty/fs/aufs/wkq.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/wkq.c	2012-07-22 19:57:03.167671344 +0200
++++ linux/fs/aufs/wkq.c	2012-08-26 08:39:00.763841498 +0200
 @@ -0,0 +1,214 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -28947,7 +28877,7 @@ diff -urN /usr/share/empty/fs/aufs/wkq.c linux/fs/aufs/wkq.c
 +{
 +	struct au_wkinfo *wkinfo = container_of(wk, struct au_wkinfo, wk);
 +
-+	AuDebugOn(current_fsuid() != GLOBAL_ROOT_GID);
++	AuDebugOn(!uid_eq(current_fsuid(), GLOBAL_ROOT_UID));
 +	AuDebugOn(rlimit(RLIMIT_FSIZE) != RLIM_INFINITY);
 +
 +	wkinfo->func(wkinfo->args);
@@ -29115,7 +29045,7 @@ diff -urN /usr/share/empty/fs/aufs/wkq.c linux/fs/aufs/wkq.c
 +}
 diff -urN /usr/share/empty/fs/aufs/wkq.h linux/fs/aufs/wkq.h
 --- /usr/share/empty/fs/aufs/wkq.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/wkq.h	2012-07-22 19:57:03.167671344 +0200
++++ linux/fs/aufs/wkq.h	2012-08-26 08:39:00.763841498 +0200
 @@ -0,0 +1,92 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -29211,7 +29141,7 @@ diff -urN /usr/share/empty/fs/aufs/wkq.h linux/fs/aufs/wkq.h
 +#endif /* __AUFS_WKQ_H__ */
 diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 --- /usr/share/empty/fs/aufs/xino.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/xino.c	2012-07-22 19:57:03.167671344 +0200
++++ linux/fs/aufs/xino.c	2012-08-26 08:39:00.763841498 +0200
 @@ -0,0 +1,1264 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -30479,7 +30409,7 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +}
 diff -urN /usr/share/empty/include/linux/aufs_type.h linux/include/linux/aufs_type.h
 --- /usr/share/empty/include/linux/aufs_type.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/include/linux/aufs_type.h	2012-07-22 19:57:03.167671344 +0200
++++ linux/include/linux/aufs_type.h	2012-08-26 08:39:00.763841498 +0200
 @@ -0,0 +1,233 @@
 +/*
 + * Copyright (C) 2005-2012 Junjiro R. Okajima
@@ -30522,7 +30452,7 @@ diff -urN /usr/share/empty/include/linux/aufs_type.h linux/include/linux/aufs_ty
 +
 +#include <linux/limits.h>
 +
-+#define AUFS_VERSION	"3.x-rcN-20120618"
++#define AUFS_VERSION	"3.5-20120813"
 +
 +/* todo? move this to linux-2.6.19/include/magic.h */
 +#define AUFS_SUPER_MAGIC	('a' << 24 | 'u' << 16 | 'f' << 8 | 's')
@@ -30714,3 +30644,4 @@ diff -urN /usr/share/empty/include/linux/aufs_type.h linux/include/linux/aufs_ty
 +#define AUFS_CTL_IBUSY		_IOWR(AuCtlType, AuCtl_IBUSY, struct aufs_ibusy)
 +
 +#endif /* __AUFS_TYPE_H__ */
+
diff --git a/kernel-small_fixes.patch b/kernel-small_fixes.patch
index 5f61c75..d30a20a 100644
--- a/kernel-small_fixes.patch
+++ b/kernel-small_fixes.patch
@@ -78,3 +78,615 @@ index 7a0c800..ec5ebbb 100644
  		if (bindex < orig_bstart || bindex > orig_bend) {
  			dput(lower_dentry);
 
+From patchwork Sun Aug 12 11:57:49 2012
+Content-Type: text/plain; charset="utf-8"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+Subject: sp5100_tco: Add SB8x0 chipset support
+Date: Sun, 12 Aug 2012 11:57:49 -0000
+From: Takahisa Tanaka <mc74hc00 at gmail.com>
+X-Patchwork-Id: 1309571
+Message-Id: <1344772669-2872-1-git-send-email-mc74hc00 at gmail.com>
+To: linux-watchdog at vger.kernel.org
+Cc: wim at iguana.be, stable at kernel.org,
+ paulepanter at users.sourceforge.net, post+kernel at ralfj.de,
+ linux-kernel at vger.kernel.org, Takahisa Tanaka <mc74hc00 at gmail.com>
+
+The current sp5100_tco driver only supports SP5100/SB7x0 chipset, doesn't
+support SB8x0 chipset, because current sp5100_tco driver doesn't know that the
+offset address for watchdog timer was changed from SB8x0 chipset.
+
+The offset address of SP5100 and SB7x0 chipsets are as follows, quote from the
+AMD SB700/710/750 Register Reference Guide(Page 164) and the AMD SP5100
+Register Reference Guide(Page 166).
+
+  WatchDogTimerControl 69h
+  WatchDogTimerBase0   6Ch
+  WatchDogTimerBase1   6Dh
+  WatchDogTimerBase2   6Eh
+  WatchDogTimerBase3   6Fh
+
+In contrast, the offset address of SB8x0 chipset is as follows, quote from
+AMD SB800-Series Southbridges Register Reference Guide(Page 147).
+
+  WatchDogTimerEn      48h
+  WatchDogTimerConfig  4Ch
+
+So, In the case of SB8x0 chipset, sp5100_tco reads meaningless MMIO
+address(for example, 0xbafe00) from wrong offset address, and the following
+message is logged.
+
+   SP5100 TCO timer: mmio address 0xbafe00 already in use
+
+With this patch, sp5100_tco driver supports SB8x0 chipset, and can avoid
+iomem resource conflict. The processing of this patch is as follows.
+
+ Step 1) Attempt to get the watchdog base address from indirect I/O(0xCD6
+         and 0xCD7).
+  - Go to the step 7 if obtained address hasn't conflicted with other
+    resource. But, currently, the address(0xfec000f0) conflicts with the
+    IOAPIC MMIO address, and the following message is logged.
+
+       SP5100 TCO timer: mmio address 0xfec000f0 already in use
+
+    0xfec000f0 is recommended by AMD BIOS Developer's Guide. So, go to the
+    next step.
+
+ Step 2) Attempt to get the SBResource_MMIO base address from AcpiMmioEN(for
+         SB8x0,  PM_Reg:24h) or SBResource_MMIO(SP5100/SB7x0, PCI_Reg:9Ch)
+         register.
+  - Go to the step 7 if these register has enabled by BIOS, and obtained
+    address hasn't conflicted with other resource.
+  - If above condition isn't true, go to the next step.
+
+ Step 3) Attempt to get the free MMIO address from allocate_resource().
+  - Go to the step 7 if these register has enabled by BIOS, and obtained
+    address hasn't conflicted with other resource.
+  - Driver initialization has failed if obtained address has conflicted
+    with other resource, and no 'force_addr' parameter is specified.
+
+ Step 4) Use the specified address If 'force_addr' parameter is specified.
+  - allocate_resource() function may fail, when the PCI bridge device occupies
+    iomem resource from 0xf0000000 to 0xffffffff. To handle such a case,
+    I added 'force_addr' parameter to sp5100_tco driver. With 'force_addr'
+    parameter, sp5100_tco driver directly can assign MMIO address for watchdog
+    timer from free iomem region. Note that It's dangerous to specify wrong
+    address in the 'force_addr' parameter.
+
+      Example of force_addr parameter use
+        # cat /proc/iomem
+        ...snip...
+        fec00000-fec003ff : IOAPIC 0
+                                      <--- free MMIO region
+        fec10000-fec1001f : pnp 00:0b
+        fec20000-fec203ff : IOAPIC 1
+        ...snip...
+        # cat /etc/modprobe.d/sp5100_tco.conf
+        options sp5100_tco force_addr=0xfec00800
+        # modprobe sp5100_tco
+        # cat /proc/iomem
+        ...snip...
+        fec00000-fec003ff : IOAPIC 0
+        fec00800-fec00807 : SP5100 TCO  <--- watchdog timer MMIO address
+        fec10000-fec1001f : pnp 00:0b
+        fec20000-fec203ff : IOAPIC 1
+        ...snip...
+        #
+
+  - Driver initialization has failed if specified address has conflicted
+    with other resource.
+
+ Step 5) Disable the watchdog timer
+  - To rewrite the watchdog timer register of the chipset, absolutely
+    guarantee that the watchdog timer is disabled.
+
+ Step 6) Re-program the watchdog timer MMIO address to chipset.
+  - Re-program the obtained MMIO address in Step 3 or Step 4 to chipset via
+    indirect I/O(0xCD6 and 0xCD7).
+
+ Step 7) Enable and setup the watchdog timer
+
+This patch has worked fine on my test environment(ASUS M4A89GTD-PRO/USB3 and
+DL165G7). therefore I believe that it's no problem to re-program the MMIO
+address for watchdog timer to chipset during disabled watchdog. However,
+I'm not sure about it, because I don't know much about chipset programming.
+
+So, any comments will be welcome.
+
+Tested-by: Paul Menzel <paulepanter at users.sourceforge.net>
+CC: stable at kernel.org
+Signed-off-by: Takahisa Tanaka <mc74hc00 at gmail.com>
+
+---
+drivers/watchdog/sp5100_tco.c | 291 ++++++++++++++++++++++++++++++++++++------
+ drivers/watchdog/sp5100_tco.h |  46 +++++--
+ 2 files changed, 286 insertions(+), 51 deletions(-)
+
+diff --git a/drivers/watchdog/sp5100_tco.c b/drivers/watchdog/sp5100_tco.c
+index ae5e82c..36e917f 100644
+--- a/drivers/watchdog/sp5100_tco.c
++++ b/drivers/watchdog/sp5100_tco.c
+@@ -13,7 +13,9 @@
+  *	as published by the Free Software Foundation; either version
+  *	2 of the License, or (at your option) any later version.
+  *
+- *	See AMD Publication 43009 "AMD SB700/710/750 Register Reference Guide"
++ *	See AMD Publication 43009 "AMD SB700/710/750 Register Reference Guide",
++ *	    AMD Publication 45482 "AMD SB800-Series Sourthbridges Register
++ *	                                                      Reference Guide"
+  */
+ 
+ /*
+@@ -38,18 +40,23 @@
+ #include "sp5100_tco.h"
+ 
+ /* Module and version information */
+-#define TCO_VERSION "0.01"
++#define TCO_VERSION "0.03"
+ #define TCO_MODULE_NAME "SP5100 TCO timer"
+ #define TCO_DRIVER_NAME   TCO_MODULE_NAME ", v" TCO_VERSION
+ 
+ /* internal variables */
+ static u32 tcobase_phys;
++static u32 resbase_phys;
+ static void __iomem *tcobase;
+ static unsigned int pm_iobase;
+ static DEFINE_SPINLOCK(tco_lock);	/* Guards the hardware */
+ static unsigned long timer_alive;
+ static char tco_expect_close;
+ static struct pci_dev *sp5100_tco_pci;
++static struct resource wdt_res = {
++	.name = "Watchdog Timer",
++	.flags = IORESOURCE_MEM,
++};
+ 
+ /* the watchdog platform device */
+ static struct platform_device *sp5100_tco_platform_device;
+@@ -67,6 +74,12 @@ module_param(nowayout, bool, 0);
+ MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started"
+ 		" (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+ 
++static unsigned int force_addr;
++module_param(force_addr, uint, 0);
++MODULE_PARM_DESC(force_addr, "Force the use of specified MMIO address, "
++		"default is disabled. DON'T USE THIS PARAMETER ONLY "
++		"IF YOU REALLY KNOW WHAT YOU ARE DOING");
++
+ /*
+  * Some TCO specific functions
+  */
+@@ -122,6 +135,79 @@ static int tco_timer_set_heartbeat(int t)
+ 	return 0;
+ }
+ 
++static void tco_timer_enable(void)
++{
++	int val;
++
++	if (sp5100_tco_pci->revision >= 0x40) {
++		/* For SB800 or later */
++		/* Set the Watchdog timer resolution to 1 sec */
++		outb(SB800_PM_WATCHDOG_CONFIG, SB800_IO_PM_INDEX_REG);
++		val = inb(SB800_IO_PM_DATA_REG);
++		val |= SB800_PM_WATCHDOG_SECOND_RES;
++		outb(val, SB800_IO_PM_DATA_REG);
++
++		/* Enable watchdog decode bit and watchdog timer */
++		outb(SB800_PM_WATCHDOG_CONTROL, SB800_IO_PM_INDEX_REG);
++		val = inb(SB800_IO_PM_DATA_REG);
++		val |= SB800_PCI_WATCHDOG_DECODE_EN;
++		val &= ~SB800_PM_WATCHDOG_DISABLE;
++		outb(val, SB800_IO_PM_DATA_REG);
++	} else {
++		/* For SP5100 or SB7x0 */
++		/* Enable watchdog decode bit */
++		pci_read_config_dword(sp5100_tco_pci,
++				      SP5100_PCI_WATCHDOG_MISC_REG,
++				      &val);
++
++		val |= SP5100_PCI_WATCHDOG_DECODE_EN;
++
++		pci_write_config_dword(sp5100_tco_pci,
++				       SP5100_PCI_WATCHDOG_MISC_REG,
++				       val);
++
++		/* Enable Watchdog timer and set the resolution to 1 sec */
++		outb(SP5100_PM_WATCHDOG_CONTROL, SP5100_IO_PM_INDEX_REG);
++		val = inb(SP5100_IO_PM_DATA_REG);
++		val |= SP5100_PM_WATCHDOG_SECOND_RES;
++		val &= ~SP5100_PM_WATCHDOG_DISABLE;
++		outb(val, SP5100_IO_PM_DATA_REG);
++	}
++}
++
++static void tco_timer_disable(void)
++{
++	int val;
++
++	if (sp5100_tco_pci->revision >= 0x40) {
++		/* For SB800 or later */
++		/* Enable watchdog decode bit and Disable watchdog timer */
++		outb(SB800_PM_WATCHDOG_CONTROL, SB800_IO_PM_INDEX_REG);
++		val = inb(SB800_IO_PM_DATA_REG);
++		val |= SB800_PCI_WATCHDOG_DECODE_EN;
++		val |= SB800_PM_WATCHDOG_DISABLE;
++		outb(val, SB800_IO_PM_DATA_REG);
++	} else {
++		/* For SP5100 or SB7x0 */
++		/* Enable watchdog decode bit */
++		pci_read_config_dword(sp5100_tco_pci,
++				      SP5100_PCI_WATCHDOG_MISC_REG,
++				      &val);
++
++		val |= SP5100_PCI_WATCHDOG_DECODE_EN;
++
++		pci_write_config_dword(sp5100_tco_pci,
++				       SP5100_PCI_WATCHDOG_MISC_REG,
++				       val);
++
++		/* Disable Watchdog timer */
++		outb(SP5100_PM_WATCHDOG_CONTROL, SP5100_IO_PM_INDEX_REG);
++		val = inb(SP5100_IO_PM_DATA_REG);
++		val |= SP5100_PM_WATCHDOG_DISABLE;
++		outb(val, SP5100_IO_PM_DATA_REG);
++	}
++}
++
+ /*
+  *	/dev/watchdog handling
+  */
+@@ -270,11 +356,12 @@ MODULE_DEVICE_TABLE(pci, sp5100_tco_pci_tbl);
+ /*
+  * Init & exit routines
+  */
+-
+ static unsigned char __devinit sp5100_tco_setupdevice(void)
+ {
+ 	struct pci_dev *dev = NULL;
++	const char *dev_name = NULL;
+ 	u32 val;
++	u32 index_reg, data_reg, base_addr;
+ 
+ 	/* Match the PCI device */
+ 	for_each_pci_dev(dev) {
+@@ -287,29 +374,158 @@ static unsigned char __devinit sp5100_tco_setupdevice(void)
+ 	if (!sp5100_tco_pci)
+ 		return 0;
+ 
++	pr_info("PCI Revision ID: 0x%x\n", sp5100_tco_pci->revision);
++
++	/*
++	 * Determine type of southbridge chipset.
++	 */
++	if (sp5100_tco_pci->revision >= 0x40) {
++		dev_name = SB800_DEVNAME;
++		index_reg = SB800_IO_PM_INDEX_REG;
++		data_reg = SB800_IO_PM_DATA_REG;
++		base_addr = SB800_PM_WATCHDOG_BASE;
++	} else {
++		dev_name = SP5100_DEVNAME;
++		index_reg = SP5100_IO_PM_INDEX_REG;
++		data_reg = SP5100_IO_PM_DATA_REG;
++		base_addr = SP5100_PM_WATCHDOG_BASE;
++	}
++
+ 	/* Request the IO ports used by this driver */
+ 	pm_iobase = SP5100_IO_PM_INDEX_REG;
+-	if (!request_region(pm_iobase, SP5100_PM_IOPORTS_SIZE, "SP5100 TCO")) {
+-		pr_err("I/O address 0x%04x already in use\n", pm_iobase);
++	if (!request_region(pm_iobase, SP5100_PM_IOPORTS_SIZE, dev_name)) {
++		pr_err("I/O address 0x%08x already in use\n", pm_iobase);
+ 		goto exit;
+ 	}
+ 
+-	/* Find the watchdog base address. */
+-	outb(SP5100_PM_WATCHDOG_BASE3, SP5100_IO_PM_INDEX_REG);
+-	val = inb(SP5100_IO_PM_DATA_REG);
+-	outb(SP5100_PM_WATCHDOG_BASE2, SP5100_IO_PM_INDEX_REG);
+-	val = val << 8 | inb(SP5100_IO_PM_DATA_REG);
+-	outb(SP5100_PM_WATCHDOG_BASE1, SP5100_IO_PM_INDEX_REG);
+-	val = val << 8 | inb(SP5100_IO_PM_DATA_REG);
+-	outb(SP5100_PM_WATCHDOG_BASE0, SP5100_IO_PM_INDEX_REG);
+-	/* Low three bits of BASE0 are reserved. */
+-	val = val << 8 | (inb(SP5100_IO_PM_DATA_REG) & 0xf8);
++	/*
++	 * First, Find the watchdog timer MMIO address from indirect I/O.
++	 */
++	outb(base_addr+3, index_reg);
++	val = inb(data_reg);
++	outb(base_addr+2, index_reg);
++	val = val << 8 | inb(data_reg);
++	outb(base_addr+1, index_reg);
++	val = val << 8 | inb(data_reg);
++	outb(base_addr+0, index_reg);
++	/* Low three bits of BASE are reserved */
++	val = val << 8 | (inb(data_reg) & 0xf8);
++
++	pr_debug("Got 0x%08x from indirect I/O\n", val);
++
++	/* Check MMIO address conflict */
++	if (request_mem_region_exclusive(val, SP5100_WDT_MEM_MAP_SIZE,
++								dev_name))
++		goto setup_wdt;
++	else
++		pr_debug("MMIO address 0x%08x already in use\n", val);
++
++	/*
++	 * Second, Find the watchdog timer MMIO address
++	 * from SBResource_MMIO register.
++	 */
++	if (sp5100_tco_pci->revision >= 0x40) {
++		/* Read SBResource_MMIO from AcpiMmioEn(PM_Reg: 24h) */
++		outb(SB800_PM_ACPI_MMIO_EN+3, SB800_IO_PM_INDEX_REG);
++		val = inb(SB800_IO_PM_DATA_REG);
++		outb(SB800_PM_ACPI_MMIO_EN+2, SB800_IO_PM_INDEX_REG);
++		val = val << 8 | inb(SB800_IO_PM_DATA_REG);
++		outb(SB800_PM_ACPI_MMIO_EN+1, SB800_IO_PM_INDEX_REG);
++		val = val << 8 | inb(SB800_IO_PM_DATA_REG);
++		outb(SB800_PM_ACPI_MMIO_EN+0, SB800_IO_PM_INDEX_REG);
++		val = val << 8 | inb(SB800_IO_PM_DATA_REG);
++	} else {
++		/* Read SBResource_MMIO from PCI config(PCI_Reg: 9Ch) */
++		pci_read_config_dword(sp5100_tco_pci,
++				      SP5100_SB_RESOURCE_MMIO_BASE, &val);
++	}
++
++	/* The SBResource_MMIO is enabled and mapped memory space? */
++	if ((val & (SB800_ACPI_MMIO_DECODE_EN | SB800_ACPI_MMIO_SEL)) ==
++						  SB800_ACPI_MMIO_DECODE_EN) {
++		/* Clear unnecessary the low twelve bits */
++		val &= ~0xFFF;
++		/* Add the Watchdog Timer offset to base address. */
++		val += SB800_PM_WDT_MMIO_OFFSET;
++		/* Check mmio base address conflict */
++		if (request_mem_region_exclusive(val, SP5100_WDT_MEM_MAP_SIZE,
++								   dev_name)) {
++			pr_debug("Got 0x%08x from SBResource_MMIO register\n",
++				val);
++			goto setup_wdt;
++		} else
++			pr_debug("MMIO address 0x%08x already in use\n", val);
++	} else
++		pr_debug("SBResource_MMIO is disabled(0x%08x)\n", val);
++
++	/*
++	 * Lastly re-programming the watchdog MMIO address,
++	 * This method is a last resort...
++	 *
++	 * Before re-programming, to ensure that the watchdog timer
++	 * is disabled, disable the watchdog timer.
++	 */
++	tco_timer_disable();
++
++	if (force_addr) {
++		/* Force the use of base address */
++		val = force_addr;
++		/* The alignment of the MMIO address to a 8byte boundary */
++		val &= ~0x7;
++
++		pr_info("Force the use of 0x%08x as MMIO address\n", val);
++	} else {
++		/*
++		 * Get empty slot into the resource tree for watchdog timer.
++		 */
++		if (allocate_resource(&iomem_resource,
++				      &wdt_res,
++				      SP5100_WDT_MEM_MAP_SIZE,
++				      0xf0000000,
++				      0xfffffff8,
++				      0x8,
++				      NULL,
++				      NULL)) {
++			pr_err("MMIO allocation failed\n");
++			goto unreg_region;
++		}
++
++		val = resbase_phys = wdt_res.start;
++		pr_debug("Got 0x%08x from resource tree\n", val);
++	}
++
++	/* Restore to the low three bits, if chipset is SB8x0(or later) */
++	if (sp5100_tco_pci->revision >= 0x40) {
++		u8 reserved_bit;
++		reserved_bit = inb(base_addr) & 0x7;
++		val |= (u32)reserved_bit;
++	}
++
++	/* Re-programming the watchdog timer base address */
++	outb(base_addr+0, index_reg);
++	/* Low three bits of BASE are reserved */
++	outb((val >>  0) & 0xf8, data_reg);
++	outb(base_addr+1, index_reg);
++	outb((val >>  8) & 0xff, data_reg);
++	outb(base_addr+2, index_reg);
++	outb((val >> 16) & 0xff, data_reg);
++	outb(base_addr+3, index_reg);
++	outb((val >> 24) & 0xff, data_reg);
++
++	/*
++	 * Clear unnecessary the low three bits,
++	 * if chipset is SB8x0(or later)
++	 */
++	if (sp5100_tco_pci->revision >= 0x40)
++		val &= ~0x7;
+ 
+ 	if (!request_mem_region_exclusive(val, SP5100_WDT_MEM_MAP_SIZE,
+-								"SP5100 TCO")) {
+-		pr_err("mmio address 0x%04x already in use\n", val);
+-		goto unreg_region;
++								   dev_name)) {
++		pr_err("MMIO address 0x%08x already in use\n", val);
++		goto unreg_resource;
+ 	}
++
++setup_wdt:
+ 	tcobase_phys = val;
+ 
+ 	tcobase = ioremap(val, SP5100_WDT_MEM_MAP_SIZE);
+@@ -318,25 +534,12 @@ static unsigned char __devinit sp5100_tco_setupdevice(void)
+ 		goto unreg_mem_region;
+ 	}
+ 
+-	/* Enable watchdog decode bit */
+-	pci_read_config_dword(sp5100_tco_pci,
+-			      SP5100_PCI_WATCHDOG_MISC_REG,
+-			      &val);
+-
+-	val |= SP5100_PCI_WATCHDOG_DECODE_EN;
+-
+-	pci_write_config_dword(sp5100_tco_pci,
+-			       SP5100_PCI_WATCHDOG_MISC_REG,
+-			       val);
++	pr_info("Using 0x%08x for watchdog MMIO address\n", val);
+ 
+-	/* Enable Watchdog timer and set the resolution to 1 sec. */
+-	outb(SP5100_PM_WATCHDOG_CONTROL, SP5100_IO_PM_INDEX_REG);
+-	val = inb(SP5100_IO_PM_DATA_REG);
+-	val |= SP5100_PM_WATCHDOG_SECOND_RES;
+-	val &= ~SP5100_PM_WATCHDOG_DISABLE;
+-	outb(val, SP5100_IO_PM_DATA_REG);
++	/* Setup the watchdog timer */
++	tco_timer_enable();
+ 
+-	/* Check that the watchdog action is set to reset the system. */
++	/* Check that the watchdog action is set to reset the system */
+ 	val = readl(SP5100_WDT_CONTROL(tcobase));
+ 	val &= ~SP5100_PM_WATCHDOG_ACTION_RESET;
+ 	writel(val, SP5100_WDT_CONTROL(tcobase));
+@@ -355,6 +558,9 @@ static unsigned char __devinit sp5100_tco_setupdevice(void)
+ 
+ unreg_mem_region:
+ 	release_mem_region(tcobase_phys, SP5100_WDT_MEM_MAP_SIZE);
++unreg_resource:
++	if (resbase_phys)
++		release_resource(&wdt_res);
+ unreg_region:
+ 	release_region(pm_iobase, SP5100_PM_IOPORTS_SIZE);
+ exit:
+@@ -400,14 +606,17 @@ static int __devinit sp5100_tco_init(struct platform_device *dev)
+ 
+ 	clear_bit(0, &timer_alive);
+ 
+-	pr_info("initialized (0x%p). heartbeat=%d sec (nowayout=%d)\n",
+-		tcobase, heartbeat, nowayout);
++	pr_info("initialized (0x%p). heartbeat=%d sec (nowayout=%d, "
++		"force_addr=0x%x)\n",
++		tcobase, heartbeat, nowayout, force_addr);
+ 
+ 	return 0;
+ 
+ exit:
+ 	iounmap(tcobase);
+ 	release_mem_region(tcobase_phys, SP5100_WDT_MEM_MAP_SIZE);
++	if (resbase_phys)
++		release_resource(&wdt_res);
+ 	release_region(pm_iobase, SP5100_PM_IOPORTS_SIZE);
+ 	return ret;
+ }
+@@ -422,6 +631,8 @@ static void __devexit sp5100_tco_cleanup(void)
+ 	misc_deregister(&sp5100_tco_miscdev);
+ 	iounmap(tcobase);
+ 	release_mem_region(tcobase_phys, SP5100_WDT_MEM_MAP_SIZE);
++	if (resbase_phys)
++		release_resource(&wdt_res);
+ 	release_region(pm_iobase, SP5100_PM_IOPORTS_SIZE);
+ }
+ 
+@@ -451,7 +662,7 @@ static int __init sp5100_tco_init_module(void)
+ {
+ 	int err;
+ 
+-	pr_info("SP5100 TCO WatchDog Timer Driver v%s\n", TCO_VERSION);
++	pr_info("SP5100/SB800 TCO WatchDog Timer Driver v%s\n", TCO_VERSION);
+ 
+ 	err = platform_driver_register(&sp5100_tco_driver);
+ 	if (err)
+@@ -475,13 +686,13 @@ static void __exit sp5100_tco_cleanup_module(void)
+ {
+ 	platform_device_unregister(sp5100_tco_platform_device);
+ 	platform_driver_unregister(&sp5100_tco_driver);
+-	pr_info("SP5100 TCO Watchdog Module Unloaded\n");
++	pr_info("SP5100/SB800 TCO Watchdog Module Unloaded\n");
+ }
+ 
+ module_init(sp5100_tco_init_module);
+ module_exit(sp5100_tco_cleanup_module);
+ 
+ MODULE_AUTHOR("Priyanka Gupta");
+-MODULE_DESCRIPTION("TCO timer driver for SP5100 chipset");
++MODULE_DESCRIPTION("TCO timer driver for SP5100/SB800 chipset");
+ MODULE_LICENSE("GPL");
+ MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
+diff --git a/drivers/watchdog/sp5100_tco.h b/drivers/watchdog/sp5100_tco.h
+index a5a16cc..71594a0 100644
+--- a/drivers/watchdog/sp5100_tco.h
++++ b/drivers/watchdog/sp5100_tco.h
+@@ -9,33 +9,57 @@
+ /*
+  * Some address definitions for the Watchdog
+  */
+-
+ #define SP5100_WDT_MEM_MAP_SIZE		0x08
+ #define SP5100_WDT_CONTROL(base)	((base) + 0x00) /* Watchdog Control */
+ #define SP5100_WDT_COUNT(base)		((base) + 0x04) /* Watchdog Count */
+ 
+-#define SP5100_WDT_START_STOP_BIT	1
++#define SP5100_WDT_START_STOP_BIT	(1 << 0)
+ #define SP5100_WDT_TRIGGER_BIT		(1 << 7)
+ 
+-#define SP5100_PCI_WATCHDOG_MISC_REG	0x41
+-#define SP5100_PCI_WATCHDOG_DECODE_EN	(1 << 3)
+-
+ #define SP5100_PM_IOPORTS_SIZE		0x02
+ 
+-/* These two IO registers are hardcoded and there doesn't seem to be a way to
++/*
++ * These two IO registers are hardcoded and there doesn't seem to be a way to
+  * read them from a register.
+  */
++
++/*  For SP5100/SB7x0 chipset */
+ #define SP5100_IO_PM_INDEX_REG		0xCD6
+ #define SP5100_IO_PM_DATA_REG		0xCD7
+ 
++#define SP5100_SB_RESOURCE_MMIO_BASE	0x9C
++
+ #define SP5100_PM_WATCHDOG_CONTROL	0x69
+-#define SP5100_PM_WATCHDOG_BASE0	0x6C
+-#define SP5100_PM_WATCHDOG_BASE1	0x6D
+-#define SP5100_PM_WATCHDOG_BASE2	0x6E
+-#define SP5100_PM_WATCHDOG_BASE3	0x6F
++#define SP5100_PM_WATCHDOG_BASE		0x6C
+ 
+ #define SP5100_PM_WATCHDOG_FIRED	(1 << 1)
+ #define SP5100_PM_WATCHDOG_ACTION_RESET	(1 << 2)
+ 
+-#define SP5100_PM_WATCHDOG_DISABLE	1
++#define SP5100_PCI_WATCHDOG_MISC_REG	0x41
++#define SP5100_PCI_WATCHDOG_DECODE_EN	(1 << 3)
++
++#define SP5100_PM_WATCHDOG_DISABLE	(1 << 0)
+ #define SP5100_PM_WATCHDOG_SECOND_RES	(3 << 1)
++
++#define SP5100_DEVNAME			"SP5100 TCO"
++
++
++/*  For SB8x0(or later) chipset */
++#define SB800_IO_PM_INDEX_REG		0xCD6
++#define SB800_IO_PM_DATA_REG		0xCD7
++
++#define SB800_PM_ACPI_MMIO_EN		0x24
++#define SB800_PM_WATCHDOG_CONTROL	0x48
++#define SB800_PM_WATCHDOG_BASE		0x48
++#define SB800_PM_WATCHDOG_CONFIG	0x4C
++
++#define SB800_PCI_WATCHDOG_DECODE_EN	(1 << 0)
++#define SB800_PM_WATCHDOG_DISABLE	(1 << 2)
++#define SB800_PM_WATCHDOG_SECOND_RES	(3 << 0)
++#define SB800_ACPI_MMIO_DECODE_EN	(1 << 0)
++#define SB800_ACPI_MMIO_SEL		(1 << 2)
++
++
++#define SB800_PM_WDT_MMIO_OFFSET	0xB00
++
++#define SB800_DEVNAME			"SB800 TCO"



More information about the pld-cvs-commit mailing list