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: <20230208221010.GA2489371@bhelgaas>
Date:   Wed, 8 Feb 2023 16:10:10 -0600
From:   Bjorn Helgaas <helgaas@...nel.org>
To:     Seunggyun Lee <sglee97@...kook.ac.kr>
Cc:     bhelgaas@...gle.com, linux-pci@...r.kernel.org,
        linux-kernel@...r.kernel.org,
        Alex Williamson <alex.williamson@...hat.com>,
        Cornelia Huck <cohuck@...hat.com>, kvm@...r.kernel.org,
        Leon Romanovsky <leon@...nel.org>
Subject: Re: [PATCH] pci/mmap: add pci device EBUSY check

[+cc VFIO folks, Leon]

On Tue, Feb 07, 2023 at 08:39:49PM +0900, Seunggyun Lee wrote:
> When using a pci device through the vfio-pci driver, other software was
> also able to access the pci device memory through sysfs.
> 
> To prevent this, when mmap is performed through sysfs, a process of
> checking whether the device is in use is added.
> 
> Signed-off-by: Seunggyun Lee <sglee97@...kook.ac.kr>
> ---
>  drivers/pci/mmap.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/pci/mmap.c b/drivers/pci/mmap.c
> index 4504039056d1..4c9df2e23e03 100644
> --- a/drivers/pci/mmap.c
> +++ b/drivers/pci/mmap.c
> @@ -25,6 +25,8 @@ int pci_mmap_resource_range(struct pci_dev *pdev, int bar,
>  {
>  	unsigned long size;
>  	int ret;
> +	if (pdev->driver)
> +		return -1;
>  
>  	size = ((pci_resource_len(pdev, bar) - 1) >> PAGE_SHIFT) + 1;
>  	if (vma->vm_pgoff + vma_pages(vma) > size)
> -- 
> 2.25.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ