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] [thread-next>] [day] [month] [year] [list]
Message-ID: <308209c2-508e-19d1-a5aa-9c8a8af68b23@linux.intel.com>
Date: Thu, 3 Apr 2025 12:54:47 +0300 (EEST)
From: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
To: Michał Winiarski <michal.winiarski@...el.com>
cc: linux-pci@...r.kernel.org, intel-xe@...ts.freedesktop.org, 
    dri-devel@...ts.freedesktop.org, LKML <linux-kernel@...r.kernel.org>, 
    Bjorn Helgaas <bhelgaas@...gle.com>, 
    Christian König <christian.koenig@....com>, 
    Krzysztof Wilczyński <kw@...ux.com>, 
    Rodrigo Vivi <rodrigo.vivi@...el.com>, 
    Michal Wajdeczko <michal.wajdeczko@...el.com>, 
    Lucas De Marchi <lucas.demarchi@...el.com>, 
    Thomas Hellström <thomas.hellstrom@...ux.intel.com>, 
    Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>, 
    Maxime Ripard <mripard@...nel.org>, 
    Thomas Zimmermann <tzimmermann@...e.de>, David Airlie <airlied@...il.com>, 
    Simona Vetter <simona@...ll.ch>, Matt Roper <matthew.d.roper@...el.com>
Subject: Re: [PATCH v7 4/6] PCI/IOV: Check that VF BAR fits within the
 reservation

On Wed, 2 Apr 2025, Michał Winiarski wrote:

> When the resource representing VF MMIO BAR reservation is created, its
> size is always large enough to accommodate the BAR of all SR-IOV Virtual
> Functions that can potentially be created (total VFs). If for whatever
> reason it's not possible to accommodate all VFs - the resource is not
> assigned and no VFs can be created.
> 
> An upcoming change will allow VF BAR size to be modified by drivers at
> a later point in time, which means that the check for resource
> assignment is no longer sufficient.
> 
> Add an additional check that verifies that VF BAR for all enabled VFs
> fits within the underlying reservation resource.
> 
> Signed-off-by: Michał Winiarski <michal.winiarski@...el.com>
> ---
>  drivers/pci/iov.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
> index fee99e15a943f..2fafbd6a998f0 100644
> --- a/drivers/pci/iov.c
> +++ b/drivers/pci/iov.c
> @@ -668,9 +668,12 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn)
>  	nres = 0;
>  	for (i = 0; i < PCI_SRIOV_NUM_BARS; i++) {
>  		int idx = pci_resource_num_from_vf_bar(i);
> +		resource_size_t vf_bar_sz = pci_iov_resource_size(dev, idx);
>  
>  		bars |= (1 << idx);
>  		res = &dev->resource[idx];
> +		if (vf_bar_sz * nr_virtfn > resource_size(res))
> +			continue;
>  		if (res->parent)
>  			nres++;
>  	}
> 

Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>

-- 
 i.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ