All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Lautrbach <plautrba@redhat.com>
To: selinux@vger.kernel.org, "James Carter" <jwcart2@gmail.com>,
	"Christian Göttsche" <cgzones@googlemail.com>
Cc: Milos Malik <mmalik@redhat.com>
Subject: Re: [PATCH] libsepol/cil: restore error on context rule conflicts
Date: Thu, 13 Oct 2022 15:13:45 +0200	[thread overview]
Message-ID: <87czavsw6u.fsf@redhat.com> (raw)
In-Reply-To: <CAP+JOzQr_1bBDAp=jyBb37cNFQKW0CDsixiM3aAcWSWAJtvQxg@mail.gmail.com>

James Carter <jwcart2@gmail.com> writes:

> On Wed, Oct 12, 2022 at 10:28 AM Christian Göttsche
> <cgzones@googlemail.com> wrote:
>>
>> Commit bc26ddc59c8d ("libsepol/cil: Limit the amount of reporting for
>> context rule conflicts") reworked the processing of context rule
>> conflicts to limit the number of written conflicting statements to
>> increase readability of the printed error message.  It forgot to set the
>> return value, signaling a context conflict, in the case the logging
>> level is higher than warning (e.g. in semodule(8), which defaults to
>> error).
>>
>> Reported-by: Milos Malik <mmalik@redhat.com> [1]
>> Fixes: bc26ddc59c8d ("libsepol/cil: Limit the amount of reporting for context rule conflicts")
>>
>> [1]: https://lore.kernel.org/selinux/87y1u1rkoo.fsf@redhat.com/
>>
>> Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
>
> Acked-by: James Carter <jwcart2@gmail.com>

Tested-by: Petr Lautrbach <plautrba@redhat.com>

Thanks!


>> ---
>>  libsepol/cil/src/cil_post.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/libsepol/cil/src/cil_post.c b/libsepol/cil/src/cil_post.c
>> index 6e95225f..11e572e2 100644
>> --- a/libsepol/cil/src/cil_post.c
>> +++ b/libsepol/cil/src/cil_post.c
>> @@ -2290,6 +2290,7 @@ static int __cil_post_process_context_rules(struct cil_sort *sort, int (*compar)
>>                 } else {
>>                         removed++;
>>                         if (!db->multiple_decls || concompar(&sort->array[i], &sort->array[j]) != 0) {
>> +                               rc = SEPOL_ERR;
>>                                 conflicting++;
>>                                 if (log_level >= CIL_WARN) {
>>                                         struct cil_list_item li;
>> @@ -2297,7 +2298,6 @@ static int __cil_post_process_context_rules(struct cil_sort *sort, int (*compar)
>>                                         li.flavor = flavor;
>>                                         if (conflicting == 1) {
>>                                                 cil_log(CIL_WARN, "Found conflicting %s rules\n", flavor_str);
>> -                                               rc = SEPOL_ERR;
>>                                                 li.data = sort->array[i];
>>                                                 rc2 = cil_tree_walk(db->ast->root, __cil_post_report_conflict,
>>                                                                                         NULL, NULL, &li);
>> --
>> 2.37.2
>>


  reply	other threads:[~2022-10-13 13:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-12 14:27 [PATCH] libsepol/cil: restore error on context rule conflicts Christian Göttsche
2022-10-12 15:38 ` James Carter
2022-10-13 13:13   ` Petr Lautrbach [this message]
2022-10-13 15:26     ` James Carter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87czavsw6u.fsf@redhat.com \
    --to=plautrba@redhat.com \
    --cc=cgzones@googlemail.com \
    --cc=jwcart2@gmail.com \
    --cc=mmalik@redhat.com \
    --cc=selinux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.