aboutgitcodelistschat:MatrixIRC
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/gluten.h10
-rw-r--r--common/util.c5
2 files changed, 12 insertions, 3 deletions
diff --git a/common/gluten.h b/common/gluten.h
index 3df638e..ff29caa 100644
--- a/common/gluten.h
+++ b/common/gluten.h
@@ -10,6 +10,7 @@
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
+#include <sys/types.h>
#include <linux/seccomp.h>
#include <stdio.h>
@@ -39,6 +40,8 @@ enum gluten_offset_type {
OFFSET_TYPE_MAX = OFFSET_INSTRUCTION,
};
+extern const char *gluten_offset_name[OFFSET_TYPE_MAX + 1];
+
struct gluten_offset {
#ifdef __GNUC__
enum gluten_offset_type type : BITS_PER_NUM(OFFSET_TYPE_MAX);
@@ -89,6 +92,8 @@ struct op_context {
};
enum op_type {
+ OP_END = 0,
+ OP_NR,
OP_CALL,
OP_BLOCK,
OP_CONT,
@@ -98,7 +103,6 @@ enum op_type {
OP_LOAD,
OP_CMP,
OP_RESOLVEDFD,
- OP_END,
};
struct op_nr {
@@ -147,7 +151,7 @@ struct op_cmp {
struct gluten_offset y;
size_t size;
enum op_cmp_type cmp;
- unsigned int jmp;
+ struct gluten_offset jmp;
};
struct op_resolvedfd {
@@ -237,7 +241,7 @@ static inline const void *gluten_ptr(const struct seccomp_data *s,
if (!is_offset_valid(x))
return NULL;
- if(x.type == OFFSET_SECCOMP_DATA && s == NULL)
+ if (x.type == OFFSET_SECCOMP_DATA && s == NULL)
return NULL;
switch (x.type) {
diff --git a/common/util.c b/common/util.c
index a2ecce0..3a4b2e5 100644
--- a/common/util.c
+++ b/common/util.c
@@ -12,6 +12,8 @@
#include <stdarg.h>
#include <string.h>
+#include "gluten.h"
+
#define logfn(name) \
void name(const char *format, ...) { \
va_list args; \
@@ -27,3 +29,6 @@ logfn(err)
logfn(info)
logfn(debug)
+const char *gluten_offset_name[OFFSET_TYPE_MAX + 1] = {
+ "read-only data", "temporary data", "seccomp data", "instruction area"
+};