lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CACGkMEuPe_Q1+F47YXdi2=L5bO4JB9+cRB0mn4eZKF6O4N3=Aw@mail.gmail.com>
Date:   Tue, 29 Nov 2022 10:59:36 +0800
From:   Jason Wang <jasowang@...hat.com>
To:     Harshit Mogalapalli <harshit.m.mogalapalli@...cle.com>
Cc:     sgarzare@...hat.com, error27@...il.com,
        harshit.m.mogalapalli@...il.com,
        "Michael S . Tsirkin" <mst@...hat.com>,
        Xie Yongji <xieyongji@...edance.com>,
        Gautam Dawar <gautam.dawar@...inx.com>,
        Maxime Coquelin <maxime.coquelin@...hat.com>,
        Parav Pandit <parav@...dia.com>, Eli Cohen <elic@...dia.com>,
        virtualization@...ts.linux-foundation.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3] vduse: Validate vq_num in vduse_validate_config()

On Mon, Nov 28, 2022 at 11:57 PM Harshit Mogalapalli
<harshit.m.mogalapalli@...cle.com> wrote:
>
> Add a limit to 'config->vq_num' which is user controlled data which
> comes from an vduse_ioctl to prevent large memory allocations.
>
> Micheal says  - This limit is somewhat arbitrary.
> However, currently virtio pci and ccw are limited to a 16 bit vq number.
> While MMIO isn't it is also isn't used with lots of VQs due to
> current lack of support for per-vq interrupts.
> Thus, the 0xffff limit on number of VQs corresponding
> to a 16-bit VQ number seems sufficient for now.
>
> This is found using static analysis with smatch.
>
> Suggested-by: Michael S. Tsirkin <mst@...hat.com>
> Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@...cle.com>

Acked-by: Jason Wang <jasowang@...hat.com>

Thanks

> ---
> v1->v2: Change title of the commit and description, add a limit to
>         vq_num.
>
> v2->v3: Improve commit message to include reason for setting limit to
>         0xffff
>
> Only compile and boot tested.
> ---
>  drivers/vdpa/vdpa_user/vduse_dev.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vduse_dev.c
> index 35dceee3ed56..31017ebc4d7c 100644
> --- a/drivers/vdpa/vdpa_user/vduse_dev.c
> +++ b/drivers/vdpa/vdpa_user/vduse_dev.c
> @@ -1440,6 +1440,9 @@ static bool vduse_validate_config(struct vduse_dev_config *config)
>         if (config->config_size > PAGE_SIZE)
>                 return false;
>
> +       if (config->vq_num > 0xffff)
> +               return false;
> +
>         if (!device_is_allowed(config->device_id))
>                 return false;
>
> --
> 2.38.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ