| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * AppArmor security module |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * Copyright (C) 1998-2008 Novell/SUSE |
|---|
| 7 | 8 | * Copyright 2009-2010 Canonical Ltd. |
|---|
| 8 | | - * |
|---|
| 9 | | - * This program is free software; you can redistribute it and/or |
|---|
| 10 | | - * modify it under the terms of the GNU General Public License as |
|---|
| 11 | | - * published by the Free Software Foundation, version 2 of the |
|---|
| 12 | | - * License. |
|---|
| 13 | 9 | */ |
|---|
| 14 | 10 | |
|---|
| 15 | 11 | #ifndef __AA_CONTEXT_H |
|---|
| .. | .. |
|---|
| 23 | 19 | #include "policy_ns.h" |
|---|
| 24 | 20 | #include "task.h" |
|---|
| 25 | 21 | |
|---|
| 26 | | -#define cred_label(X) ((X)->security) |
|---|
| 22 | +static inline struct aa_label *cred_label(const struct cred *cred) |
|---|
| 23 | +{ |
|---|
| 24 | + struct aa_label **blob = cred->security + apparmor_blob_sizes.lbs_cred; |
|---|
| 27 | 25 | |
|---|
| 26 | + AA_BUG(!blob); |
|---|
| 27 | + return *blob; |
|---|
| 28 | +} |
|---|
| 29 | + |
|---|
| 30 | +static inline void set_cred_label(const struct cred *cred, |
|---|
| 31 | + struct aa_label *label) |
|---|
| 32 | +{ |
|---|
| 33 | + struct aa_label **blob = cred->security + apparmor_blob_sizes.lbs_cred; |
|---|
| 34 | + |
|---|
| 35 | + AA_BUG(!blob); |
|---|
| 36 | + *blob = label; |
|---|
| 37 | +} |
|---|
| 28 | 38 | |
|---|
| 29 | 39 | /** |
|---|
| 30 | 40 | * aa_cred_raw_label - obtain cred's label |
|---|