summaryrefslogtreecommitdiff
path: root/tests/30-sim-socket_syscalls.c
diff options
context:
space:
mode:
authorPaul Moore <paul@paul-moore.com>2021-08-03 14:12:50 -0400
committerPaul Moore <paul@paul-moore.com>2021-08-12 12:30:43 -0400
commitfcc601279004a7f4c2f6ebf766acb4556b0f5e65 (patch)
tree74c69d88f74c74c5a7fa7bb5e63db387cf7c946f /tests/30-sim-socket_syscalls.c
parent17cbd2c253ce63e5e9e3cec867ff58efbe8b5fdc (diff)
downloadlibseccomp-fcc601279004a7f4c2f6ebf766acb4556b0f5e65.tar.gz
tests: various additions to improve code coverage
Acked-by: Tom Hromatka <tom.hromatka@oracle.com> Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'tests/30-sim-socket_syscalls.c')
-rw-r--r--tests/30-sim-socket_syscalls.c62
1 files changed, 61 insertions, 1 deletions
diff --git a/tests/30-sim-socket_syscalls.c b/tests/30-sim-socket_syscalls.c
index 7a193b2..900f0a3 100644
--- a/tests/30-sim-socket_syscalls.c
+++ b/tests/30-sim-socket_syscalls.c
@@ -61,15 +61,47 @@ int main(int argc, char *argv[])
if (rc != 0)
goto out;
+ rc = seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(bind), 0);
+ if (rc != 0)
+ goto out;
+
rc = seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(connect), 0);
if (rc != 0)
goto out;
+ rc = seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(listen), 0);
+ if (rc != 0)
+ goto out;
+
rc = seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(accept), 0);
if (rc != 0)
goto out;
- rc = seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(accept4), 0);
+ rc = seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(getsockname), 0);
+ if (rc != 0)
+ goto out;
+
+ rc = seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(getpeername), 0);
+ if (rc != 0)
+ goto out;
+
+ rc = seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(socketpair), 0);
+ if (rc != 0)
+ goto out;
+
+ rc = seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(send), 0);
+ if (rc != 0)
+ goto out;
+
+ rc = seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(recv), 0);
+ if (rc != 0)
+ goto out;
+
+ rc = seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(sendto), 0);
+ if (rc != 0)
+ goto out;
+
+ rc = seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(recvfrom), 0);
if (rc != 0)
goto out;
@@ -77,6 +109,34 @@ int main(int argc, char *argv[])
if (rc != 0)
goto out;
+ rc = seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(setsockopt), 0);
+ if (rc != 0)
+ goto out;
+
+ rc = seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(getsockopt), 0);
+ if (rc != 0)
+ goto out;
+
+ rc = seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(sendmsg), 0);
+ if (rc != 0)
+ goto out;
+
+ rc = seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(recvmsg), 0);
+ if (rc != 0)
+ goto out;
+
+ rc = seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(accept4), 0);
+ if (rc != 0)
+ goto out;
+
+ rc = seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(sendmmsg), 0);
+ if (rc != 0)
+ goto out;
+
+ rc = seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(recvmmsg), 0);
+ if (rc != 0)
+ goto out;
+
rc = util_filter_output(&opts, ctx);
if (rc)
goto out;