selinux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Hash context structures directly
@ 2020-04-16 12:41 Ondrej Mosnacek
  2020-04-16 12:41 ` [PATCH v2 1/2] selinux: hash context structure directly Ondrej Mosnacek
  2020-04-16 12:41 ` [PATCH v2 2/2] selinux: move context hashing under sidtab Ondrej Mosnacek
  0 siblings, 2 replies; 6+ messages in thread
From: Ondrej Mosnacek @ 2020-04-16 12:41 UTC (permalink / raw)
  To: selinux, Paul Moore; +Cc: Stephen Smalley, Jeff Vander Stoep

Converting a valid context to string and hashing that is inefficient
because the conversion is slow. Instead we can hash the stucture
contents directly, which is about 10 times faster.

After that, it is possible to move the hashing under sidtab.c, which
avoids the complexity of calling context_add_hash() all over the place.

Changes in v2:
 - fix copyright year in ss/context.c
 - extract mls hashing into mls_range_hash() and put it in mls.h
 - move some changes from patch 1 into patch 2

Ondrej Mosnacek (2):
  selinux: hash context structure directly
  selinux: move context hashing under sidtab

 security/selinux/Makefile      |  2 +-
 security/selinux/ss/context.c  | 24 ++++++++++
 security/selinux/ss/context.h  | 11 +----
 security/selinux/ss/ebitmap.c  | 14 ++++++
 security/selinux/ss/ebitmap.h  |  1 +
 security/selinux/ss/mls.h      | 11 +++++
 security/selinux/ss/policydb.c |  5 --
 security/selinux/ss/services.c | 86 ++++++++++------------------------
 security/selinux/ss/services.h |  3 --
 security/selinux/ss/sidtab.c   | 32 ++++++++-----
 security/selinux/ss/sidtab.h   |  1 +
 11 files changed, 99 insertions(+), 91 deletions(-)
 create mode 100644 security/selinux/ss/context.c

-- 
2.25.2


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-04-16 20:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-16 12:41 [PATCH v2 0/2] Hash context structures directly Ondrej Mosnacek
2020-04-16 12:41 ` [PATCH v2 1/2] selinux: hash context structure directly Ondrej Mosnacek
2020-04-16 14:21   ` Jeffrey Vander Stoep
2020-04-16 15:15     ` Ondrej Mosnacek
2020-04-16 20:26   ` Ondrej Mosnacek
2020-04-16 12:41 ` [PATCH v2 2/2] selinux: move context hashing under sidtab Ondrej Mosnacek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).