| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * AppArmor security module |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * This file contains AppArmor task related definitions and mediation |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * Copyright 2017 Canonical Ltd. |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is free software; you can redistribute it and/or |
|---|
| 9 | | - * modify it under the terms of the GNU General Public License as |
|---|
| 10 | | - * published by the Free Software Foundation, version 2 of the |
|---|
| 11 | | - * License. |
|---|
| 12 | 8 | */ |
|---|
| 13 | 9 | |
|---|
| 14 | 10 | #ifndef __AA_TASK_H |
|---|
| 15 | 11 | #define __AA_TASK_H |
|---|
| 16 | 12 | |
|---|
| 17 | | -#define task_ctx(X) ((X)->security) |
|---|
| 13 | +static inline struct aa_task_ctx *task_ctx(struct task_struct *task) |
|---|
| 14 | +{ |
|---|
| 15 | + return task->security + apparmor_blob_sizes.lbs_task; |
|---|
| 16 | +} |
|---|
| 18 | 17 | |
|---|
| 19 | 18 | /* |
|---|
| 20 | 19 | * struct aa_task_ctx - information for current task label change |
|---|
| .. | .. |
|---|
| 37 | 36 | struct aa_label *aa_get_task_label(struct task_struct *task); |
|---|
| 38 | 37 | |
|---|
| 39 | 38 | /** |
|---|
| 40 | | - * aa_alloc_task_ctx - allocate a new task_ctx |
|---|
| 41 | | - * @flags: gfp flags for allocation |
|---|
| 42 | | - * |
|---|
| 43 | | - * Returns: allocated buffer or NULL on failure |
|---|
| 44 | | - */ |
|---|
| 45 | | -static inline struct aa_task_ctx *aa_alloc_task_ctx(gfp_t flags) |
|---|
| 46 | | -{ |
|---|
| 47 | | - return kzalloc(sizeof(struct aa_task_ctx), flags); |
|---|
| 48 | | -} |
|---|
| 49 | | - |
|---|
| 50 | | -/** |
|---|
| 51 | 39 | * aa_free_task_ctx - free a task_ctx |
|---|
| 52 | 40 | * @ctx: task_ctx to free (MAYBE NULL) |
|---|
| 53 | 41 | */ |
|---|
| .. | .. |
|---|
| 57 | 45 | aa_put_label(ctx->nnp); |
|---|
| 58 | 46 | aa_put_label(ctx->previous); |
|---|
| 59 | 47 | aa_put_label(ctx->onexec); |
|---|
| 60 | | - |
|---|
| 61 | | - kzfree(ctx); |
|---|
| 62 | 48 | } |
|---|
| 63 | 49 | } |
|---|
| 64 | 50 | |
|---|