userns: Convert selinux to use kuid and kgid where appropriate
Eric W. Biederman [Mon, 20 Aug 2012 07:09:36 +0000 (00:09 -0700)]
Cc: Stephen Smalley <sds@tycho.nsa.gov>
Cc: James Morris <james.l.morris@oracle.com>
Cc: Eric Paris <eparis@parisplace.org>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>

security/selinux/selinuxfs.c
security/selinux/ss/services.c

index 298e695..55af8c5 100644 (file)
@@ -174,7 +174,7 @@ static ssize_t sel_write_enforce(struct file *file, const char __user *buf,
                audit_log(current->audit_context, GFP_KERNEL, AUDIT_MAC_STATUS,
                        "enforcing=%d old_enforcing=%d auid=%u ses=%u",
                        new_value, selinux_enforcing,
-                       audit_get_loginuid(current),
+                       from_kuid(&init_user_ns, audit_get_loginuid(current)),
                        audit_get_sessionid(current));
                selinux_enforcing = new_value;
                if (selinux_enforcing)
@@ -305,7 +305,7 @@ static ssize_t sel_write_disable(struct file *file, const char __user *buf,
                        goto out;
                audit_log(current->audit_context, GFP_KERNEL, AUDIT_MAC_STATUS,
                        "selinux=0 auid=%u ses=%u",
-                       audit_get_loginuid(current),
+                       from_kuid(&init_user_ns, audit_get_loginuid(current)),
                        audit_get_sessionid(current));
        }
 
@@ -551,7 +551,7 @@ static ssize_t sel_write_load(struct file *file, const char __user *buf,
 out1:
        audit_log(current->audit_context, GFP_KERNEL, AUDIT_MAC_POLICY_LOAD,
                "policy loaded auid=%u ses=%u",
-               audit_get_loginuid(current),
+               from_kuid(&init_user_ns, audit_get_loginuid(current)),
                audit_get_sessionid(current));
 out:
        mutex_unlock(&sel_mutex);
index 4321b8f..b4feecc 100644 (file)
@@ -2440,7 +2440,7 @@ int security_set_bools(int len, int *values)
                                sym_name(&policydb, SYM_BOOLS, i),
                                !!values[i],
                                policydb.bool_val_to_struct[i]->state,
-                               audit_get_loginuid(current),
+                               from_kuid(&init_user_ns, audit_get_loginuid(current)),
                                audit_get_sessionid(current));
                }
                if (values[i])