[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Virtio-fs] [PATCH 0/2] virtiofsd: Two fix for xattr operation
From: |
Stefan Hajnoczi |
Subject: |
Re: [Virtio-fs] [PATCH 0/2] virtiofsd: Two fix for xattr operation |
Date: |
Mon, 21 Oct 2019 10:40:47 +0100 |
User-agent: |
Mutt/1.12.1 (2019-06-15) |
On Fri, Oct 18, 2019 at 08:51:20AM +0000, address@hidden wrote:
> > Doing unshare(CLONE_FS) after thread startup seems safe, though must be
> > careful to change the working directory to the root of
> > the mount
> > *before* starting any threads.
>
> I think working directry is changed in setup_sandbox() ->
> setup_mount_namespace() -> setup_pivot_root().
> So, can we just add unshare(CLONE_FS) in fv_queue_worker()?
fv_queue_worker() is the thread pool worker function that is called for
each request. Calling unshare(CLONE_FS) for each request is not
necessary and will reduce performance.
A thread-local variable can be used to avoid repeated calls to
unshare(CLONE_FS) from the same worker thread:
static __thread bool clone_fs_called;
static void fv_queue_worker(gpointer data, gpointer user_data)
{
...
if (!clone_fs_called) {
int ret;
ret = unshare(CLONE_FS);
assert(ret == 0); /* errors not expected according to man page */
clone_fs_called = true;
}
Another issue is the seccomp policy. Since worker threads are spawned
at runtime it is necessary to add the unshare(2) syscall to the seccomp
whitelist in contrib/virtiofsd/seccomp.c.
Stefan
signature.asc
Description: PGP signature
- Re: [Virtio-fs] [PATCH 0/2] virtiofsd: Two fix for xattr operation, (continued)
- Re: [Virtio-fs] [PATCH 0/2] virtiofsd: Two fix for xattr operation, Stefan Hajnoczi, 2019/10/17
- Re: [Virtio-fs] [PATCH 0/2] virtiofsd: Two fix for xattr operation, Miklos Szeredi, 2019/10/17
- Re: [Virtio-fs] [PATCH 0/2] virtiofsd: Two fix for xattr operation, Stefan Hajnoczi, 2019/10/17
- Re: [Virtio-fs] [PATCH 0/2] virtiofsd: Two fix for xattr operation, Miklos Szeredi, 2019/10/17
- Re: [Virtio-fs] [PATCH 0/2] virtiofsd: Two fix for xattr operation, Miklos Szeredi, 2019/10/18
- Re: [Virtio-fs] [PATCH 0/2] virtiofsd: Two fix for xattr operation, Stefan Hajnoczi, 2019/10/18
- RE: [Virtio-fs] [PATCH 0/2] virtiofsd: Two fix for xattr operation, address@hidden, 2019/10/18
- Re: [Virtio-fs] [PATCH 0/2] virtiofsd: Two fix for xattr operation,
Stefan Hajnoczi <=
- RE: [Virtio-fs] [PATCH 0/2] virtiofsd: Two fix for xattr operation, address@hidden, 2019/10/23
- Re: [Virtio-fs] [PATCH 0/2] virtiofsd: Two fix for xattr operation, Stefan Hajnoczi, 2019/10/25