All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libselinux: warn on identical duplicate properties
@ 2025-02-13  2:22 Thiébaud Weksteen
  2025-03-07 19:10 ` James Carter
  0 siblings, 1 reply; 3+ messages in thread
From: Thiébaud Weksteen @ 2025-02-13  2:22 UTC (permalink / raw)
  To: selinux; +Cc: Thiébaud Weksteen

Instead of raising an error in case of matching duplicates, only report
the issue as a warning. This matches the downstream (AOSP) behaviour for
Android.

Signed-off-by: Thiébaud Weksteen <tweek@google.com>
---
 libselinux/src/label_backends_android.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libselinux/src/label_backends_android.c b/libselinux/src/label_backends_android.c
index cbe932ae..cf4f5cbf 100644
--- a/libselinux/src/label_backends_android.c
+++ b/libselinux/src/label_backends_android.c
@@ -58,10 +58,10 @@ static int nodups_specs(struct saved_data *data, const char *path)
 		for (jj = ii + 1; jj < data->nspec; jj++) {
 			if (!strcmp(spec_arr[jj].property_key,
 					    curr_spec->property_key)) {
-				rc = -1;
-				errno = EINVAL;
 				if (strcmp(spec_arr[jj].lr.ctx_raw,
 						    curr_spec->lr.ctx_raw)) {
+					rc = -1;
+					errno = EINVAL;
 					selinux_log
 						(SELINUX_ERROR,
 						 "%s: Multiple different specifications for %s  (%s and %s).\n",
@@ -70,7 +70,7 @@ static int nodups_specs(struct saved_data *data, const char *path)
 						 curr_spec->lr.ctx_raw);
 				} else {
 					selinux_log
-						(SELINUX_ERROR,
+						(SELINUX_WARNING,
 						 "%s: Multiple same specifications for %s.\n",
 						 path, curr_spec->property_key);
 				}
-- 
2.48.1.502.g6dc24dfdaf-goog


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

* Re: [PATCH] libselinux: warn on identical duplicate properties
  2025-02-13  2:22 [PATCH] libselinux: warn on identical duplicate properties Thiébaud Weksteen
@ 2025-03-07 19:10 ` James Carter
  2025-04-07 18:05   ` James Carter
  0 siblings, 1 reply; 3+ messages in thread
From: James Carter @ 2025-03-07 19:10 UTC (permalink / raw)
  To: Thiébaud Weksteen; +Cc: selinux

On Wed, Feb 12, 2025 at 9:22 PM Thiébaud Weksteen <tweek@google.com> wrote:
>
> Instead of raising an error in case of matching duplicates, only report
> the issue as a warning. This matches the downstream (AOSP) behaviour for
> Android.
>
> Signed-off-by: Thiébaud Weksteen <tweek@google.com>

Acked-by: James Carter <jwcart2@gmail.com>

> ---
>  libselinux/src/label_backends_android.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/libselinux/src/label_backends_android.c b/libselinux/src/label_backends_android.c
> index cbe932ae..cf4f5cbf 100644
> --- a/libselinux/src/label_backends_android.c
> +++ b/libselinux/src/label_backends_android.c
> @@ -58,10 +58,10 @@ static int nodups_specs(struct saved_data *data, const char *path)
>                 for (jj = ii + 1; jj < data->nspec; jj++) {
>                         if (!strcmp(spec_arr[jj].property_key,
>                                             curr_spec->property_key)) {
> -                               rc = -1;
> -                               errno = EINVAL;
>                                 if (strcmp(spec_arr[jj].lr.ctx_raw,
>                                                     curr_spec->lr.ctx_raw)) {
> +                                       rc = -1;
> +                                       errno = EINVAL;
>                                         selinux_log
>                                                 (SELINUX_ERROR,
>                                                  "%s: Multiple different specifications for %s  (%s and %s).\n",
> @@ -70,7 +70,7 @@ static int nodups_specs(struct saved_data *data, const char *path)
>                                                  curr_spec->lr.ctx_raw);
>                                 } else {
>                                         selinux_log
> -                                               (SELINUX_ERROR,
> +                                               (SELINUX_WARNING,
>                                                  "%s: Multiple same specifications for %s.\n",
>                                                  path, curr_spec->property_key);
>                                 }
> --
> 2.48.1.502.g6dc24dfdaf-goog
>
>

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

* Re: [PATCH] libselinux: warn on identical duplicate properties
  2025-03-07 19:10 ` James Carter
@ 2025-04-07 18:05   ` James Carter
  0 siblings, 0 replies; 3+ messages in thread
From: James Carter @ 2025-04-07 18:05 UTC (permalink / raw)
  To: Thiébaud Weksteen; +Cc: selinux

On Fri, Mar 7, 2025 at 2:10 PM James Carter <jwcart2@gmail.com> wrote:
>
> On Wed, Feb 12, 2025 at 9:22 PM Thiébaud Weksteen <tweek@google.com> wrote:
> >
> > Instead of raising an error in case of matching duplicates, only report
> > the issue as a warning. This matches the downstream (AOSP) behaviour for
> > Android.
> >
> > Signed-off-by: Thiébaud Weksteen <tweek@google.com>
>
> Acked-by: James Carter <jwcart2@gmail.com>
>

Merged.
Thanks,
Jim

> > ---
> >  libselinux/src/label_backends_android.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/libselinux/src/label_backends_android.c b/libselinux/src/label_backends_android.c
> > index cbe932ae..cf4f5cbf 100644
> > --- a/libselinux/src/label_backends_android.c
> > +++ b/libselinux/src/label_backends_android.c
> > @@ -58,10 +58,10 @@ static int nodups_specs(struct saved_data *data, const char *path)
> >                 for (jj = ii + 1; jj < data->nspec; jj++) {
> >                         if (!strcmp(spec_arr[jj].property_key,
> >                                             curr_spec->property_key)) {
> > -                               rc = -1;
> > -                               errno = EINVAL;
> >                                 if (strcmp(spec_arr[jj].lr.ctx_raw,
> >                                                     curr_spec->lr.ctx_raw)) {
> > +                                       rc = -1;
> > +                                       errno = EINVAL;
> >                                         selinux_log
> >                                                 (SELINUX_ERROR,
> >                                                  "%s: Multiple different specifications for %s  (%s and %s).\n",
> > @@ -70,7 +70,7 @@ static int nodups_specs(struct saved_data *data, const char *path)
> >                                                  curr_spec->lr.ctx_raw);
> >                                 } else {
> >                                         selinux_log
> > -                                               (SELINUX_ERROR,
> > +                                               (SELINUX_WARNING,
> >                                                  "%s: Multiple same specifications for %s.\n",
> >                                                  path, curr_spec->property_key);
> >                                 }
> > --
> > 2.48.1.502.g6dc24dfdaf-goog
> >
> >

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

end of thread, other threads:[~2025-04-07 18:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-13  2:22 [PATCH] libselinux: warn on identical duplicate properties Thiébaud Weksteen
2025-03-07 19:10 ` James Carter
2025-04-07 18:05   ` James Carter

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.