diff options
author | Eric Paris <eparis@redhat.com> | 2012-01-03 18:25:14 +0100 |
---|---|---|
committer | Eric Paris <eparis@redhat.com> | 2012-01-06 00:52:53 +0100 |
commit | 6a9de49115d5ff9871d953af1a5c8249e1585731 (patch) | |
tree | eee3700ccc2ce26c566bfe99129e646fac9f983e /security/apparmor/lsm.c | |
parent | selinux: sparse fix: fix several warnings in the security server cod (diff) | |
download | linux-6a9de49115d5ff9871d953af1a5c8249e1585731.tar.xz linux-6a9de49115d5ff9871d953af1a5c8249e1585731.zip |
capabilities: remove the task from capable LSM hook entirely
The capabilities framework is based around credentials, not necessarily the
current task. Yet we still passed the current task down into LSMs from the
security_capable() LSM hook as if it was a meaningful portion of the security
decision. This patch removes the 'generic' passing of current and instead
forces individual LSMs to use current explicitly if they think it is
appropriate. In our case those LSMs are SELinux and AppArmor.
I believe the AppArmor use of current is incorrect, but that is wholely
unrelated to this patch. This patch does not change what AppArmor does, it
just makes it clear in the AppArmor code that it is doing it.
The SELinux code still uses current in it's audit message, which may also be
wrong and needs further investigation. Again this is NOT a change, it may
have always been wrong, this patch just makes it clear what is happening.
Signed-off-by: Eric Paris <eparis@redhat.com>
Diffstat (limited to 'security/apparmor/lsm.c')
-rw-r--r-- | security/apparmor/lsm.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c index 37832026e58a..ef4e2a8a33a5 100644 --- a/security/apparmor/lsm.c +++ b/security/apparmor/lsm.c @@ -136,16 +136,16 @@ static int apparmor_capget(struct task_struct *target, kernel_cap_t *effective, return 0; } -static int apparmor_capable(struct task_struct *task, const struct cred *cred, - struct user_namespace *ns, int cap, int audit) +static int apparmor_capable(const struct cred *cred, struct user_namespace *ns, + int cap, int audit) { struct aa_profile *profile; /* cap_capable returns 0 on success, else -EPERM */ - int error = cap_capable(task, cred, ns, cap, audit); + int error = cap_capable(cred, ns, cap, audit); if (!error) { profile = aa_cred_profile(cred); if (!unconfined(profile)) - error = aa_capable(task, profile, cap, audit); + error = aa_capable(current, profile, cap, audit); } return error; } |