From 878ce66b3159a06d0511df74b0f4b3c1f5273078 Mon Sep 17 00:00:00 2001 From: Andrei Lascu Date: Mon, 26 Feb 2024 09:17:58 +0000 Subject: [PATCH] Add syscall tests and `so` harness Add two tests performing syscalls, to show the running syscalls themselves from within a restricted DDC environment works. I think this is useful to have for future potential work (e.g., could we provide a compartment-safe printing function, instead of crashing with `printf`, if making `printf` be compatible proves hard). Adds a harness to be able to run `so` files natively, without having to go through the compartment library. Useful for debugging / differential testing. --- tests/simple_syscall_write.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/simple_syscall_write.c b/tests/simple_syscall_write.c index 82c936f..119cd45 100644 --- a/tests/simple_syscall_write.c +++ b/tests/simple_syscall_write.c @@ -1,11 +1,11 @@ -#include -#include #include +#include +#include int main(void) { - char* buf = "Hello World!\n"; + char *buf = "Hello World!\n"; long int sc_write = syscall(4, STDOUT_FILENO, buf, strlen(buf)); if (sc_write == -1) { @@ -13,4 +13,3 @@ main(void) } return 0; } -