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: <20210615172242.4b2be854.alex.williamson@redhat.com>
Date:   Tue, 15 Jun 2021 17:22:42 -0600
From:   Alex Williamson <alex.williamson@...hat.com>
To:     Jason Gunthorpe <jgg@...dia.com>
Cc:     Max Gurtovoy <mgurtovoy@...dia.com>, cohuck@...hat.com,
        kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
        aviadye@...dia.com, oren@...dia.com, shahafs@...dia.com,
        parav@...dia.com, artemp@...dia.com, kwankhede@...dia.com,
        ACurrid@...dia.com, cjia@...dia.com, yishaih@...dia.com,
        kevin.tian@...el.com, hch@...radead.org, targupta@...dia.com,
        shameerali.kolothum.thodi@...wei.com, liulongfang@...wei.com,
        yan.y.zhao@...el.com
Subject: Re: [PATCH 09/11] PCI: add matching checks for driver_override
 binding

On Tue, 15 Jun 2021 20:00:17 -0300
Jason Gunthorpe <jgg@...dia.com> wrote:

> On Tue, Jun 15, 2021 at 03:59:00PM -0600, Alex Williamson wrote:
> > On Tue, 15 Jun 2021 17:42:16 -0300
> > Jason Gunthorpe <jgg@...dia.com> wrote:
> >   
> > > On Tue, Jun 15, 2021 at 10:20:49AM -0600, Alex Williamson wrote:  
> > > > On Tue, 15 Jun 2021 12:04:58 -0300
> > > > Jason Gunthorpe <jgg@...dia.com> wrote:
> > > >     
> > > > > On Tue, Jun 15, 2021 at 09:00:29AM -0600, Alex Williamson wrote:
> > > > >     
> > > > > > "vfio" override in PCI-core plays out for other override types.  Also I
> > > > > > don't think dynamic IDs should be handled uniquely, new_id_store()
> > > > > > should gain support for flags and userspace should be able to add new
> > > > > > dynamic ID with override-only matches to the table.  Thanks,      
> > > > > 
> > > > > Why? Once all the enforcement is stripped out the only purpose of the
> > > > > new flag is to signal a different prepration of modules.alias - which
> > > > > won't happen for the new_id path anyhow    
> > > > 
> > > > Because new_id allows the admin to insert a new pci_device_id which has
> > > > been extended to include a flags field and intentionally handling
> > > > dynamic IDs differently from static IDs seems like generally a bad
> > > > thing.      
> > > 
> > > I'd agree with you if there was a functional difference at runtime,
> > > but since that was all removed, I don't think we should touch new_id.
> > > 
> > > This ends up effectively being only a kbuild related patch that
> > > changes how modules.alias is built.  
> > 
> > But it wasn't all removed.  The proposal had:
> > 
> >  a) Short circuit the dynamic ID match
> >  b) Fail a driver-override-only match without a driver_override
> >  c) Fail a non-driver-override-only match with a driver_override
> > 
> > Max is only proposing removing c).
> > 
> > b) alone is a functional, runtime difference.  
> 
> I would state b) differently:
> 
> b) Ignore the driver-override-only match entries in the ID table.

No, pci_match_device() returns NULL if a match is found that is marked
driver-override-only and a driver_override is not specified.  That's
the same as no match at all.  We don't then go on to search past that
match in the table, we fail to bind the driver.  That's effectively an
anti-match when there's no driver_override on the device.

> As if we look at new_id, I can't think of any reason for userspace to
> add an entry to the ID table and then tell the kernel to ignore
> it. If you want the kernel to ignore it then just don't add it in the
> first place.
> 
> Do you have some other scenario in mind?

Sure, what if I have two different GPUs in my system, one works fine
with the FOSS driver, the other requires a 3rd party driver.  I don't
want to blacklist the FOSS driver, but I don't want it to claim the
other GPU.  I can create an anti-match that effectively removes one GPU
from the FOSS driver unless it's bound with a driver_override.

I understand that's not your intended use case, but I think this allows
that and justifies handling a dynamic ID the same as a static ID.
Adding a field to pci_device_id, which is otherwise able to be fully
specified via new_id, except for this field, feels like a bug.  Thanks,

Alex

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ