aboutgitcodelistschat:MatrixIRC
path: root/common
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2024-05-15 08:49:56 +0200
committerStefano Brivio <sbrivio@redhat.com>2024-05-15 08:49:56 +0200
commit5a9302bab9c9bb3d1577f04678d074fb7af4115f (patch)
tree21d04573dfa733e020315d08853c00fc119fb959 /common
parentbdbec30a849807fb5e6841a38cfe0d168e5962b9 (diff)
downloadseitan-5a9302bab9c9bb3d1577f04678d074fb7af4115f.tar
seitan-5a9302bab9c9bb3d1577f04678d074fb7af4115f.tar.gz
seitan-5a9302bab9c9bb3d1577f04678d074fb7af4115f.tar.bz2
seitan-5a9302bab9c9bb3d1577f04678d074fb7af4115f.tar.lz
seitan-5a9302bab9c9bb3d1577f04678d074fb7af4115f.tar.xz
seitan-5a9302bab9c9bb3d1577f04678d074fb7af4115f.tar.zst
seitan-5a9302bab9c9bb3d1577f04678d074fb7af4115f.zip
Add fsetxattr(), fremovexattr(), open_by_handle_at(), and "virtiofsd demo"
Mostly assorted fixes, a new FDGET operation (get a copy of the target file descriptor via pidfd_getfd()) and a new "FD" flag that means we have to do that on direct tag reference. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'common')
-rw-r--r--common/gluten.h34
-rw-r--r--common/util.c4
2 files changed, 28 insertions, 10 deletions
diff --git a/common/gluten.h b/common/gluten.h
index 1414d9e..d06362a 100644
--- a/common/gluten.h
+++ b/common/gluten.h
@@ -21,10 +21,10 @@
extern struct seccomp_data anonymous_seccomp_data;
-#define HEADER_SIZE 65536
-#define INST_SIZE 65536
-#define RO_DATA_SIZE 65536
-#define DATA_SIZE 65536
+#define HEADER_SIZE (1 << 20)
+#define INST_SIZE (1 << 20)
+#define RO_DATA_SIZE (1 << 20)
+#define DATA_SIZE (1 << 20)
#define INST_MAX 256
#define OFFSET_MAX \
@@ -67,13 +67,14 @@ enum op_type {
OP_CALL,
OP_COPY,
OP_FD,
+ OP_FDGET,
OP_RETURN,
OP_LOAD,
OP_STORE,
OP_IOVLOAD,
OP_BITWISE,
OP_CMP,
- OP_RESOLVEDFD,
+ OP_RESOLVEFD,
};
/**
@@ -199,6 +200,11 @@ struct op_fd {
struct gluten_offset desc; /* struct fd_desc */
};
+struct op_fdget {
+ struct gluten_offset src;
+ struct gluten_offset dst;
+};
+
struct op_load {
struct gluten_offset src;
struct gluten_offset dst;
@@ -261,14 +267,23 @@ struct op_bitwise {
struct gluten_offset desc; /* struct bitwise_desc */
};
+enum resolvefd_type {
+ RESOLVEFD_PATH,
+ RESOLVEFD_MOUNT,
+ RESOLVEFD_MAX = RESOLVEFD_MOUNT,
+};
+
+extern const char *resolvefd_type_str[RESOLVEFD_MAX + 1];
+
struct resolvefd_desc {
- struct gluten_offset fd;
- struct gluten_offset path;
- size_t path_max;
+ struct gluten_offset fd;
+ struct gluten_offset path;
+ enum resolvefd_type type;
+ size_t path_max;
};
struct op_resolvefd {
- struct gluten_offset desc;
+ struct gluten_offset desc; /* struct resolvefd_desc */
};
struct op_copy {
@@ -284,6 +299,7 @@ struct op {
struct op_call call;
struct op_return ret;
struct op_fd fd;
+ struct op_fdget fdget;
struct op_load load;
struct op_store store;
struct op_iovload iovload;
diff --git a/common/util.c b/common/util.c
index 94aeea3..3164126 100644
--- a/common/util.c
+++ b/common/util.c
@@ -54,11 +54,13 @@ const char *context_spec_type_name[CONTEXT_SPEC_TYPE_MAX + 1] = {
const char *bitwise_type_str[BITWISE_MAX + 1] = { "&", "|" };
const char *cmp_type_str[CMP_MAX + 1] = {
- "EQ", "NE", "GT", "GE", "LT", "LE",
+ "EQ", "NE", "GT", "GE", "LT", "LE",
};
const char *metadata_type_str[METADATA_MAX + 1] = { "uid", "gid", "pid" };
+const char *resolvefd_type_str[RESOLVEFD_MAX + 1] = { "path", "mount" };
+
const char *syscall_name(long nr) {
struct call **set, *call;