diff mbox

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

Message ID 54F81A77.10404@canonical.com
State New
Headers show

Commit Message

John Johansen March 5, 2015, 8:57 a.m. UTC
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
device.

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
765927b2d508712d320c8934db963bbe14c3fcec.

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

Comments

Andy Whitcroft March 10, 2015, 1:02 p.m. UTC | #1
On Thu, Mar 05, 2015 at 12:57:27AM -0800, John Johansen wrote:
> 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
> device.
> 
> 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
> 765927b2d508712d320c8934db963bbe14c3fcec.
> 
> Signed-off-by: John Johansen <john.johansen@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>

I will handle these.

-apw
diff mbox

Patch

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>