summaryrefslogtreecommitdiff
path: root/src/db.h
diff options
context:
space:
mode:
authorPaul Moore <pmoore@redhat.com>2012-04-03 12:48:38 -0400
committerPaul Moore <pmoore@redhat.com>2012-04-04 17:37:41 -0400
commit2f4fb8052e2d718cf6b2d1caa97ace61e06531ad (patch)
treebe6bd4c03c1d38afba2f03be592f0699e64ff7d3 /src/db.h
parent244060c148ebb7ad9009b8bad8e375dfcd3b38f2 (diff)
downloadlibseccomp-2f4fb8052e2d718cf6b2d1caa97ace61e06531ad.tar.gz
all: support masked comparisons
Signed-off-by: Paul Moore <pmoore@redhat.com>
Diffstat (limited to 'src/db.h')
-rw-r--r--src/db.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/db.h b/src/db.h
index 715ad90..1a92088 100644
--- a/src/db.h
+++ b/src/db.h
@@ -35,7 +35,8 @@ struct db_api_arg {
unsigned int arg;
unsigned int op;
- datum_t datum;
+ scmp_datum_t mask;
+ scmp_datum_t datum;
};
struct db_arg_chain_tree {
@@ -47,6 +48,7 @@ struct db_arg_chain_tree {
/* comparison operator */
enum scmp_compare op;
/* syscall argument value */
+ uint32_t mask;
uint32_t datum;
/* actions */
@@ -64,15 +66,19 @@ struct db_arg_chain_tree {
unsigned int refcnt;
};
+#define ARG_MASK_MAX ((uint32_t)-1)
#define db_chain_lt(x,y) \
(((x)->arg < (y)->arg) || \
- (((x)->arg == (y)->arg) && ((x)->op < (y)->op)))
+ (((x)->arg == (y)->arg) && (((x)->op < (y)->op) || \
+ (((x)->mask & (y)->mask) == (y)->mask))))
#define db_chain_eq(x,y) \
(((x)->arg == (y)->arg) && \
- ((x)->op == (y)->op) && ((x)->datum == (y)->datum))
+ ((x)->op == (y)->op) && ((x)->datum == (y)->datum) && \
+ ((x)->mask == (y)->mask))
#define db_chain_gt(x,y) \
(((x)->arg > (y)->arg) || \
- (((x)->arg == (y)->arg) && ((x)->op > (y)->op)))
+ (((x)->arg == (y)->arg) && (((x)->op > (y)->op) || \
+ (((x)->mask & (y)->mask) != (y)->mask))))
#define db_chain_leaf(x) \
(((x)->act_t_flg != 0) || ((x)->act_f_flg != 0))
#define db_chain_zombie(x) \