Re: [PATCH 1/2] libselinux: support multiple spec_files

Thiébaud Weksteen <[email protected]> Wed, 22 Jul 2026 09:59:29 +1000
Newsgroups org.kernel.vger.selinux
Message-ID <CA+zpnLcdRZdyRFkUkJNwYwv59zLqYNtT9540tW4XK1MyRiLHwA@mail.gmail.com>
On Wed, Jul 22, 2026 at 1:08 AM Stephen Smalley
<[email protected]> wrote:
>
> On Mon, Jul 20, 2026 at 10:11 PM Thiébaud Weksteen <[email protected]> wrote:
> >
> > Update the existing backends to potentially allocate multiple
> > spec_files. This commit simply adds a level of indirection but does not
> > change any current behaviour. It will facilitate the gradual migration
> > of backends to multiple context files.
> >
> > In selabel_fini(), compat_validate() is updated to use the first
> > spec_file only, for legacy validation error reporting. selabel_open() is
> > already performing context validation if requested against individual
> > file paths (see insert_spec).
> >
> > Signed-off-by: Thiébaud Weksteen <[email protected]>
> > ---

> > -       rec->spec_file = strdup(path);
> > -       if (!rec->spec_file) {
> > +       rec->spec_files = calloc(1, sizeof(path));
>
> Here and below, any particular reason you didn't use
> sizeof(*rec->spec_files) instead of sizeof(path)?
> It's not wrong, just not what I usually see.
>

No particular reason. I'll update this in the next patch version.
Thanks for the review Stephen.