Skip to contentSkip to conversation

virtiofsd: Add clock_gettime() to seccomp white list

PATCH In review Masayoshi Mizuma 2 participants 2 messages Oct 18, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 virtiofsd: Add clock_gettime() to seccomp white list

From: Masayoshi Mizuma <[email protected]>

virtiofsd receives SIGSYS signal while qemu is shutting down.

]# ./virtiofsd -d -o vhost_user_socket=/tmp/vhostqemu0 \
-o source=/tmp/share0 -o cache=auto
...
virtio_send_msg: elem 0: with 1 in desc of length 16
virtio_loop: Got VU event
fv_queue_set_started: qidx=0 started=0
fv_queue_thread: kill event on queue 0 - quitting
fv_remove_watch: TODO! fd=9
virtio_loop: Waiting for VU event
Bad system call (core dumped)
]#

That is because virtiofsd calls clock_gettime() via glib function and clock_gettime() isn't in seccomp white list, so virtiofsd receives SIGSYS.
The glib function is called to manage the pool thread. The calltrace is like as:

  #0  clock_gettime ()
  #1  g_get_monotonic_time ()
  #2  g_async_queue_timeout_pop ()
  #3  g_thread_pool_wait_for_new_pool ()
  #4  g_thread_pool_thread_proxy ()
  #5  g_thread_proxy ()
  #6  start_thread ()
  #7  clone ()

Add clock_gettime() to seccomp white list.

---
 contrib/virtiofsd/seccomp.c | 1 +
 1 file changed, 1 insertion(+)
contrib/virtiofsd/seccomp.c +1 -0
index f815ea5bf9..b78056b13f 100644
@@ -19,6 +19,7 @@ static const int syscall_whitelist[] = {
     SCMP_SYS(brk),
     SCMP_SYS(capget), /* For CAP_FSETID */
     SCMP_SYS(capset),
+    SCMP_SYS(clock_gettime),
     SCMP_SYS(clone),
     SCMP_SYS(close),
     SCMP_SYS(copy_file_range),
Signature · 1 line
2.18.1
#1 lore raw
Quoted 31 lines · * Masayoshi Mizuma ([email protected]) wrote:

From: Masayoshi Mizuma <[email protected]>

virtiofsd receives SIGSYS signal while qemu is shutting down.

]# ./virtiofsd -d -o vhost_user_socket=/tmp/vhostqemu0 \
-o source=/tmp/share0 -o cache=auto
...
virtio_send_msg: elem 0: with 1 in desc of length 16
virtio_loop: Got VU event
fv_queue_set_started: qidx=0 started=0
fv_queue_thread: kill event on queue 0 - quitting
fv_remove_watch: TODO! fd=9
virtio_loop: Waiting for VU event
Bad system call (core dumped)
]#

That is because virtiofsd calls clock_gettime() via glib function and clock_gettime() isn't in seccomp white list, so virtiofsd receives SIGSYS.
The glib function is called to manage the pool thread. The calltrace is like as:

  #0  clock_gettime ()
  #1  g_get_monotonic_time ()
  #2  g_async_queue_timeout_pop ()
  #3  g_thread_pool_wait_for_new_pool ()
  #4  g_thread_pool_thread_proxy ()
  #5  g_thread_proxy ()
  #6  start_thread ()
  #7  clone ()
Quoted 3 lines

Add clock_gettime() to seccomp white list.

Thanks; merged into the existing whitelist.

(And pushed to -dev - although the -dev world; which is in the middle of a tidyup)

Dave

Quoted 23 lines
---
 contrib/virtiofsd/seccomp.c | 1 +
 1 file changed, 1 insertion(+)
contrib/virtiofsd/seccomp.c +1 -0
index f815ea5bf9..b78056b13f 100644
@@ -19,6 +19,7 @@ static const int syscall_whitelist[] = {
     SCMP_SYS(brk),
     SCMP_SYS(capget), /* For CAP_FSETID */
     SCMP_SYS(capset),
+    SCMP_SYS(clock_gettime),
     SCMP_SYS(clone),
     SCMP_SYS(close),
     SCMP_SYS(copy_file_range),
Signature · 6 lines
2.18.1

_______________________________________________
Virtio-fs mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/virtio-fs

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK