From: Masayoshi Mizuma <[email protected]>

When I run fsstress on the virtio filesystem, virtiofsd sometimes
exits abnormally because it receives SIGSYS.

>From strace:
  195852 15:07:47.799331 read(8, "\1\0\0\0\0\0\0\0", 8) = 8 <0.000011>
  195852 15:07:47.799379 gettimeofday( <unfinished ...>
  195852 15:07:53.354340 <... gettimeofday resumed> <unfinished ...>) = ?
  195852 15:07:53.400243 +++ killed by SIGSYS (core dumped) +++

That is because virtiofsd calls gettimeofday() system call but
the system call isn't in the seccomp whitelist.

virtiofsd doesn't call gettimeofday() directly. glib library
function may call g_get_current_time() and g_get_current_time()
calls the system call.

Add gettimeofday() to the seccomp whitelist.

Signed-off-by: Masayoshi Mizuma <[email protected]>
---
 contrib/virtiofsd/seccomp.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/contrib/virtiofsd/seccomp.c b/contrib/virtiofsd/seccomp.c
index ffb9f4c..cea4cc5 100644
--- a/contrib/virtiofsd/seccomp.c
+++ b/contrib/virtiofsd/seccomp.c
@@ -44,6 +44,7 @@ static const int syscall_whitelist[] = {
        SCMP_SYS(geteuid),
        SCMP_SYS(getpid),
        SCMP_SYS(gettid),
+       SCMP_SYS(gettimeofday),
        SCMP_SYS(linkat),
        SCMP_SYS(lseek),
        SCMP_SYS(madvise),
-- 
2.18.1

Reply via email to