[PATCH RFC v2 1/3] Introduce seccomp-assisted syscall filtering

Dmitry V. Levin ldv at altlinux.org
Mon Aug 5 19:24:07 UTC 2019


On Mon, Aug 05, 2019 at 07:59:25PM +0200, Eugene Syromiatnikov wrote:
> On Wed, Jul 31, 2019 at 05:35:56PM +0200, Paul Chaignon wrote:
[...]
> > diff --git a/defs.h b/defs.h
> > index 51622c05..1ff17ae8 100644
> > --- a/defs.h
> > +++ b/defs.h
> > @@ -147,6 +147,15 @@ extern char *stpcpy(char *dst, const char *src);
> >  #  define HAVE_PERSONALITY_2_MPERS 0
> >  # endif
> >  
> 
> > +# ifndef PERSONALITY0_AUDIT_ARCH
> > +#  define PERSONALITY0_AUDIT_ARCH  { 0, 0 }
> > +# endif
> > +# if SUPPORTED_PERSONALITIES > 1
> > +#  ifndef PERSONALITY1_AUDIT_ARCH
> > +#   define PERSONALITY1_AUDIT_ARCH { 0, 0 }
> > +#  endif
> > +# endif
> 
> I think those better suited in linux/arch_defs_.h. And even then, I
> think that the absence of the related definitions may be an error.

I think there should be no need for fallback definitions of
PERSONALITY0_AUDIT_ARCH and PERSONALITY1_AUDIT_ARCH, see below.

[...]
> > +struct audit_arch_t audit_arch_vec[SUPPORTED_PERSONALITIES] = {
> > +	PERSONALITY0_AUDIT_ARCH,
> > +#if SUPPORTED_PERSONALITIES > 1
> > +	PERSONALITY1_AUDIT_ARCH,
> > +# if SUPPORTED_PERSONALITIES > 2
> > +	PERSONALITY2_AUDIT_ARCH,
> > +# endif
> > +#endif
> > +};

I suggest to define it the following way instead:

static struct audit_arch_t audit_arch_vec[SUPPORTED_PERSONALITIES] = {
#if SUPPORTED_PERSONALITIES > 1
	PERSONALITY0_AUDIT_ARCH,
	PERSONALITY1_AUDIT_ARCH,
# if SUPPORTED_PERSONALITIES > 2
	PERSONALITY2_AUDIT_ARCH
# endif
#endif

This makes audit_arch_vec all zeroes in case of SUPPORTED_PERSONALITIES == 1
and asserts that all PERSONALITY*_AUDIT_ARCH values are defined on those
architectures that have SUPPORTED_PERSONALITIES > 1.


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20190805/f692ec9c/attachment.bin>


More information about the Strace-devel mailing list