Skip to content

Commit f5edee8

Browse files
jrjohansengregkh
authored andcommitted
apparmor: fix regression in mount mediation when feature set is pinned
commit 5b9f57c upstream. When the mount code was refactored for Labels it was not correctly updated to check whether policy supported mediation of the mount class. This causes a regression when the kernel feature set is reported as supporting mount and policy is pinned to a feature set that does not support mount mediation. BugLink: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=882697#41 Fixes: 2ea3ffb ("apparmor: add mount mediation") Reported-by: Fabian Grünbichler <f.gruenbichler@proxmox.com> Signed-off-by: John Johansen <john.johansen@canonical.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 4678964 commit f5edee8

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

‎security/apparmor/mount.c‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,9 @@ static int match_mnt_path_str(struct aa_profile *profile,
330330
AA_BUG(!mntpath);
331331
AA_BUG(!buffer);
332332

333+
if (!PROFILE_MEDIATES(profile, AA_CLASS_MOUNT))
334+
return 0;
335+
333336
error = aa_path_name(mntpath, path_flags(profile, mntpath), buffer,
334337
&mntpnt, &info, profile->disconnected);
335338
if (error)
@@ -381,6 +384,9 @@ static int match_mnt(struct aa_profile *profile, const struct path *path,
381384
AA_BUG(!profile);
382385
AA_BUG(devpath && !devbuffer);
383386

387+
if (!PROFILE_MEDIATES(profile, AA_CLASS_MOUNT))
388+
return 0;
389+
384390
if (devpath) {
385391
error = aa_path_name(devpath, path_flags(profile, devpath),
386392
devbuffer, &devname, &info,
@@ -559,6 +565,9 @@ static int profile_umount(struct aa_profile *profile, struct path *path,
559565
AA_BUG(!profile);
560566
AA_BUG(!path);
561567

568+
if (!PROFILE_MEDIATES(profile, AA_CLASS_MOUNT))
569+
return 0;
570+
562571
error = aa_path_name(path, path_flags(profile, path), buffer, &name,
563572
&info, profile->disconnected);
564573
if (error)
@@ -614,7 +623,8 @@ static struct aa_label *build_pivotroot(struct aa_profile *profile,
614623
AA_BUG(!new_path);
615624
AA_BUG(!old_path);
616625

617-
if (profile_unconfined(profile))
626+
if (profile_unconfined(profile) ||
627+
!PROFILE_MEDIATES(profile, AA_CLASS_MOUNT))
618628
return aa_get_newest_label(&profile->label);
619629

620630
error = aa_path_name(old_path, path_flags(profile, old_path),

0 commit comments

Comments
 (0)