Re: [PATCH v1 2/6] seccomp: prepare seccomp_run_filters() to support more than one listener
From: Tycho Andersen
Date: Tue Dec 02 2025 - 09:06:30 EST
On Tue, Dec 02, 2025 at 12:58:14PM +0100, Aleksandr Mikhalitsyn wrote:
> On Mon, Dec 1, 2025 at 3:24 PM Tycho Andersen <tycho@xxxxxxxxxx> wrote:
> >
> > On Mon, Dec 01, 2025 at 01:23:59PM +0100, Alexander Mikhalitsyn wrote:
> > > +/**
> > > + * struct seccomp_filter_matches - container for seccomp filter match results
> > > + *
> > > + * @n: A number of filters matched.
> > > + * @filters: An array of (struct seccomp_filter) pointers.
> > > + * Holds pointers to filters that matched during evaluation.
> > > + * A first one in the array is the one with the least permissive
> > > + * action result.
> > > + *
> > > + * If final action result is less (or more) permissive than SECCOMP_RET_USER_NOTIF,
> > > + * only the most restrictive filter is stored in the array's first element.
> > > + * If final action result is SECCOMP_RET_USER_NOTIF, we need to track
> > > + * all filters that resulted in the same action to support multiple listeners
> > > + * in seccomp tree.
> > > + */
> > > +struct seccomp_filter_matches {
> > > + unsigned char n;
> > > + struct seccomp_filter *filters[MAX_LISTENERS_PER_PATH];
> >
> > Maybe a __counted_by() for this?
>
> I thought that __counted_by() only makes sense for flex arrays, while
> in this case we have a static array.
Oh, duh, you're right of course.
Tycho