diff options
| author | John Johansen <john.johansen@canonical.com> | 2025-02-17 01:46:37 -0800 |
|---|---|---|
| committer | John Johansen <john.johansen@canonical.com> | 2025-07-20 02:31:06 -0700 |
| commit | 9afdc6abb007d5a86f54e9f10870ac1468155ca5 (patch) | |
| tree | ca4322b73a8c95da56d8e0866ef2c490791ffdd1 /security/apparmor/include/label.h | |
| parent | f9c9dce01e9640d94a37304bddc97b738ee4ac35 (diff) | |
| download | linux-next-9afdc6abb007d5a86f54e9f10870ac1468155ca5.tar.gz linux-next-9afdc6abb007d5a86f54e9f10870ac1468155ca5.zip | |
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/include/label.h')
| -rw-r--r-- | security/apparmor/include/label.h | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/security/apparmor/include/label.h b/security/apparmor/include/label.h index 9aa2e364cca9..c0812dbc1b5b 100644 --- a/security/apparmor/include/label.h +++ b/security/apparmor/include/label.h @@ -19,6 +19,7 @@ #include "lib.h" struct aa_ns; +struct aa_ruleset; #define LOCAL_VEC_ENTRIES 8 #define DEFINE_VEC(T, V) \ @@ -109,7 +110,7 @@ struct label_it { int i, j; }; -/* struct aa_label - lazy labeling struct +/* struct aa_label_base - base info of label * @count: ref count of active users * @node: rbtree position * @rcu: rcu callback struct @@ -118,7 +119,10 @@ struct label_it { * @flags: stale and other flags - values may change under label set lock * @secid: secid that references this label * @size: number of entries in @ent[] - * @ent: set of profiles for label, actual size determined by @size + * @mediates: bitmask for label_mediates + * profile: label vec when embedded in a profile FLAG_PROFILE is set + * rules: variable length rules in a profile FLAG_PROFILE is set + * vec: vector of profiles comprising the compound label */ struct aa_label { struct kref count; @@ -130,7 +134,17 @@ struct aa_label { u32 secid; int size; u64 mediates; - struct aa_profile *vec[]; + union { + struct { + /* only used is the label is a profile, size of + * rules[] is determined by the profile + * profile[1] is poison or null as guard + */ + struct aa_profile *profile[2]; + DECLARE_FLEX_ARRAY(struct aa_ruleset *, rules); + }; + DECLARE_FLEX_ARRAY(struct aa_profile *, vec); + }; }; #define last_error(E, FN) \ |
