]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
apparmor: fix mediation of prlimit
authorJohn Johansen <john.johansen@canonical.com>
Wed, 11 Apr 2018 09:03:26 +0000 (02:03 -0700)
committerSeth Forshee <seth.forshee@canonical.com>
Thu, 12 Apr 2018 15:35:37 +0000 (10:35 -0500)
BugLink: http://bugs.launchpad.net/bugs/1763427
For primit apparmor requires that if target confinement does not match
the setting task's confinement, the setting task requires CAP_SYS_RESOURCE.

Unfortunately this was broken when rlimit enforcement was reworked to
support labels.

Fixes: 86b92cb782b3 ("apparmor: move resource checks to using labels")
Signed-off-by: John Johansen <john.johansen@canonical.com>
(cherry picked from commit a4c2746f4d4b32d8557ee17821f1101fd8474f92
 git://git.kernel.org/pub/scm/linux/kernel/git/jj/linux-apparmor)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
security/apparmor/resource.c

index cf4d234febe94c9e96a8c0dc7df4d0132f856621..6db1cacb62048f4d89fda75430c95354ef6d2fdd 100644 (file)
@@ -124,7 +124,7 @@ int aa_task_setrlimit(struct aa_label *label, struct task_struct *task,
         */
 
        if (label != peer &&
-           !aa_capable(label, CAP_SYS_RESOURCE, SECURITY_CAP_NOAUDIT))
+           aa_capable(label, CAP_SYS_RESOURCE, SECURITY_CAP_NOAUDIT) != 0)
                error = fn_for_each(label, profile,
                                audit_resource(profile, resource,
                                               new_rlim->rlim_max, peer,