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]
Date:   Mon, 7 Sep 2020 15:54:59 +0300
From:   "Paraschiv, Andra-Irina" <andraprs@...zon.com>
To:     Greg KH <gregkh@...uxfoundation.org>
CC:     linux-kernel <linux-kernel@...r.kernel.org>,
        Anthony Liguori <aliguori@...zon.com>,
        Benjamin Herrenschmidt <benh@...nel.crashing.org>,
        Colm MacCarthaigh <colmmacc@...zon.com>,
        David Duncan <davdunc@...zon.com>,
        Bjoern Doebel <doebel@...zon.de>,
        David Woodhouse <dwmw@...zon.co.uk>,
        "Frank van der Linden" <fllinden@...zon.com>,
        Alexander Graf <graf@...zon.de>,
        "Karen Noel" <knoel@...hat.com>,
        Martin Pohlack <mpohlack@...zon.de>,
        Matt Wilson <msw@...zon.com>,
        Paolo Bonzini <pbonzini@...hat.com>,
        Balbir Singh <sblbir@...zon.com>,
        Stefano Garzarella <sgarzare@...hat.com>,
        "Stefan Hajnoczi" <stefanha@...hat.com>,
        Stewart Smith <trawets@...zon.com>,
        "Uwe Dannowski" <uwed@...zon.de>,
        Vitaly Kuznetsov <vkuznets@...hat.com>,
        kvm <kvm@...r.kernel.org>,
        ne-devel-upstream <ne-devel-upstream@...zon.com>
Subject: Re: [PATCH v8 08/18] nitro_enclaves: Add logic for creating an
 enclave VM



On 07/09/2020 11:57, Greg KH wrote:
>
> On Fri, Sep 04, 2020 at 08:37:08PM +0300, Andra Paraschiv wrote:
>> +static long ne_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
>> +{
>> +     switch (cmd) {
>> +     case NE_CREATE_VM: {
>> +             int enclave_fd = -1;
>> +             struct file *enclave_file = NULL;
>> +             struct ne_pci_dev *ne_pci_dev = NULL;
>> +             struct pci_dev *pdev = to_pci_dev(ne_misc_dev.parent);
> That call is really "risky".  You "know" that the misc device's parent
> is a specific PCI device, that just happens to be your pci device,
> right?

Correct, that's how it's assigned the misc device's parent, to point to 
a particular PCI device that's the NE PCI device.

>
> But why not just have your misc device hold the pointer to the structure
> you really want, so you don't have to mess with the device tree in any
> way, and you always "know" you have the correct pointer?  It should save
> you this two-step lookup all the time, right?
>

That would help, yes, to keep the pointer directly to the ne_pci_dev 
data structure. Just that the misc device's parent data structure is a 
struct device pointer. I can create a new internal data structure to 
keep the miscdevice data structure and a pointer to the ne_pci_dev.

Thanks,
Andra



Amazon Development Center (Romania) S.R.L. registered office: 27A Sf. Lazar Street, UBC5, floor 2, Iasi, Iasi County, 700045, Romania. Registered in Romania. Registration number J22/2621/2005.

Powered by blists - more mailing lists