* [PATCH] libsepol: fix neverallow checking
@ 2012-08-30 21:22 Stephen Smalley
2012-08-31 13:07 ` Ole Kliemann
0 siblings, 1 reply; 2+ messages in thread
From: Stephen Smalley @ 2012-08-30 21:22 UTC (permalink / raw)
To: selinux; +Cc: Ole Kliemann, Eric Paris, Daniel Walsh
[-- Attachment #1: Type: text/plain, Size: 1 bytes --]
[-- Attachment #2: 0001-libsepol-fix-neverallow-checking.patch --]
[-- Type: application/octet-stream, Size: 2530 bytes --]
From f1cd780b4e9652b709bec738d952b73cae19fa8a Mon Sep 17 00:00:00 2001
From: Stephen Smalley <sds@tycho.nsa.gov>
Date: Thu, 30 Aug 2012 17:17:37 -0400
Subject: [PATCH] libsepol: fix neverallow checking
Ole Kliemann reported that allow rules written using type attributes were
not being detected by neverallow assertions in the policy. I think that
this was broken in policy.24 and later due to changes in the type datum.
Fix the expand logic to correctly distinguish type attributes from types.
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
---
libsepol/src/expand.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/libsepol/src/expand.c b/libsepol/src/expand.c
index bef759c..0b21749 100644
--- a/libsepol/src/expand.c
+++ b/libsepol/src/expand.c
@@ -3106,12 +3106,12 @@ static int expand_avtab_node(avtab_key_t * k, avtab_datum_t * d, void *args)
newkey.target_class = k->target_class;
newkey.specified = k->specified;
- if (stype && ttype) {
+ if (stype->flavor != TYPE_ATTRIB && ttype->flavor != TYPE_ATTRIB) {
/* Both are individual types, no expansion required. */
return expand_avtab_insert(expa, k, d);
}
- if (stype) {
+ if (stype->flavor != TYPE_ATTRIB) {
/* Source is an individual type, target is an attribute. */
newkey.source_type = k->source_type;
ebitmap_for_each_bit(tattr, tnode, j) {
@@ -3125,7 +3125,7 @@ static int expand_avtab_node(avtab_key_t * k, avtab_datum_t * d, void *args)
return 0;
}
- if (ttype) {
+ if (ttype->flavor != TYPE_ATTRIB) {
/* Target is an individual type, source is an attribute. */
newkey.target_type = k->target_type;
ebitmap_for_each_bit(sattr, snode, i) {
@@ -3236,12 +3236,12 @@ int expand_cond_av_node(policydb_t * p,
newkey.target_class = k->target_class;
newkey.specified = k->specified;
- if (stype && ttype) {
+ if (stype->flavor != TYPE_ATTRIB && ttype->flavor != TYPE_ATTRIB) {
/* Both are individual types, no expansion required. */
return expand_cond_insert(newl, expa, k, d);
}
- if (stype) {
+ if (stype->flavor != TYPE_ATTRIB) {
/* Source is an individual type, target is an attribute. */
newkey.source_type = k->source_type;
ebitmap_for_each_bit(tattr, tnode, j) {
@@ -3255,7 +3255,7 @@ int expand_cond_av_node(policydb_t * p,
return 0;
}
- if (ttype) {
+ if (ttype->flavor != TYPE_ATTRIB) {
/* Target is an individual type, source is an attribute. */
newkey.target_type = k->target_type;
ebitmap_for_each_bit(sattr, snode, i) {
--
1.7.7.6
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] libsepol: fix neverallow checking
2012-08-30 21:22 [PATCH] libsepol: fix neverallow checking Stephen Smalley
@ 2012-08-31 13:07 ` Ole Kliemann
0 siblings, 0 replies; 2+ messages in thread
From: Ole Kliemann @ 2012-08-31 13:07 UTC (permalink / raw)
To: Stephen Smalley; +Cc: selinux, Eric Paris, Daniel Walsh
[-- Attachment #1: Type: text/plain, Size: 83 bytes --]
Thanks! Fixes the problem for me on Ubuntu 12.04 with
libsepol 2.1.0-1.2
Ole
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-08-31 13:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-30 21:22 [PATCH] libsepol: fix neverallow checking Stephen Smalley
2012-08-31 13:07 ` Ole Kliemann
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.