From: Jacob Satterfield <jsatterfield.linux@gmail.com>
To: selinux@vger.kernel.org
Cc: Jacob Satterfield <jsatterfield.linux@gmail.com>,
stephen.smalley.work@gmail.com, paul@paul-moore.com,
omosnace@redhat.com
Subject: [PATCH v3 0/3] selinux: avtab arrays and refactors
Date: Wed, 18 Oct 2023 17:57:33 +0000 [thread overview]
Message-ID: <20231018175744.39667-1-jsatterfield.linux@gmail.com> (raw)
As the refpolicy and the default Fedora policy continue to grow in
size, especially with regard to rules / access vectors, the memory
usage of the policydb and runtime to search through it increases.
Looking at /proc/slabinfo indicates that the avtab_node_cachep
kmem_cache is significantly responsible for overall memory usage and
was a good target for optimizations. Running "perf stat" on the
"load_policy" command shows that a majority of time is spent adding
rules into the avtab.
This patch series is an attempt at optimizing these hot spots within
the security server implementation to help it scale with additional
rules in the future.
All patches are independent of each other.
Patches 1-2 are refactors of the internal avtab.c interfaces and code
paths with no logic changes. It removes duplicative code and
homogenizes access patterns.
Patch 3 changes avtab to use arrays instead of a kmem_cache for the
individual nodes of the hashtable.
Changelog:
v3:
- selinux: simplify avtab_insert_node() prototype
- dropped, already merged
- selinux: avtab iteration macros
- reverted changes to avtab_destroy() which created a UAF bug
- selinux: refactor avtab_node comparisons
- fixed indent issues in avtab_node_cmp()
- removed unlikely() macro in avtab_insert()
v2:
- selinux: use arrays for avtab hashtable nodes
- rewritten to use pointers instead of indices
- NULL_NODE_IDX and NODES_ARRAY_IDX macros removed
- getter functions removed
- two-pass algorithm used to compute cond. table size prior to
allocating the array
- selinux: hweight optimization in avtab_read_item
- dropped, already merged
- selinux: shrink conditional avtab node array
- dropped, not needed due to new allocation approach
- selinux: refactor avtab_node comparisons
- newly added
- selinux: avtab iteration macros
- newly added
- selinux: simplify avtab_insert_node() prototype
- newly added
Jacob Satterfield (3):
selinux: refactor avtab_node comparisons
selinux: avtab iteration macros
selinux: use arrays for avtab hashtable nodes
security/selinux/ss/avtab.c | 176 ++++++++++++++----------------
security/selinux/ss/avtab.h | 4 +-
security/selinux/ss/conditional.c | 37 +++++--
security/selinux/ss/conditional.h | 2 +-
4 files changed, 112 insertions(+), 107 deletions(-)
--
2.41.0
next reply other threads:[~2023-10-18 17:59 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-18 17:57 Jacob Satterfield [this message]
2023-10-18 17:57 ` [PATCH v3 1/3] selinux: refactor avtab_node comparisons Jacob Satterfield
2023-10-20 13:52 ` Stephen Smalley
2023-10-20 17:32 ` Jacob Satterfield
2023-10-18 17:57 ` [PATCH v3 2/3] selinux: avtab iteration macros Jacob Satterfield
2023-10-19 20:27 ` Jacob Satterfield
2023-10-18 17:57 ` [PATCH v3 3/3] selinux: use arrays for avtab hashtable nodes Jacob Satterfield
2023-10-20 14:00 ` Stephen Smalley
2023-10-20 17:29 ` Jacob Satterfield
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231018175744.39667-1-jsatterfield.linux@gmail.com \
--to=jsatterfield.linux@gmail.com \
--cc=omosnace@redhat.com \
--cc=paul@paul-moore.com \
--cc=selinux@vger.kernel.org \
--cc=stephen.smalley.work@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.