aboutgitcodelistschat:MatrixIRC
path: root/common
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2023-06-01 11:04:38 +0200
committerStefano Brivio <sbrivio@redhat.com>2023-06-01 11:10:27 +0200
commit1644bbec6161ec971a2ba3c213ce285b995cac22 (patch)
tree75974577237f8ae1a0989755be0a953c631f794e /common
parentbb47d77d316137c9deddd46135b22dc144ae1ea9 (diff)
downloadseitan-1644bbec6161ec971a2ba3c213ce285b995cac22.tar
seitan-1644bbec6161ec971a2ba3c213ce285b995cac22.tar.gz
seitan-1644bbec6161ec971a2ba3c213ce285b995cac22.tar.bz2
seitan-1644bbec6161ec971a2ba3c213ce285b995cac22.tar.lz
seitan-1644bbec6161ec971a2ba3c213ce285b995cac22.tar.xz
seitan-1644bbec6161ec971a2ba3c213ce285b995cac22.tar.zst
seitan-1644bbec6161ec971a2ba3c213ce285b995cac22.zip
cooker: OP_CALL and OP_COPY stuff
...mostly. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'common')
-rw-r--r--common/gluten.h23
-rw-r--r--common/util.c1
2 files changed, 14 insertions, 10 deletions
diff --git a/common/gluten.h b/common/gluten.h
index 6c0fc25..5409234 100644
--- a/common/gluten.h
+++ b/common/gluten.h
@@ -36,25 +36,26 @@ extern struct seccomp_data anonymous_seccomp_data;
#define GET_BIT(x, i) (((x) & (1UL << (i))) != 0)
enum gluten_offset_type {
- OFFSET_RO_DATA = 0,
- OFFSET_DATA = 1,
- OFFSET_SECCOMP_DATA = 2,
- OFFSET_INSTRUCTION = 3,
- OFFSET_TYPE_MAX = OFFSET_INSTRUCTION,
+ OFFSET_NULL = 0,
+ OFFSET_RO_DATA = 1,
+ OFFSET_DATA = 2,
+ OFFSET_SECCOMP_DATA = 3,
+ OFFSET_INSTRUCTION = 4,
+ 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);
+ enum gluten_offset_type type :BITS_PER_NUM(OFFSET_TYPE_MAX);
#else
- uint16_t type : BITS_PER_NUM(OFFSET_TYPE_MAX);
+ uint32_t type :BITS_PER_NUM(OFFSET_TYPE_MAX);
#endif
- uint16_t offset : BITS_PER_NUM(OFFSET_MAX);
+ uint32_t offset :BITS_PER_NUM(OFFSET_MAX);
};
-BUILD_BUG_ON(BITS_PER_NUM(OFFSET_TYPE_MAX) + BITS_PER_NUM(OFFSET_MAX) > 16)
+BUILD_BUG_ON(BITS_PER_NUM(OFFSET_TYPE_MAX) + BITS_PER_NUM(OFFSET_MAX) > 32)
enum ns_spec_type {
NS_NONE,
@@ -98,6 +99,7 @@ enum op_type {
OP_END = 0,
OP_NR,
OP_CALL,
+ OP_COPY,
OP_BLOCK,
OP_CONT,
OP_INJECT,
@@ -106,7 +108,6 @@ enum op_type {
OP_LOAD,
OP_CMP,
OP_RESOLVEDFD,
- OP_COPY,
};
struct op_nr {
@@ -212,6 +213,8 @@ BUILD_BUG_ON(INST_SIZE < INST_MAX * sizeof(struct op))
static inline bool is_offset_valid(const struct gluten_offset x)
{
switch (x.type) {
+ case OFFSET_NULL:
+ return false;
case OFFSET_DATA:
return x.offset < DATA_SIZE;
case OFFSET_RO_DATA:
diff --git a/common/util.c b/common/util.c
index 3a4b2e5..19d5c12 100644
--- a/common/util.c
+++ b/common/util.c
@@ -30,5 +30,6 @@ logfn(info)
logfn(debug)
const char *gluten_offset_name[OFFSET_TYPE_MAX + 1] = {
+ "NULL",
"read-only data", "temporary data", "seccomp data", "instruction area"
};