summaryrefslogtreecommitdiff
path: root/security/selinux/ss/services.h
diff options
context:
space:
mode:
authorOndrej Mosnacek <omosnace@redhat.com>2020-04-17 11:11:56 +0300
committerPaul Moore <paul@paul-moore.com>2020-04-17 23:04:34 +0300
commit50077289804c9bd4e6cfd5b3a10d4da0487f7e42 (patch)
treed0eec42d8fa215c2a80419f934159286d5d025d5 /security/selinux/ss/services.h
parente67b2ec9f6171895e774f6543626913960e019df (diff)
downloadlinux-50077289804c9bd4e6cfd5b3a10d4da0487f7e42.tar.xz
selinux: hash context structure directly
Always hashing the string representation is inefficient. Just hash the contents of the structure directly (using jhash). If the context is invalid (str & len are set), then hash the string as before, otherwise hash the structured data. Since the context hashing function is now faster (about 10 times), this patch decreases the overhead of security_transition_sid(), which is called from many hooks. The jhash function seemed as a good choice, since it is used as the default hashing algorithm in rhashtable. Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com> Reviewed-by: Jeff Vander Stoep <jeffv@google.com> Tested-by: Jeff Vander Stoep <jeffv@google.com> [PM: fixed some spelling errors in the comments pointed out by JVS] Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'security/selinux/ss/services.h')
-rw-r--r--security/selinux/ss/services.h3
1 files changed, 0 insertions, 3 deletions
diff --git a/security/selinux/ss/services.h b/security/selinux/ss/services.h
index e9bddf33e53d..a06f3d835216 100644
--- a/security/selinux/ss/services.h
+++ b/security/selinux/ss/services.h
@@ -8,7 +8,6 @@
#define _SS_SERVICES_H_
#include "policydb.h"
-#include "context.h"
/* Mapping for a single class */
struct selinux_mapping {
@@ -37,6 +36,4 @@ void services_compute_xperms_drivers(struct extended_perms *xperms,
void services_compute_xperms_decision(struct extended_perms_decision *xpermd,
struct avtab_node *node);
-int context_add_hash(struct policydb *policydb, struct context *context);
-
#endif /* _SS_SERVICES_H_ */