All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libsepol: bool_copy_callback set state on creation
@ 2015-03-19 17:03 Thomas Hurd
  2015-03-19 18:44 ` Stephen Smalley
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Hurd @ 2015-03-19 17:03 UTC (permalink / raw)
  To: selinux

Boolean states are only written on a declaration.
If a module is turned off which includes a tunable declaration that
is required in another module, the state is never set. This patch
sets the state when the booldatum is created so that an uninitialized
memory read does not occur in cond_write_bool and write garbage to
the link binary.  This can cause a failure in cond_read_bool when
running semodule_expand.

Signed-off-by: Thomas Hurd <thurd@tresys.com>
---
 libsepol/src/link.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libsepol/src/link.c b/libsepol/src/link.c
index f98a8d2..f211164 100644
--- a/libsepol/src/link.c
+++ b/libsepol/src/link.c
@@ -630,6 +630,7 @@ static int bool_copy_callback(hashtab_key_t key, hashtab_datum_t datum,
 		state->base->p_bools.nprim++;
 		base_bool = new_bool;
 		base_bool->flags = booldatum->flags;
+		base_bool->state = booldatum->state;
 	} else if ((booldatum->flags & COND_BOOL_FLAGS_TUNABLE) !=
 		   (base_bool->flags & COND_BOOL_FLAGS_TUNABLE)) {
 			/* A mismatch between boolean/tunable declaration
-- 
2.1.0

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

end of thread, other threads:[~2015-03-19 19:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-19 17:03 [PATCH] libsepol: bool_copy_callback set state on creation Thomas Hurd
2015-03-19 18:44 ` Stephen Smalley
2015-03-19 19:29   ` Thomas Hurd

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.