diff options
author | Stefano Brivio <sbrivio@redhat.com> | 2023-06-08 20:05:18 +0200 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2023-06-08 20:05:18 +0200 |
commit | 15b54482241083d52b6e9857a66fecbf915d467d (patch) | |
tree | 2c10f8cfb05a2e534b0a8176f9c7c1cd0b486b14 /cooker/calls | |
parent | c38fccbc867019d6c063be1c1d8137edfe52f8de (diff) | |
download | seitan-15b54482241083d52b6e9857a66fecbf915d467d.tar seitan-15b54482241083d52b6e9857a66fecbf915d467d.tar.gz seitan-15b54482241083d52b6e9857a66fecbf915d467d.tar.bz2 seitan-15b54482241083d52b6e9857a66fecbf915d467d.tar.lz seitan-15b54482241083d52b6e9857a66fecbf915d467d.tar.xz seitan-15b54482241083d52b6e9857a66fecbf915d467d.tar.zst seitan-15b54482241083d52b6e9857a66fecbf915d467d.zip |
cooker: Full support for flags and masks, assorted fixes
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'cooker/calls')
-rw-r--r-- | cooker/calls/ioctl.c | 2 | ||||
-rw-r--r-- | cooker/calls/net.c | 8 | ||||
-rw-r--r-- | cooker/calls/process.c | 20 |
3 files changed, 23 insertions, 7 deletions
diff --git a/cooker/calls/ioctl.c b/cooker/calls/ioctl.c index 1609541..336d3c3 100644 --- a/cooker/calls/ioctl.c +++ b/cooker/calls/ioctl.c @@ -76,7 +76,7 @@ static struct field tun_ifr[] = { /* netdevice(7) */ IFNAMSIZ, { 0 }, }, { - "flags", INT, /* One allowed at a time? */ 0, + "flags", INT, FLAGS, offsetof(struct ifreq, ifr_flags), 0, { .d_num = tun_ifr_flags }, }, diff --git a/cooker/calls/net.c b/cooker/calls/net.c index 7a7fd33..74ea668 100644 --- a/cooker/calls/net.c +++ b/cooker/calls/net.c @@ -85,25 +85,25 @@ static struct num protocols[] = { static struct arg socket_args[] = { { 0, { - "family", INT, 0, 0, 0, + "family", INT, 0, 0, 0, { .d_num = af } } }, { 1, { - "type", INT, MASK, 0, 0, + "type", INT, MASK, 0, 0, { .d_num = socket_types } } }, { 1, { - "flags", INT, FLAGS, 0, 0, + "flags", INT, MASK | FLAGS, 0, 0, { .d_num = socket_flags } } }, { 2, { - "protocol", INT, 0, 0, 0, + "protocol", INT, 0, 0, 0, { .d_num = protocols } } }, diff --git a/cooker/calls/process.c b/cooker/calls/process.c index b7a92f0..647f136 100644 --- a/cooker/calls/process.c +++ b/cooker/calls/process.c @@ -27,6 +27,7 @@ clone3 #include <asm-generic/unistd.h> #include <sys/syscall.h> +#define _GNU_SOURCE #include <unistd.h> #include <sched.h> #include <linux/kcmp.h> @@ -35,11 +36,26 @@ clone3 #include "../cooker.h" #include "../calls.h" +static struct num unshare_flags[] = { + { "CLONE_FILES", CLONE_FILES }, + { "CLONE_FS", CLONE_FS }, + { "CLONE_NEWCGROUP", CLONE_NEWCGROUP }, + { "CLONE_NEWIPC", CLONE_NEWIPC }, + { "CLONE_NEWNET", CLONE_NEWNET }, + { "CLONE_NEWNS", CLONE_NEWNS }, + { "CLONE_NEWPID", CLONE_NEWPID }, + { "CLONE_NEWTIME", CLONE_NEWTIME }, + { "CLONE_NEWUSER", CLONE_NEWUSER }, + { "CLONE_NEWUTS", CLONE_NEWUTS }, + { "CLONE_SYSVSEM", CLONE_SYSVSEM }, + { 0 } +}; + static struct arg unshare_args[] = { { 0, { - "flags", UNDEF /* TODO */, FLAGS, 0, 0, - { 0 /* TODO */ } + "flags", INT, FLAGS, 0, 0, + { .d_num = unshare_flags } } } }; |