summaryrefslogtreecommitdiff
path: root/security/apparmor/file.c
diff options
context:
space:
mode:
authorJohn Johansen <john.johansen@canonical.com>2025-02-17 01:46:37 -0800
committerJohn Johansen <john.johansen@canonical.com>2025-07-20 02:31:06 -0700
commit9afdc6abb007d5a86f54e9f10870ac1468155ca5 (patch)
treeca4322b73a8c95da56d8e0866ef2c490791ffdd1 /security/apparmor/file.c
parentf9c9dce01e9640d94a37304bddc97b738ee4ac35 (diff)
apparmor: transition from a list of rules to a vector of rules
The set of rules on a profile is not dynamically extended, instead if a new ruleset is needed a new version of the profile is created. This allows us to use a vector of rules instead of a list, slightly reducing memory usage and simplifying the code. Signed-off-by: John Johansen <john.johansen@canonical.com>
Diffstat (limited to 'security/apparmor/file.c')
-rw-r--r--security/apparmor/file.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/security/apparmor/file.c b/security/apparmor/file.c
index 5504059d6101..deffd278d6fd 100644
--- a/security/apparmor/file.c
+++ b/security/apparmor/file.c
@@ -223,8 +223,7 @@ int __aa_path_perm(const char *op, const struct cred *subj_cred,
u32 request, struct path_cond *cond, int flags,
struct aa_perms *perms)
{
- struct aa_ruleset *rules = list_first_entry(&profile->rules,
- typeof(*rules), list);
+ struct aa_ruleset *rules = profile->label.rules[0];
int e = 0;
if (profile_unconfined(profile) ||
@@ -323,8 +322,7 @@ static int profile_path_link(const struct cred *subj_cred,
const struct path *target, char *buffer2,
struct path_cond *cond)
{
- struct aa_ruleset *rules = list_first_entry(&profile->rules,
- typeof(*rules), list);
+ struct aa_ruleset *rules = profile->label.rules[0];
const char *lname, *tname = NULL;
struct aa_perms lperms = {}, perms;
const char *info = NULL;