aboutgitcodelistschat:MatrixIRC
path: root/gluten.h
diff options
context:
space:
mode:
authorAlice Frosi <afrosi@redhat.com>2023-01-24 17:05:11 +0100
committerAlice Frosi <afrosi@redhat.com>2023-02-15 13:10:01 +0100
commit2a0e9e1d8ebabf71299c7027d4577b5c709d6ea5 (patch)
tree02c8f267fd4224e05057343650884546f0aff739 /gluten.h
parenta5ab34509d8a52c37ab6c9c5d5f3501b61bd8d0e (diff)
downloadseitan-2a0e9e1d8ebabf71299c7027d4577b5c709d6ea5.tar
seitan-2a0e9e1d8ebabf71299c7027d4577b5c709d6ea5.tar.gz
seitan-2a0e9e1d8ebabf71299c7027d4577b5c709d6ea5.tar.bz2
seitan-2a0e9e1d8ebabf71299c7027d4577b5c709d6ea5.tar.lz
seitan-2a0e9e1d8ebabf71299c7027d4577b5c709d6ea5.tar.xz
seitan-2a0e9e1d8ebabf71299c7027d4577b5c709d6ea5.tar.zst
seitan-2a0e9e1d8ebabf71299c7027d4577b5c709d6ea5.zip
seitan: action for the call
Perform the action action with the context. The action call executes a syscall in the given namespaces or in caller context if non is specified. Signed-off-by: Alice Frosi <afrosi@redhat.com>
Diffstat (limited to 'gluten.h')
-rw-r--r--gluten.h94
1 files changed, 94 insertions, 0 deletions
diff --git a/gluten.h b/gluten.h
new file mode 100644
index 0000000..b20cab6
--- /dev/null
+++ b/gluten.h
@@ -0,0 +1,94 @@
+#ifndef GLUTEN_H
+#define GLUTEN_H
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#define MAX_FD_INJECTED 10
+
+enum ns_spec_type {
+ NS_NONE,
+ NS_SPEC_TARGET,
+ NS_SPEC_PID,
+ NS_SPEC_PATH,
+};
+
+struct ns_spec {
+ enum ns_spec_type type;
+ union {
+ pid_t pid;
+ char *path;
+ };
+};
+
+/*
+ * enum ns_type - Type of namespaces
+ */
+enum ns_type {
+ NS_CGROUP,
+ NS_IPC,
+ NS_NET,
+ NS_MOUNT,
+ NS_PID,
+ NS_TIME,
+ NS_USER,
+ NS_UTS,
+};
+
+/*
+ * struct act_context - Description of the context where the call needs to be executed
+ * @ns: Descrption of the each namespace where the call needs to be executed
+ */
+struct act_context {
+ struct ns_spec ns[sizeof(enum ns_type)];
+};
+
+enum action_type {
+ A_CALL,
+ A_BLOCK,
+ A_CONT,
+ A_INJECT,
+ A_INJECT_A,
+};
+
+struct act_call {
+ long nr;
+ void *args[6];
+ struct act_context context;
+};
+
+struct act_block {
+ int32_t error;
+};
+
+struct act_continue {
+ bool cont;
+};
+
+struct act_return {
+ int64_t value;
+};
+
+struct act_inject {
+ uint32_t newfd;
+ uint32_t old;
+};
+
+struct act_inject_a {
+ uint32_t newfd;
+ uint32_t old;
+ int64_t value;
+};
+
+struct action {
+ enum action_type type;
+ union {
+ struct act_call call;
+ struct act_block block;
+ struct act_continue cont;
+ struct act_return ret;
+ struct act_inject inj;
+ struct act_inject_a inj_a;
+ };
+};
+#endif /* GLUTEN_H */