kernel_optimize_test/security/selinux/ss
Ondrej Mosnacek 5007728980 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>
2020-04-17 16:04:34 -04:00
..
avtab.c selinux: avtab_init() and cond_policydb_init() return void 2020-03-05 14:55:43 -05:00
avtab.h selinux: avtab_init() and cond_policydb_init() return void 2020-03-05 14:55:43 -05:00
conditional.c selinux: avtab_init() and cond_policydb_init() return void 2020-03-05 14:55:43 -05:00
conditional.h selinux: avtab_init() and cond_policydb_init() return void 2020-03-05 14:55:43 -05:00
constraint.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
context.c selinux: hash context structure directly 2020-04-17 16:04:34 -04:00
context.h selinux: hash context structure directly 2020-04-17 16:04:34 -04:00
ebitmap.c selinux: hash context structure directly 2020-04-17 16:04:34 -04:00
ebitmap.h selinux: hash context structure directly 2020-04-17 16:04:34 -04:00
hashtab.c selinux: reduce the use of hard-coded hash sizes 2020-02-27 19:23:20 -05:00
hashtab.h selinux: reduce the use of hard-coded hash sizes 2020-02-27 19:23:20 -05:00
mls_types.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mls.c selinux: fix warning Comparison to bool 2020-04-14 18:01:18 -04:00
mls.h selinux: hash context structure directly 2020-04-17 16:04:34 -04:00
policydb.c selinux: hash context structure directly 2020-04-17 16:04:34 -04:00
policydb.h selinux: store role transitions in a hash table 2020-04-17 15:20:22 -04:00
services.c selinux: hash context structure directly 2020-04-17 16:04:34 -04:00
services.h selinux: hash context structure directly 2020-04-17 16:04:34 -04:00
sidtab.c selinux: drop unnecessary smp_load_acquire() call 2020-04-15 18:27:35 -04:00
sidtab.h selinux: cache the SID -> context string translation 2019-12-09 16:14:51 -05:00
symtab.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
symtab.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00