aboutgitcodelistschat:MatrixIRC
path: root/actions.c
diff options
context:
space:
mode:
authorAlice Frosi <afrosi@redhat.com>2023-01-26 17:12:23 +0100
committerAlice Frosi <afrosi@redhat.com>2023-02-15 13:15:56 +0100
commit7cb6760e3ebdc7a95f167bbeee793e8050215d2c (patch)
treed192cbda53e6b58fa0a5d402f9a29bd57f50896d /actions.c
parentdd9d5a78f0e48f92cd290cf23185c381e2153e40 (diff)
downloadseitan-7cb6760e3ebdc7a95f167bbeee793e8050215d2c.tar
seitan-7cb6760e3ebdc7a95f167bbeee793e8050215d2c.tar.gz
seitan-7cb6760e3ebdc7a95f167bbeee793e8050215d2c.tar.bz2
seitan-7cb6760e3ebdc7a95f167bbeee793e8050215d2c.tar.lz
seitan-7cb6760e3ebdc7a95f167bbeee793e8050215d2c.tar.xz
seitan-7cb6760e3ebdc7a95f167bbeee793e8050215d2c.tar.zst
seitan-7cb6760e3ebdc7a95f167bbeee793e8050215d2c.zip
seitan: add injection actions
The inject actions install a new fd into the target. If the action is an atomic injection then the target is unblock after this action and the return value of the syscall will be the the file descriptor number that was allocated in the target Signed-off-by: Alice Frosi <afrosi@redhat.com>
Diffstat (limited to 'actions.c')
-rw-r--r--actions.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/actions.c b/actions.c
index 8f08252..4cef920 100644
--- a/actions.c
+++ b/actions.c
@@ -167,6 +167,7 @@ int do_call(struct arg_clone *c)
int do_actions(struct action actions[], unsigned int n_actions, int pid,
int notifyfd, uint64_t id)
{
+ struct seccomp_notif_addfd resp_fd;
struct seccomp_notif_resp resp;
struct arg_clone c;
unsigned int i;
@@ -210,6 +211,23 @@ int do_actions(struct action actions[], unsigned int n_actions, int pid,
if (send_target(&resp, notifyfd) == -1)
return -1;
break;
+ case A_INJECT_A:
+ resp_fd.id = id;
+ resp_fd.flags |= SECCOMP_ADDFD_FLAG_SEND;
+ resp_fd.newfd = actions[i].inj.newfd;
+ resp_fd.srcfd = actions[i].inj.old;
+ resp_fd.flags |= SECCOMP_ADDFD_FLAG_SETFD;
+ if (send_inject_target(&resp_fd, notifyfd) == -1)
+ return -1;
+ break;
+ case A_INJECT:
+ resp_fd.id = id;
+ resp_fd.newfd = actions[i].inj.newfd;
+ resp_fd.srcfd = actions[i].inj.old;
+ resp_fd.flags |= SECCOMP_ADDFD_FLAG_SETFD;
+ if (send_inject_target(&resp_fd, notifyfd) == -1)
+ return -1;
+ break;
default:
fprintf(stderr, "unknow action %d \n", actions[i].type);
}