selinux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] libsepol/cil: raise default attrs_expand_size to 2
@ 2020-03-04  9:49 Ondrej Mosnacek
  2020-03-05 13:13 ` Stephen Smalley
  0 siblings, 1 reply; 2+ messages in thread
From: Ondrej Mosnacek @ 2020-03-04  9:49 UTC (permalink / raw)
  To: selinux; +Cc: Stephen Smalley, James Carter

Tne value attrs_expand_size == 1 removes all empty attributes, but it
also makes sense to expand all attributes that have only one type. This
removes some redundant rules (there is sometimes the same rule for the
type and the attribute) and reduces the number of attributes that the
kernel has to go through when looking up rules.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
---
 libsepol/cil/src/cil.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libsepol/cil/src/cil.c b/libsepol/cil/src/cil.c
index d222ad3a..31380e8b 100644
--- a/libsepol/cil/src/cil.c
+++ b/libsepol/cil/src/cil.c
@@ -452,7 +452,8 @@ void cil_db_init(struct cil_db **db)
 	(*db)->disable_dontaudit = CIL_FALSE;
 	(*db)->disable_neverallow = CIL_FALSE;
 	(*db)->attrs_expand_generated = CIL_FALSE;
-	(*db)->attrs_expand_size = 1;
+	/* 2 == remove attributes that cointain none or just 1 type */
+	(*db)->attrs_expand_size = 2;
 	(*db)->preserve_tunables = CIL_FALSE;
 	(*db)->handle_unknown = -1;
 	(*db)->mls = -1;
-- 
2.24.1


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

* Re: [RFC PATCH] libsepol/cil: raise default attrs_expand_size to 2
  2020-03-04  9:49 [RFC PATCH] libsepol/cil: raise default attrs_expand_size to 2 Ondrej Mosnacek
@ 2020-03-05 13:13 ` Stephen Smalley
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Smalley @ 2020-03-05 13:13 UTC (permalink / raw)
  To: Ondrej Mosnacek; +Cc: SElinux list, James Carter

On Wed, Mar 4, 2020 at 4:50 AM Ondrej Mosnacek <omosnace@redhat.com> wrote:
>
> Tne value attrs_expand_size == 1 removes all empty attributes, but it
> also makes sense to expand all attributes that have only one type. This
> removes some redundant rules (there is sometimes the same rule for the
> type and the attribute) and reduces the number of attributes that the
> kernel has to go through when looking up rules.
>
> Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
> ---
>  libsepol/cil/src/cil.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/libsepol/cil/src/cil.c b/libsepol/cil/src/cil.c
> index d222ad3a..31380e8b 100644
> --- a/libsepol/cil/src/cil.c
> +++ b/libsepol/cil/src/cil.c
> @@ -452,7 +452,8 @@ void cil_db_init(struct cil_db **db)
>         (*db)->disable_dontaudit = CIL_FALSE;
>         (*db)->disable_neverallow = CIL_FALSE;
>         (*db)->attrs_expand_generated = CIL_FALSE;
> -       (*db)->attrs_expand_size = 1;
> +       /* 2 == remove attributes that cointain none or just 1 type */

s/cointain/contain/

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

end of thread, other threads:[~2020-03-05 13:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-04  9:49 [RFC PATCH] libsepol/cil: raise default attrs_expand_size to 2 Ondrej Mosnacek
2020-03-05 13:13 ` Stephen Smalley

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).