apparmor: fix display of .ns_name for containers
authorJohn Johansen <john.johansen@canonical.com>
Tue, 23 Jan 2018 09:47:42 +0000 (01:47 -0800)
committerJohn Johansen <john.johansen@canonical.com>
Fri, 9 Feb 2018 19:30:00 +0000 (11:30 -0800)
The .ns_name should not be virtualized by the current ns view. It
needs to report the ns base name as that is being used during startup
as part of determining apparmor policy namespace support.

BugLink: http://bugs.launchpad.net/bugs/1746463
Fixes: d9f02d9c237aa ("apparmor: fix display of ns name")
Cc: Stable <stable@vger.kernel.org>
Reported-by: Serge Hallyn <serge@hallyn.com>
Tested-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
security/apparmor/apparmorfs.c

index d4fa04d914395393289eaea5c26b344d7668325c..a23b0ca19fd09b4ba3b6d9791ca807e79c3ceaef 100644 (file)
@@ -1189,9 +1189,7 @@ static int seq_ns_level_show(struct seq_file *seq, void *v)
 static int seq_ns_name_show(struct seq_file *seq, void *v)
 {
        struct aa_label *label = begin_current_label_crit_section();
-
-       seq_printf(seq, "%s\n", aa_ns_name(labels_ns(label),
-                                          labels_ns(label), true));
+       seq_printf(seq, "%s\n", labels_ns(label)->base.name);
        end_current_label_crit_section(label);
 
        return 0;