summaryrefslogtreecommitdiffstats
path: root/security/apparmor/context.c
diff options
context:
space:
mode:
Diffstat (limited to 'security/apparmor/context.c')
-rw-r--r--security/apparmor/context.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/security/apparmor/context.c b/security/apparmor/context.c
index c95f1ac6190b..89c03053303e 100644
--- a/security/apparmor/context.c
+++ b/security/apparmor/context.c
@@ -13,11 +13,11 @@
* License.
*
*
- * AppArmor sets confinement on every task, via the the aa_task_ctx and
- * the aa_task_ctx.label, both of which are required and are not allowed
- * to be NULL. The aa_task_ctx is not reference counted and is unique
+ * AppArmor sets confinement on every task, via the the aa_cred_ctx and
+ * the aa_cred_ctx.label, both of which are required and are not allowed
+ * to be NULL. The aa_cred_ctx is not reference counted and is unique
* to each cred (which is reference count). The label pointed to by
- * the task_ctx is reference counted.
+ * the cred_ctx is reference counted.
*
* TODO
* If a task uses change_hat it currently does not return to the old
@@ -30,21 +30,21 @@
#include "include/policy.h"
/**
- * aa_alloc_task_context - allocate a new task_ctx
+ * aa_alloc_cred_ctx - allocate a new cred_ctx
* @flags: gfp flags for allocation
*
* Returns: allocated buffer or NULL on failure
*/
-struct aa_task_ctx *aa_alloc_task_context(gfp_t flags)
+struct aa_cred_ctx *aa_alloc_cred_ctx(gfp_t flags)
{
- return kzalloc(sizeof(struct aa_task_ctx), flags);
+ return kzalloc(sizeof(struct aa_cred_ctx), flags);
}
/**
- * aa_free_task_context - free a task_ctx
- * @ctx: task_ctx to free (MAYBE NULL)
+ * aa_free_cred_ctx - free a cred_ctx
+ * @ctx: cred_ctx to free (MAYBE NULL)
*/
-void aa_free_task_context(struct aa_task_ctx *ctx)
+void aa_free_cred_ctx(struct aa_cred_ctx *ctx)
{
if (ctx) {
aa_put_label(ctx->label);
@@ -56,11 +56,11 @@ void aa_free_task_context(struct aa_task_ctx *ctx)
}
/**
- * aa_dup_task_context - duplicate a task context, incrementing reference counts
+ * aa_dup_cred_ctx - duplicate a task context, incrementing reference counts
* @new: a blank task context (NOT NULL)
* @old: the task context to copy (NOT NULL)
*/
-void aa_dup_task_context(struct aa_task_ctx *new, const struct aa_task_ctx *old)
+void aa_dup_cred_ctx(struct aa_cred_ctx *new, const struct aa_cred_ctx *old)
{
*new = *old;
aa_get_label(new->label);
@@ -93,7 +93,7 @@ struct aa_label *aa_get_task_label(struct task_struct *task)
*/
int aa_replace_current_label(struct aa_label *label)
{
- struct aa_task_ctx *ctx = current_ctx();
+ struct aa_cred_ctx *ctx = current_cred_ctx();
struct cred *new;
AA_BUG(!label);
@@ -112,7 +112,7 @@ int aa_replace_current_label(struct aa_label *label)
/* if switching to unconfined or a different label namespace
* clear out context state
*/
- aa_clear_task_ctx_trans(ctx);
+ aa_clear_cred_ctx_trans(ctx);
/*
* be careful switching ctx->profile, when racing replacement it
@@ -136,14 +136,14 @@ int aa_replace_current_label(struct aa_label *label)
*/
int aa_set_current_onexec(struct aa_label *label, bool stack)
{
- struct aa_task_ctx *ctx;
+ struct aa_cred_ctx *ctx;
struct cred *new = prepare_creds();
if (!new)
return -ENOMEM;
ctx = cred_ctx(new);
aa_get_label(label);
- aa_clear_task_ctx_trans(ctx);
+ aa_clear_cred_ctx_trans(ctx);
ctx->onexec = label;
ctx->token = stack;
@@ -163,7 +163,7 @@ int aa_set_current_onexec(struct aa_label *label, bool stack)
*/
int aa_set_current_hat(struct aa_label *label, u64 token)
{
- struct aa_task_ctx *ctx;
+ struct aa_cred_ctx *ctx;
struct cred *new = prepare_creds();
if (!new)
return -ENOMEM;
@@ -201,7 +201,7 @@ int aa_set_current_hat(struct aa_label *label, u64 token)
*/
int aa_restore_previous_label(u64 token)
{
- struct aa_task_ctx *ctx;
+ struct aa_cred_ctx *ctx;
struct cred *new = prepare_creds();
if (!new)
return -ENOMEM;
@@ -221,7 +221,7 @@ int aa_restore_previous_label(u64 token)
ctx->label = aa_get_newest_label(ctx->previous);
AA_BUG(!ctx->label);
/* clear exec && prev information when restoring to previous context */
- aa_clear_task_ctx_trans(ctx);
+ aa_clear_cred_ctx_trans(ctx);
commit_creds(new);
return 0;