From: "Michael S. Tsirkin" <mst@redhat.com>
To: Jason Wang <jasowang@redhat.com>
Cc: Srivatsa Vaddagiri <quic_svaddagi@quicinc.com>,
xieyongji@bytedance.com, stefanha@redhat.com,
virtio-dev@lists.linux.dev, virtualization@lists.linux.dev,
quic_mnalajal@quicinc.com, quic_eberman@quicinc.com,
quic_pheragu@quicinc.com, quic_pderrin@quicinc.com,
quic_cvanscha@quicinc.com, quic_pkondeti@quicinc.com,
quic_tsoni@quicinc.com, eperezma <eperezma@redhat.com>,
Stefano Garzarella <sgarzare@redhat.com>,
Cindy Lu <lulu@redhat.com>
Subject: Re: [RFC] vduse config write support
Date: Fri, 26 Jul 2024 01:15:21 -0400 [thread overview]
Message-ID: <20240726011340-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <CACGkMEs_FHg6xZAw2V7AKvj5XFCmaA0Xm+ei7z4OFJPNgO5Thw@mail.gmail.com>
On Fri, Jul 26, 2024 at 10:47:59AM +0800, Jason Wang wrote:
> On Wed, Jul 24, 2024 at 11:45 AM Srivatsa Vaddagiri
> <quic_svaddagi@quicinc.com> wrote:
> >
> > Currently vduse does not seem to support configuration space writes
> > (vduse_vdpa_set_config does nothing). Is there any plan to lift that
> > limitation? I am aware of the discussions that took place here:
> >
> > https://patchwork.kernel.org/project/netdevbpf/patch/20210615141331.407-11-xieyongji@bytedance.com/
> >
> > Perhaps writes can be supported *selectively* without violating safety concerns
> > expressed in the above email discussion?
>
> Adding more relevant people here.
>
> It can probably be done case by case. The main reason for avoiding
> config writing is
>
> 1) to prevent buggy/malicious userspace from hanging kernel driver for ever
> 2) to prevent buggy/malicious userspace device to break the semantic
>
> Basically, it is the traditional trust model where the kernel doesn't
> trust userspace.
>
> E.g current virtio-blk has the following codes:
>
> tatic ssize_t
> cache_type_store(struct device *dev, struct device_attribute *attr,
> const char *buf, size_t count)
> {
> struct gendisk *disk = dev_to_disk(dev);
> struct virtio_blk *vblk = disk->private_data;
> struct virtio_device *vdev = vblk->vdev;
> int i;
>
> BUG_ON(!virtio_has_feature(vblk->vdev, VIRTIO_BLK_F_CONFIG_WCE));
> i = sysfs_match_string(virtblk_cache_types, buf);
> if (i < 0)
> return i;
>
> virtio_cwrite8(vdev, offsetof(struct virtio_blk_config, wce), i);
> virtblk_update_cache_mode(vdev);
> return count;
> }
To be fair, I think if you allow a block device in userspace you have already
allowed said userspace to crash the kernel unless you have
also restricted the filesystems mounted on this device to FUSE.
--
MST
next prev parent reply other threads:[~2024-07-26 5:15 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-24 3:38 [RFC] vduse config write support Srivatsa Vaddagiri
2024-07-26 2:37 ` Yongji Xie
2024-07-26 7:06 ` Srivatsa Vaddagiri
2024-07-26 2:47 ` Jason Wang
2024-07-26 5:15 ` Michael S. Tsirkin [this message]
2024-07-29 2:06 ` Jason Wang
2024-07-26 7:03 ` Srivatsa Vaddagiri
2024-07-26 7:29 ` Michael S. Tsirkin
2024-07-29 2:16 ` Jason Wang
2024-07-29 6:02 ` Srivatsa Vaddagiri
2024-07-30 3:06 ` Jason Wang
2024-07-30 3:10 ` Jason Wang
2024-07-26 12:42 ` Srivatsa Vaddagiri
2024-07-30 2:53 ` Jason Wang
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=20240726011340-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=eperezma@redhat.com \
--cc=jasowang@redhat.com \
--cc=lulu@redhat.com \
--cc=quic_cvanscha@quicinc.com \
--cc=quic_eberman@quicinc.com \
--cc=quic_mnalajal@quicinc.com \
--cc=quic_pderrin@quicinc.com \
--cc=quic_pheragu@quicinc.com \
--cc=quic_pkondeti@quicinc.com \
--cc=quic_svaddagi@quicinc.com \
--cc=quic_tsoni@quicinc.com \
--cc=sgarzare@redhat.com \
--cc=stefanha@redhat.com \
--cc=virtio-dev@lists.linux.dev \
--cc=virtualization@lists.linux.dev \
--cc=xieyongji@bytedance.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).