[PATCH][Mako][Manta][Flo][Goldfish]: UBUNTU: SAUCE: (no-up): apparmor: Fix backports fd_inheritance regression

John Johansen john.johansen at canonical.com
Thu Mar 5 08:57:27 UTC 2015

The backport patch series will not be upstreamed as it is for porting
current versions of apparmor to older kernel versions.

BugLink: http://bugs.launchpad.net/bugs/1423810

On pre 3.5 kernels with the apparmor 3 backport patchset (Mako, Manta,
Flo, Goldfish, ...) running the fd_inheritance test from the apparmor
regression tests causes the kernel to crash and spontaneously reboot the

This is due to a ref count bug, caused by the backport macro not correctly
dealing with changes to dentry_open introduced in the commit

Signed-off-by: John Johansen <john.johansen at canonical.com>
 security/apparmor/include/backport.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/security/apparmor/include/backport.h b/security/apparmor/include/backport.h
index 046ca70..623ed40 100644
--- a/security/apparmor/include/backport.h
+++ b/security/apparmor/include/backport.h
@@ -40,7 +40,8 @@ int replace_fd(unsigned fd, struct file *file, unsigned flags);
 #define uid_eq(X, Y) ((X) == (Y))
 /* 3.5 backport commit 765927b2d508712d320c8934db963bbe14c3fcec */
-#define dentry_open(P, F, C) (dentry_open)((P)->dentry, (P)->mnt, (F), (C))
+#include <linux/mount.h>	/* For mntget */
+#define dentry_open(P, F, C) (dentry_open)(dget((P)->dentry), mntget((P)->mnt), (F), (C))
 /* 3.4 backport, commit d007794a182bc072a7b7479909dbd0d67ba341be */
 #include <linux/capability.h>

More information about the kernel-team mailing list