selinux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] checkpolicy: Improve error message for type bounds
@ 2022-11-24 16:31 Vit Mojzis
  2022-11-24 16:31 ` [PATCH 2/2] libsemanage: Use more conscious language Vit Mojzis
  2022-12-15 22:13 ` [PATCH 1/2] checkpolicy: Improve error message for type bounds James Carter
  0 siblings, 2 replies; 4+ messages in thread
From: Vit Mojzis @ 2022-11-24 16:31 UTC (permalink / raw)
  To: selinux

Make the error message consistent with other occurrences of the
same issue:
https://github.com/SELinuxProject/selinux/blob/master/checkpolicy/module_compiler.c#L243
https://github.com/SELinuxProject/selinux/blob/master/checkpolicy/module_compiler.c#L488

Signed-off-by: Vit Mojzis <vmojzis@redhat.com>
---
 checkpolicy/policy_define.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/checkpolicy/policy_define.c b/checkpolicy/policy_define.c
index 41e44631..86d57017 100644
--- a/checkpolicy/policy_define.c
+++ b/checkpolicy/policy_define.c
@@ -1416,7 +1416,7 @@ static int define_typebounds_helper(char *bounds_id, char *type_id)
 	if (!type->bounds)
 		type->bounds = bounds->s.value;
 	else if (type->bounds != bounds->s.value) {
-		yyerror2("type %s has inconsistent master {%s,%s}",
+		yyerror2("type %s has inconsistent bounds %s/%s",
 			 type_id,
 			 policydbp->p_type_val_to_name[type->bounds - 1],
 			 policydbp->p_type_val_to_name[bounds->s.value - 1]);
-- 
2.37.3


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

* [PATCH 2/2] libsemanage: Use more conscious language
  2022-11-24 16:31 [PATCH 1/2] checkpolicy: Improve error message for type bounds Vit Mojzis
@ 2022-11-24 16:31 ` Vit Mojzis
  2022-12-15 22:13 ` [PATCH 1/2] checkpolicy: Improve error message for type bounds James Carter
  1 sibling, 0 replies; 4+ messages in thread
From: Vit Mojzis @ 2022-11-24 16:31 UTC (permalink / raw)
  To: selinux

https://inclusivenaming.org/word-lists/tier-1/

Signed-off-by: Vit Mojzis <vmojzis@redhat.com>
---
 libsemanage/src/semanage_store.c | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/libsemanage/src/semanage_store.c b/libsemanage/src/semanage_store.c
index 14a0957a..27c5d349 100644
--- a/libsemanage/src/semanage_store.c
+++ b/libsemanage/src/semanage_store.c
@@ -2400,7 +2400,7 @@ static semanage_file_context_node_t
 
 /* Sorts file contexts from least specific to most specific.
  * A bucket linked list is passed in.  Upon completion,
- * there is only one bucket (pointed to by master) that 
+ * there is only one bucket (pointed to by "main") that
  * contains a linked list of all the file contexts in sorted order.
  * Explanation of the algorithm:
  *  This is a stable implementation of an iterative merge sort.
@@ -2411,15 +2411,15 @@ static semanage_file_context_node_t
  *  Buckets are merged until there is only one bucket left, 
  *   containing the list of file contexts, sorted.
  */
-static void semanage_fc_merge_sort(semanage_file_context_bucket_t * master)
+static void semanage_fc_merge_sort(semanage_file_context_bucket_t * main)
 {
 	semanage_file_context_bucket_t *current;
 	semanage_file_context_bucket_t *temp;
 
-	/* Loop until master is the only bucket left.
-	 * When we stop master contains the sorted list. */
-	while (master->next) {
-		current = master;
+	/* Loop until "main" is the only bucket left.
+	 * When we stop "main" contains the sorted list. */
+	while (main->next) {
+		current = main;
 
 		/* Merge buckets two-by-two. 
 		 * If there is an odd number of buckets, the last 
@@ -2547,7 +2547,7 @@ int semanage_fc_sort(semanage_handle_t * sh, const char *buf, size_t buf_len,
 	semanage_file_context_node_t *temp;
 	semanage_file_context_node_t *head;
 	semanage_file_context_node_t *current;
-	semanage_file_context_bucket_t *master;
+	semanage_file_context_bucket_t *main;
 	semanage_file_context_bucket_t *bcurrent;
 
 	i = 0;
@@ -2746,9 +2746,9 @@ int semanage_fc_sort(semanage_handle_t * sh, const char *buf, size_t buf_len,
 
 	/* Create the bucket linked list from the node linked list. */
 	current = head->next;
-	bcurrent = master = (semanage_file_context_bucket_t *)
+	bcurrent = main = (semanage_file_context_bucket_t *)
 	    calloc(1, sizeof(semanage_file_context_bucket_t));
-	if (!master) {
+	if (!main) {
 		ERR(sh, "Failure allocating memory.");
 		semanage_fc_node_list_destroy(head);
 		return -1;
@@ -2772,7 +2772,7 @@ int semanage_fc_sort(semanage_handle_t * sh, const char *buf, size_t buf_len,
 			    calloc(1, sizeof(semanage_file_context_bucket_t));
 			if (!(bcurrent->next)) {
 				ERR(sh, "Failure allocating memory.");
-				semanage_fc_bucket_list_destroy(master);
+				semanage_fc_bucket_list_destroy(main);
 				return -1;
 			}
 
@@ -2781,14 +2781,14 @@ int semanage_fc_sort(semanage_handle_t * sh, const char *buf, size_t buf_len,
 	}
 
 	/* Sort the bucket list. */
-	semanage_fc_merge_sort(master);
+	semanage_fc_merge_sort(main);
 
 	/* First, calculate how much space we'll need for 
 	 * the newly sorted block of data.  (We don't just
 	 * use buf_len for this because we have extracted
 	 * comments and whitespace.) */
 	i = 0;
-	current = master->data;
+	current = main->data;
 	while (current) {
 		i += current->path_len + 1;	/* +1 for a tab */
 		if (current->file_type) {
@@ -2803,14 +2803,14 @@ int semanage_fc_sort(semanage_handle_t * sh, const char *buf, size_t buf_len,
 	*sorted_buf = calloc(i, sizeof(char));
 	if (!*sorted_buf) {
 		ERR(sh, "Failure allocating memory.");
-		semanage_fc_bucket_list_destroy(master);
+		semanage_fc_bucket_list_destroy(main);
 		return -1;
 	}
 	*sorted_buf_len = i;
 
 	/* Output the sorted semanage_file_context linked list to the char buffer. */
 	sorted_buf_pos = *sorted_buf;
-	current = master->data;
+	current = main->data;
 	while (current) {
 		/* Output the path. */
 		i = current->path_len + 1;	/* +1 for tab */
@@ -2834,7 +2834,7 @@ int semanage_fc_sort(semanage_handle_t * sh, const char *buf, size_t buf_len,
 	}
 
 	/* Clean up. */
-	semanage_fc_bucket_list_destroy(master);
+	semanage_fc_bucket_list_destroy(main);
 
 	/* Sanity check. */
 	sorted_buf_pos++;
-- 
2.37.3


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

* Re: [PATCH 1/2] checkpolicy: Improve error message for type bounds
  2022-11-24 16:31 [PATCH 1/2] checkpolicy: Improve error message for type bounds Vit Mojzis
  2022-11-24 16:31 ` [PATCH 2/2] libsemanage: Use more conscious language Vit Mojzis
@ 2022-12-15 22:13 ` James Carter
  2022-12-16 21:59   ` James Carter
  1 sibling, 1 reply; 4+ messages in thread
From: James Carter @ 2022-12-15 22:13 UTC (permalink / raw)
  To: Vit Mojzis; +Cc: selinux

On Thu, Nov 24, 2022 at 11:40 AM Vit Mojzis <vmojzis@redhat.com> wrote:
>
> Make the error message consistent with other occurrences of the
> same issue:
> https://github.com/SELinuxProject/selinux/blob/master/checkpolicy/module_compiler.c#L243
> https://github.com/SELinuxProject/selinux/blob/master/checkpolicy/module_compiler.c#L488
>
> Signed-off-by: Vit Mojzis <vmojzis@redhat.com>

For these two patches:
Acked-by: James Carter <jwcart2@gmail.com>

> ---
>  checkpolicy/policy_define.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/checkpolicy/policy_define.c b/checkpolicy/policy_define.c
> index 41e44631..86d57017 100644
> --- a/checkpolicy/policy_define.c
> +++ b/checkpolicy/policy_define.c
> @@ -1416,7 +1416,7 @@ static int define_typebounds_helper(char *bounds_id, char *type_id)
>         if (!type->bounds)
>                 type->bounds = bounds->s.value;
>         else if (type->bounds != bounds->s.value) {
> -               yyerror2("type %s has inconsistent master {%s,%s}",
> +               yyerror2("type %s has inconsistent bounds %s/%s",
>                          type_id,
>                          policydbp->p_type_val_to_name[type->bounds - 1],
>                          policydbp->p_type_val_to_name[bounds->s.value - 1]);
> --
> 2.37.3
>

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

* Re: [PATCH 1/2] checkpolicy: Improve error message for type bounds
  2022-12-15 22:13 ` [PATCH 1/2] checkpolicy: Improve error message for type bounds James Carter
@ 2022-12-16 21:59   ` James Carter
  0 siblings, 0 replies; 4+ messages in thread
From: James Carter @ 2022-12-16 21:59 UTC (permalink / raw)
  To: Vit Mojzis; +Cc: selinux

On Thu, Dec 15, 2022 at 5:13 PM James Carter <jwcart2@gmail.com> wrote:
>
> On Thu, Nov 24, 2022 at 11:40 AM Vit Mojzis <vmojzis@redhat.com> wrote:
> >
> > Make the error message consistent with other occurrences of the
> > same issue:
> > https://github.com/SELinuxProject/selinux/blob/master/checkpolicy/module_compiler.c#L243
> > https://github.com/SELinuxProject/selinux/blob/master/checkpolicy/module_compiler.c#L488
> >
> > Signed-off-by: Vit Mojzis <vmojzis@redhat.com>
>
> For these two patches:
> Acked-by: James Carter <jwcart2@gmail.com>
>

Both of these have been merged.
Thanks,
Jim

> > ---
> >  checkpolicy/policy_define.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/checkpolicy/policy_define.c b/checkpolicy/policy_define.c
> > index 41e44631..86d57017 100644
> > --- a/checkpolicy/policy_define.c
> > +++ b/checkpolicy/policy_define.c
> > @@ -1416,7 +1416,7 @@ static int define_typebounds_helper(char *bounds_id, char *type_id)
> >         if (!type->bounds)
> >                 type->bounds = bounds->s.value;
> >         else if (type->bounds != bounds->s.value) {
> > -               yyerror2("type %s has inconsistent master {%s,%s}",
> > +               yyerror2("type %s has inconsistent bounds %s/%s",
> >                          type_id,
> >                          policydbp->p_type_val_to_name[type->bounds - 1],
> >                          policydbp->p_type_val_to_name[bounds->s.value - 1]);
> > --
> > 2.37.3
> >

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

end of thread, other threads:[~2022-12-16 22:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-24 16:31 [PATCH 1/2] checkpolicy: Improve error message for type bounds Vit Mojzis
2022-11-24 16:31 ` [PATCH 2/2] libsemanage: Use more conscious language Vit Mojzis
2022-12-15 22:13 ` [PATCH 1/2] checkpolicy: Improve error message for type bounds James Carter
2022-12-16 21:59   ` James Carter

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