aboutsummaryrefslogtreecommitdiffstats
path: root/security/apparmor/include
diff options
context:
space:
mode:
authorJohn Johansen <john.johansen@canonical.com>2020-10-06 14:43:16 -0700
committerJohn Johansen <john.johansen@canonical.com>2022-07-13 17:18:29 -0700
commit524d8e14258a3c31bcaf915db5762e41249eb924 (patch)
tree3d071c02f5bf3ecfd3af63e3d44cd5b8046a294d /security/apparmor/include
parentapparmor: Convert secid mapping to XArrays instead of IDR (diff)
downloadlinux-dev-524d8e14258a3c31bcaf915db5762e41249eb924.tar.xz
linux-dev-524d8e14258a3c31bcaf915db5762e41249eb924.zip
apparmor: disable showing the mode as part of a secid to secctx
Displaying the mode as part of the seectx takes up unnecessary memory, makes it so we can't use refcounted secctx so we need to alloc/free on every conversion from secid to secctx and introduces a space that could be potentially mishandled by tooling. Eg. In an audit record we get subj_type=firefix (enforce) Having the mode reported is not necessary, and might even be confusing eg. when writing an audit rule to match the above record field you would use -F subj_type=firefox ie. the mode is not included. AppArmor provides ways to find the mode without reporting as part of the secctx. So disable this by default before its use is wide spread and we can't. For now we add a sysctl to control the behavior as we can't guarantee no one is using this. Acked-by: Andrea Righi <andrea.righi@canonical.com> Signed-off-by: John Johansen <john.johansen@canonical.com>
Diffstat (limited to 'security/apparmor/include')
-rw-r--r--security/apparmor/include/secid.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/security/apparmor/include/secid.h b/security/apparmor/include/secid.h
index 278dff5ecd1f..a912a5d5d04f 100644
--- a/security/apparmor/include/secid.h
+++ b/security/apparmor/include/secid.h
@@ -21,6 +21,9 @@ struct aa_label;
/* secid value that matches any other secid */
#define AA_SECID_WILDCARD 1
+/* sysctl to enable displaying mode when converting secid to secctx */
+extern int apparmor_display_secid_mode;
+
struct aa_label *aa_secid_to_label(u32 secid);
int apparmor_secid_to_secctx(u32 secid, char **secdata, u32 *seclen);
int apparmor_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid);