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: <BY5PR12MB3763EC8E078A5C43FEBEF050B024A@BY5PR12MB3763.namprd12.prod.outlook.com>
Date:   Wed, 28 Jun 2023 19:00:53 +0000
From:   Ankit Agrawal <ankita@...dia.com>
To:     Jason Gunthorpe <jgg@...dia.com>,
        Alex Williamson <alex.williamson@...hat.com>
CC:     Aniket Agashe <aniketa@...dia.com>, Neo Jia <cjia@...dia.com>,
        Kirti Wankhede <kwankhede@...dia.com>,
        "Tarun Gupta (SW-GPU)" <targupta@...dia.com>,
        Vikram Sethi <vsethi@...dia.com>,
        Andy Currid <ACurrid@...dia.com>,
        Alistair Popple <apopple@...dia.com>,
        John Hubbard <jhubbard@...dia.com>,
        Dan Williams <danw@...dia.com>,
        "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH v4 1/1] vfio/nvgpu: Add vfio pci variant module for grace
 hopper

>>> +static ssize_t nvgpu_vfio_pci_read(struct vfio_device *core_vdev,
>>> +           char __user *buf, size_t count, loff_t *ppos) {
>>> +   unsigned int index = VFIO_PCI_OFFSET_TO_INDEX(*ppos);
>>> +
>>> +   /*
>>> +    * Only the device memory present on the hardware is mapped, which may
>>> +    * not be power-of-2 aligned. A read to the BAR2 region implies an
>>> +    * access outside the available device memory on the hardware.
>>> +    */
>>> +   if (index == VFIO_PCI_BAR2_REGION_INDEX)
>>> +           return -EINVAL;
>>>
>> What does the qemu do in this case? Crash the VM?
>
> Yes, I don't think return -errno matches what we discussed for returning -1 on read and dropping writes outside of the device memory.

I tried to replicate what is done by vfio-pci core module in vfio_pci_bar_rw()
where -EINVAL is returned in case of e.g. the access offset is outside the
BAR range.

Such an error comes to Qemu in vfio_region_read/vfio_region_write() which 
handles the error by returning data as -1 on read and dropping on write.

But it seems that we don't need such approach here. I will make the change
so that vfio-pci variant driver's read/write explicitly reads -1 and drops writes
instead of returning -EINVAL.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ