SELinux Archive on lore.kernel.org
 help / Atom feed
* [PATCH] libsepol/cil: Allow validatetrans rules to be resolved
@ 2019-05-21 11:22 Richard Haines
  2019-05-21 17:59 ` [Non-DoD Source] " jwcart2
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Haines @ 2019-05-21 11:22 UTC (permalink / raw)
  To: selinux; +Cc: sds, Richard Haines

When validatetrans rule is in CIL policy it errors with:
u3, r3, and t3 can only be used with mlsvalidatetrans rules

Will now resolve these examples:
(validatetrans binder (and (and (eq t1 t1_t) (eq t2 t2_t)) (eq t3 t3_t)))
(mlsvalidatetrans file (and (and (eq t1 t1_t) (eq t2 t2_t))
    (and (eq t3 t3_t) (domby h1 h2))))

Signed-off-by: Richard Haines <richard_c_haines@btinternet.com>
---
 libsepol/cil/src/cil_verify.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libsepol/cil/src/cil_verify.c b/libsepol/cil/src/cil_verify.c
index 1036d73..1a21cf4 100644
--- a/libsepol/cil/src/cil_verify.c
+++ b/libsepol/cil/src/cil_verify.c
@@ -221,8 +221,8 @@ int cil_verify_constraint_leaf_expr_syntax(enum cil_flavor l_flavor, enum cil_fl
 			cil_log(CIL_ERR, "l1, l2, h1, and h2 cannot be used on the left side with a string or list on the right side\n");
 			goto exit;
 		} else if (l_flavor == CIL_CONS_U3 || l_flavor == CIL_CONS_R3 || l_flavor == CIL_CONS_T3) {
-			if (expr_flavor != CIL_MLSVALIDATETRANS) {
-				cil_log(CIL_ERR, "u3, r3, and t3 can only be used with mlsvalidatetrans rules\n");
+			if (expr_flavor != CIL_VALIDATETRANS && expr_flavor != CIL_MLSVALIDATETRANS) {
+				cil_log(CIL_ERR, "u3, r3, and t3 can only be used with (mls)validatetrans rules\n");
 				goto exit;
 			}
 		}
-- 
2.20.1


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

* Re: [Non-DoD Source] [PATCH] libsepol/cil: Allow validatetrans rules to be resolved
  2019-05-21 11:22 [PATCH] libsepol/cil: Allow validatetrans rules to be resolved Richard Haines
@ 2019-05-21 17:59 ` " jwcart2
  2019-05-23 14:05   ` jwcart2
  0 siblings, 1 reply; 3+ messages in thread
From: jwcart2 @ 2019-05-21 17:59 UTC (permalink / raw)
  To: Richard Haines, selinux; +Cc: sds

On 5/21/19 7:22 AM, Richard Haines wrote:
> When validatetrans rule is in CIL policy it errors with:
> u3, r3, and t3 can only be used with mlsvalidatetrans rules
> 
> Will now resolve these examples:
> (validatetrans binder (and (and (eq t1 t1_t) (eq t2 t2_t)) (eq t3 t3_t)))
> (mlsvalidatetrans file (and (and (eq t1 t1_t) (eq t2 t2_t))
>      (and (eq t3 t3_t) (domby h1 h2))))
> 
> Signed-off-by: Richard Haines <richard_c_haines@btinternet.com>

Acked-by: James Carter <jwcart2@tycho.nsa.gov>

> ---
>   libsepol/cil/src/cil_verify.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libsepol/cil/src/cil_verify.c b/libsepol/cil/src/cil_verify.c
> index 1036d73..1a21cf4 100644
> --- a/libsepol/cil/src/cil_verify.c
> +++ b/libsepol/cil/src/cil_verify.c
> @@ -221,8 +221,8 @@ int cil_verify_constraint_leaf_expr_syntax(enum cil_flavor l_flavor, enum cil_fl
>   			cil_log(CIL_ERR, "l1, l2, h1, and h2 cannot be used on the left side with a string or list on the right side\n");
>   			goto exit;
>   		} else if (l_flavor == CIL_CONS_U3 || l_flavor == CIL_CONS_R3 || l_flavor == CIL_CONS_T3) {
> -			if (expr_flavor != CIL_MLSVALIDATETRANS) {
> -				cil_log(CIL_ERR, "u3, r3, and t3 can only be used with mlsvalidatetrans rules\n");
> +			if (expr_flavor != CIL_VALIDATETRANS && expr_flavor != CIL_MLSVALIDATETRANS) {
> +				cil_log(CIL_ERR, "u3, r3, and t3 can only be used with (mls)validatetrans rules\n");
>   				goto exit;
>   			}
>   		}
> 


-- 
James Carter <jwcart2@tycho.nsa.gov>
National Security Agency

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

* Re: [Non-DoD Source] [PATCH] libsepol/cil: Allow validatetrans rules to be resolved
  2019-05-21 17:59 ` [Non-DoD Source] " jwcart2
@ 2019-05-23 14:05   ` jwcart2
  0 siblings, 0 replies; 3+ messages in thread
From: jwcart2 @ 2019-05-23 14:05 UTC (permalink / raw)
  To: Richard Haines, selinux; +Cc: sds

On 5/21/19 1:59 PM, jwcart2 wrote:
> On 5/21/19 7:22 AM, Richard Haines wrote:
>> When validatetrans rule is in CIL policy it errors with:
>> u3, r3, and t3 can only be used with mlsvalidatetrans rules
>>
>> Will now resolve these examples:
>> (validatetrans binder (and (and (eq t1 t1_t) (eq t2 t2_t)) (eq t3 t3_t)))
>> (mlsvalidatetrans file (and (and (eq t1 t1_t) (eq t2 t2_t))
>>      (and (eq t3 t3_t) (domby h1 h2))))
>>
>> Signed-off-by: Richard Haines <richard_c_haines@btinternet.com>
> 
> Acked-by: James Carter <jwcart2@tycho.nsa.gov>
> 

Applied.
Thanks,
Jim

>> ---
>>   libsepol/cil/src/cil_verify.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/libsepol/cil/src/cil_verify.c b/libsepol/cil/src/cil_verify.c
>> index 1036d73..1a21cf4 100644
>> --- a/libsepol/cil/src/cil_verify.c
>> +++ b/libsepol/cil/src/cil_verify.c
>> @@ -221,8 +221,8 @@ int cil_verify_constraint_leaf_expr_syntax(enum cil_flavor 
>> l_flavor, enum cil_fl
>>               cil_log(CIL_ERR, "l1, l2, h1, and h2 cannot be used on the left 
>> side with a string or list on the right side\n");
>>               goto exit;
>>           } else if (l_flavor == CIL_CONS_U3 || l_flavor == CIL_CONS_R3 || 
>> l_flavor == CIL_CONS_T3) {
>> -            if (expr_flavor != CIL_MLSVALIDATETRANS) {
>> -                cil_log(CIL_ERR, "u3, r3, and t3 can only be used with 
>> mlsvalidatetrans rules\n");
>> +            if (expr_flavor != CIL_VALIDATETRANS && expr_flavor != 
>> CIL_MLSVALIDATETRANS) {
>> +                cil_log(CIL_ERR, "u3, r3, and t3 can only be used with 
>> (mls)validatetrans rules\n");
>>                   goto exit;
>>               }
>>           }
>>
> 
> 


-- 
James Carter <jwcart2@tycho.nsa.gov>
National Security Agency

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

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-21 11:22 [PATCH] libsepol/cil: Allow validatetrans rules to be resolved Richard Haines
2019-05-21 17:59 ` [Non-DoD Source] " jwcart2
2019-05-23 14:05   ` jwcart2

SELinux Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/selinux/0 selinux/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 selinux selinux/ https://lore.kernel.org/selinux \
		selinux@vger.kernel.org selinux@archiver.kernel.org
	public-inbox-index selinux


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.selinux


AGPL code for this site: git clone https://public-inbox.org/ public-inbox