[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cb7df64b-7a0a-47c6-9b62-76890edd32bf@oracle.com>
Date: Wed, 22 Jan 2025 14:18:57 -0600
From: Mike Christie <michael.christie@...cle.com>
To: Cindy Lu <lulu@...hat.com>, jasowang@...hat.com, mst@...hat.com,
sgarzare@...hat.com, linux-kernel@...r.kernel.org,
virtualization@...ts.linux-foundation.org, netdev@...r.kernel.org
Subject: Re: [PATCH v5 6/6] vhost_scsi: Add check for inherit_owner status
On 12/30/24 6:43 AM, Cindy Lu wrote:
> The vhost_scsi VHOST_NEW_WORKER requires the inherit_owner
> setting to be true. So we need to implement a check for this.
>
> Signed-off-by: Cindy Lu <lulu@...hat.com>
> ---
> drivers/vhost/scsi.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
> index 718fa4e0b31e..0d63b6b5c852 100644
> --- a/drivers/vhost/scsi.c
> +++ b/drivers/vhost/scsi.c
> @@ -2086,6 +2086,14 @@ vhost_scsi_ioctl(struct file *f,
> return -EFAULT;
> return vhost_scsi_set_features(vs, features);
> case VHOST_NEW_WORKER:
> + /*
> + * vhost_tasks will account for worker threads under the parent's
> + * NPROC value but kthreads do not. To avoid userspace overflowing
> + * the system with worker threads inherit_owner must be true.
> + */
> + if (!vs->dev.inherit_owner)> + return -EFAULT;
Why did you keep this here? I had mentioned it belonged in the common code:
https://lore.kernel.org/virtualization/3864ae3b-d6cd-4227-b4bb-56e014c71667@oracle.com/T/#u
because the limitation applies to all drivers. I didn't see a reply about it
but saw you did fix up the comment. Not sure if I missed it or there was
a technical issue you hit.
> + fallthrough;
> case VHOST_FREE_WORKER:
> case VHOST_ATTACH_VRING_WORKER:
> case VHOST_GET_VRING_WORKER:
Powered by blists - more mailing lists