aboutgitcodelistschat:MatrixIRC
path: root/common
diff options
context:
space:
mode:
authorAlice Frosi <afrosi@redhat.com>2023-05-16 08:25:27 +0200
committerAlice Frosi <afrosi@redhat.com>2023-05-19 14:37:42 +0200
commitfbc205bab17a25ae3dabef5a2ad97edcfcef9eef (patch)
tree58e97ef6b8cd054bec8ded905f73cc7170ffb4df /common
parentef403b6687ec5739933f9f215093e1ea5c923666 (diff)
downloadseitan-fbc205bab17a25ae3dabef5a2ad97edcfcef9eef.tar
seitan-fbc205bab17a25ae3dabef5a2ad97edcfcef9eef.tar.gz
seitan-fbc205bab17a25ae3dabef5a2ad97edcfcef9eef.tar.bz2
seitan-fbc205bab17a25ae3dabef5a2ad97edcfcef9eef.tar.lz
seitan-fbc205bab17a25ae3dabef5a2ad97edcfcef9eef.tar.xz
seitan-fbc205bab17a25ae3dabef5a2ad97edcfcef9eef.tar.zst
seitan-fbc205bab17a25ae3dabef5a2ad97edcfcef9eef.zip
ops: fix op_call and tests
Diffstat (limited to 'common')
-rw-r--r--common/gluten.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/common/gluten.h b/common/gluten.h
index 07f4148..9bd4689 100644
--- a/common/gluten.h
+++ b/common/gluten.h
@@ -32,6 +32,8 @@ extern struct seccomp_data anonymous_seccomp_data;
#define OP_EMPTY { .block = { -1 } }
#define NO_FIELD block
+#define NS_NUM sizeof(enum ns_type)
+
enum gluten_offset_type {
OFFSET_RO_DATA = 0,
OFFSET_DATA = 1,
@@ -183,7 +185,7 @@ struct op {
} op;
};
-#ifdef COOKER
+#if defined(COOKER) || defined(SEITAN_TEST)
# define GLUTEN_CONST
#else
# define GLUTEN_CONST const
@@ -269,7 +271,11 @@ static inline const void *gluten_ptr(const struct seccomp_data *s,
static inline bool check_gluten_limits(struct gluten_offset v, size_t size)
{
struct gluten_offset off = { v.type, v.offset + size };
- return is_offset_valid(off);
+ if (is_offset_valid(off))
+ return true;
+
+ err(" offset limits are invalid");
+ return false;
}
static inline int gluten_write(struct gluten *g, struct gluten_offset dst,