From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com>
Cc: virtio-fs@redhat.com, qemu-devel@nongnu.org
Subject: Re: [Virtio-fs] [PATCH] virtiofsd: Add pread64() to seccomp list for posix_fallocate()
Date: Fri, 4 Oct 2019 19:54:00 +0100 [thread overview]
Message-ID: <20191004185400.GH2772@work-vm> (raw)
In-Reply-To: <20191004110759.32665-1-misono.tomohiro@jp.fujitsu.com>
* Misono Tomohiro (misono.tomohiro@jp.fujitsu.com) wrote:
> I test virtiofs with NFS 4.0 as backend and notice that fallocate
> causes system hang (kernel: 5.4-rc1, qemu: virtio-fs-dev branch):
> $ mount -t virtiofs myfs /mnt
> $ dd if=/dev/urandom bs=1000 seek=1 count=1 of=/mnt/file
> $ fallocate -l 2000 /mnt/file # system hang
>
> This is because:
> 1. virtiofs supports fallocate syscall while NFS 4.0 does not.
> 2. virtiofsd uses posix_fallocate() and it fallbacks to pread64()/
> pwrite64() sequence to reserve blocks if fallocate syscall is
> not available.
> 3. pread64() syscall is prohibited by seccomp and virtiofsd thread
> is killed by SIGSYS.
>
> So, just add pread64() to seccomp white list to fix this problem.
>
> Signed-off-by: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com>
Thanks, I've squashed this into our seccomp commit.
(It'll be a little while before I push it out, I need to finish a tidyup
I'm doing).
Dave
> ---
> contrib/virtiofsd/seccomp.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/contrib/virtiofsd/seccomp.c b/contrib/virtiofsd/seccomp.c
> index 93b679271d..88b61bca42 100644
> --- a/contrib/virtiofsd/seccomp.c
> +++ b/contrib/virtiofsd/seccomp.c
> @@ -61,6 +61,7 @@ static const int syscall_whitelist[] = {
> SCMP_SYS(ppoll),
> SCMP_SYS(prctl), /* TODO restrict to just PR_SET_NAME? */
> SCMP_SYS(preadv),
> + SCMP_SYS(pread64),
> SCMP_SYS(pwritev),
> SCMP_SYS(pwrite64),
> SCMP_SYS(read),
> --
> 2.21.0
>
> _______________________________________________
> Virtio-fs mailing list
> Virtio-fs@redhat.com
> https://www.redhat.com/mailman/listinfo/virtio-fs
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
prev parent reply other threads:[~2019-10-04 19:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-04 11:07 [Virtio-fs] [PATCH] virtiofsd: Add pread64() to seccomp list for posix_fallocate() Misono Tomohiro
2019-10-04 18:54 ` Dr. David Alan Gilbert [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191004185400.GH2772@work-vm \
--to=dgilbert@redhat.com \
--cc=misono.tomohiro@jp.fujitsu.com \
--cc=qemu-devel@nongnu.org \
--cc=virtio-fs@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).