[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACLfguV1vzs84mKQCQZzT+x5rNo9u+pFwk7i54ng4=OSQdixBA@mail.gmail.com>
Date: Tue, 15 Oct 2024 15:19:58 +0800
From: Cindy Lu <lulu@...hat.com>
To: Stefano Garzarella <sgarzare@...hat.com>
Cc: Mike Christie <michael.christie@...cle.com>, jasowang@...hat.com, mst@...hat.com,
linux-kernel@...r.kernel.org, virtualization@...ts.linux-foundation.org
Subject: Re: [PATCH v2 3/7] vhost: Add kthread support in function vhost_workers_free()
On Tue, 15 Oct 2024 at 14:52, Stefano Garzarella <sgarzare@...hat.com> wrote:
>
> On Tue, Oct 15, 2024 at 02:05:47PM +0800, Cindy Lu wrote:
> >On Tue, 15 Oct 2024 at 05:06, Mike Christie <michael.christie@...cle.com> wrote:
> >>
> >> On 10/3/24 8:58 PM, Cindy Lu wrote:
> >> > +static void vhost_workers_free(struct vhost_dev *dev)
> >> > +{
> >> > + if (enforce_inherit_owner)
> >> > + vhost_workers_free_task(dev);
> >> > + else
> >> > + vhost_workers_free_kthread(dev);
> >> > +}
> >>
> >> With patch 7, userspace could change enforce_inherit_owner after
> >> we created thread and we would call the wrong function above.
> >>
> >enforce_inherit_owner will only change before the owner was set.
>
> As I pointed out in patch 7, enforce_inherit_owner seems to be shared
> among all vhost devices, so what happens if for example a user sets it
> to /dev/vhost-net, while /dev/vhost-vsock is already initialized and
> therefore already has an owner?
>
> Thanks,
> Stefano
>
You are correct, I will think about this and provide a new version
Thanks
cindy
> >the process is like set enforce_inherit_owner---->set owner->
> >thread/task creating
> >in in patch 7's code I have add the check for vhost's owner, if the
> >owner was set, the ioctl
> >to set enforce_inherit_owner will fail
> >Thanks
> >Cindy
> >
> >
>
Powered by blists - more mailing lists