[PATCH v9 03/15] Introduce new filtering architecture

Dmitry V. Levin ldv at altlinux.org
Fri Aug 25 02:27:55 UTC 2017


On Thu, Aug 24, 2017 at 06:19:41PM +0700, Nikolay Marchuk wrote:
> This change introduces new filtering architecture primitives: filter,
> filter_action and bool_expression. Filtering is now done after decoding of
> syscall and tcp->qual_flg stores filtering results.
[...]
> diff --git a/filter.c b/filter.c
> new file mode 100644
> index 00000000..9c9b7e0d
> --- /dev/null
> +++ b/filter.c
[...]
> +#include "defs.h"
> +#include "filter.h"
> +
> +#define DECL_FILTER(name)						\
> +extern void *								\
> +parse_ ## name ## _filter(const char *);				\
> +extern bool								\
> +run_ ## name ## _filter(struct tcb *, void *);				\
> +extern void								\
> +free_ ## name ## _filter(void *)					\
> +/* End of DECL_FILTER definition. */
> +
> +DECL_FILTER(syscall);
> +DECL_FILTER(fd);
> +DECL_FILTER(path);
> +#undef DECL_FILTER

What are all these function declarations doing in this compilation unit?
What guarantees that these declarations match definitions?

[...]
> diff --git a/filter_action.c b/filter_action.c
> new file mode 100644
> index 00000000..0f75f2e5
> --- /dev/null
> +++ b/filter_action.c
[...]
> +#include "defs.h"
> +#include "filter.h"
> +
> +#define DECL_FILTER_ACTION(name)					\
> +extern void								\
> +apply_ ## name(struct tcb *, void *)					\
> +/* End of DECL_FILTER_ACTION definition. */
> +
> +DECL_FILTER_ACTION(trace);
> +DECL_FILTER_ACTION(inject);
> +DECL_FILTER_ACTION(fault);
> +DECL_FILTER_ACTION(read);
> +DECL_FILTER_ACTION(write);
> +DECL_FILTER_ACTION(raw);
> +DECL_FILTER_ACTION(abbrev);
> +DECL_FILTER_ACTION(verbose);
> +#undef DECL_FILTER_ACTION
> +
> +extern bool is_traced(struct tcb *);
> +extern bool not_injected(struct tcb *);
> +
> +#define DECL_FILTER_ACTION_PARSER(name)					\
> +extern void *								\
> +parse_ ## name(const char *);						\
> +/* End of DECL_FILTER_ACTION_PARSER definition. */
> +
> +DECL_FILTER_ACTION_PARSER(null);
> +DECL_FILTER_ACTION_PARSER(inject);
> +DECL_FILTER_ACTION_PARSER(fault);
> +#undef DECL_FILTER_ACTION_PARSER

Likewise.


-- 
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/20170825/5881238b/attachment.bin>


More information about the Strace-devel mailing list