SELinux Archive mirror
 help / color / mirror / Atom feed
From: James Carter <jwcart2@gmail.com>
To: "Christian Göttsche" <cgzones@googlemail.com>
Cc: selinux@vger.kernel.org
Subject: Re: [PATCH 1/3] libsepol: ensure transitivity in compare functions
Date: Mon, 4 Mar 2024 14:12:47 -0500	[thread overview]
Message-ID: <CAP+JOzS5eZOOpRfNKNfQFa8-GBd-PnBLJhvzZBdDDVOwTKqpaw@mail.gmail.com> (raw)
In-Reply-To: <CAP+JOzT+xzAxFaGBcrGK_ye1SPnLb_DvJtr7B2L25F2mfDrsSQ@mail.gmail.com>

On Thu, Feb 22, 2024 at 10:14 AM James Carter <jwcart2@gmail.com> wrote:
>
> On Wed, Jan 31, 2024 at 8:06 AM Christian Göttsche
> <cgzones@googlemail.com> wrote:
> >
> > Ensure comparison functions used by qsort(3) fulfill transitivity, since
> > otherwise the resulting array might not be sorted correctly or worse[1]
> > in case of integer overflows.
> >
> > [1]: https://www.qualys.com/2024/01/30/qsort.txt
> >
> > Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
>
> For these three patches:
> Acked-by: James Carter <jwcart2@gmail.com>
>
These three patches have been merged.
Thanks,
Jim

> > ---
> >  libsepol/src/kernel_to_common.c | 2 +-
> >  libsepol/src/module_to_cil.c    | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/libsepol/src/kernel_to_common.c b/libsepol/src/kernel_to_common.c
> > index 2422eed0..44f0be23 100644
> > --- a/libsepol/src/kernel_to_common.c
> > +++ b/libsepol/src/kernel_to_common.c
> > @@ -503,7 +503,7 @@ static int ibendport_data_cmp(const void *a, const void *b)
> >         if (rc)
> >                 return rc;
> >
> > -       return (*aa)->u.ibendport.port - (*bb)->u.ibendport.port;
> > +       return spaceship_cmp((*aa)->u.ibendport.port, (*bb)->u.ibendport.port);
> >  }
> >
> >  static int pirq_data_cmp(const void *a, const void *b)
> > diff --git a/libsepol/src/module_to_cil.c b/libsepol/src/module_to_cil.c
> > index ee22dbbd..c8dae562 100644
> > --- a/libsepol/src/module_to_cil.c
> > +++ b/libsepol/src/module_to_cil.c
> > @@ -1680,7 +1680,7 @@ static int class_perm_cmp(const void *a, const void *b)
> >         const struct class_perm_datum *aa = a;
> >         const struct class_perm_datum *bb = b;
> >
> > -       return aa->val - bb->val;
> > +       return spaceship_cmp(aa->val, bb->val);
> >  }
> >
> >  static int common_to_cil(char *key, void *data, void *UNUSED(arg))
> > --
> > 2.43.0
> >
> >

      reply	other threads:[~2024-03-04 19:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-31 12:56 [PATCH 1/3] libsepol: ensure transitivity in compare functions Christian Göttsche
2024-01-31 12:56 ` [PATCH 2/3] libsepol/cil: " Christian Göttsche
2024-01-31 12:56 ` [PATCH 3/3] mcstrans: " Christian Göttsche
2024-02-22 15:14 ` [PATCH 1/3] libsepol: " James Carter
2024-03-04 19:12   ` James Carter [this message]

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=CAP+JOzS5eZOOpRfNKNfQFa8-GBd-PnBLJhvzZBdDDVOwTKqpaw@mail.gmail.com \
    --to=jwcart2@gmail.com \
    --cc=cgzones@googlemail.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 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 read-only IMAP folder(s) and NNTP newsgroup(s).