Re: [PATCH 1/9] Revert "libselinux/utils: drop reachable assert in sefcontext_compile"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It looks like Christian was able to fix the problem, so ignore these.
Jim

On Wed, Dec 11, 2024 at 11:14 AM James Carter <jwcart2@xxxxxxxxx> wrote:
>
> This reverts commit f50abe2a3aad0716a0711cfcc07f934f4a9d2b02.
>
> Needed to revert commit 92306daf5219e73f6e8bc9fc7699399457999bcd
> "libselinux: rework selabel_file(5) database", which broke Android
> file_context matching.
>
> Signed-off-by: James Carter <jwcart2@xxxxxxxxx>
> ---
>  libselinux/utils/sefcontext_compile.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/libselinux/utils/sefcontext_compile.c b/libselinux/utils/sefcontext_compile.c
> index b4445a1f..5d7ab301 100644
> --- a/libselinux/utils/sefcontext_compile.c
> +++ b/libselinux/utils/sefcontext_compile.c
> @@ -188,9 +188,6 @@ static int write_sidtab(FILE *bin_file, const struct sidtab *stab)
>         if (len != 1)
>                 return -1;
>
> -       if (stab->nel == 0)
> -               return 0;
> -
>         /* sort entries by id */
>         sids = calloc(stab->nel, sizeof(*sids));
>         if (!sids)
> @@ -206,6 +203,8 @@ static int write_sidtab(FILE *bin_file, const struct sidtab *stab)
>         }
>         assert(index == stab->nel);
>         qsort(sids, stab->nel, sizeof(struct security_id), security_id_compare);
> +       assert(sids[0].id == 1);
> +       assert(sids[stab->nel - 1].id == stab->nel);
>
>         /* write raw contexts sorted by id */
>         for (uint32_t i = 0; i < stab->nel; i++) {
> --
> 2.47.1
>





[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux