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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250210134848.78a1ab4a.alex.williamson@redhat.com>
Date: Mon, 10 Feb 2025 13:48:48 -0700
From: Alex Williamson <alex.williamson@...hat.com>
To: Oleg Nesterov <oleg@...hat.com>
Cc: bhelgaas@...gle.com, linux-pci@...r.kernel.org,
 linux-kernel@...r.kernel.org, mitchell.augustin@...onical.com,
 ilpo.jarvinen@...ux.intel.com
Subject: Re: [PATCH v2] PCI: Batch BAR sizing operations

On Mon, 10 Feb 2025 21:08:19 +0100
Oleg Nesterov <oleg@...hat.com> wrote:

> On 02/10, Oleg Nesterov wrote:
> >
> > On 02/10, Alex Williamson wrote:  
> > >
> > > --- a/drivers/pci/probe.c
> > > +++ b/drivers/pci/probe.c
> > > @@ -345,7 +345,8 @@ static void pci_read_bases(struct pci_dev *dev, unsigned int howmany, int rom)
> > >  	unsigned int pos, reg;
> > >  	u16 orig_cmd;
> > >
> > > -	BUILD_BUG_ON(howmany > PCI_STD_NUM_BARS);
> > > +	if (__builtin_constant_p(howmany))
> > > +		BUILD_BUG_ON(howmany > PCI_STD_NUM_BARS);  
> >
> > Or just
> >
> > 	BUILD_BUG_ON(__builtin_constant_p(howmany) && howmany > PCI_STD_NUM_BARS);
> >
> > I dunno... Works for me in any case.
> >
> > I don't know if this is "right" solution though,  
> 
> I mean, atm I simply don't know if with the newer compiler
> __builtin_constant_p(howmany) will be true in this case.

That I can confirm.  With gcc 14.2.1, if I change the call in
pci_setup_device() to use 7 rather than 6 for howmany, the build fails.
If you confirm this resolves the build on older gcc, it seems like a
valid fix.  I installed a VM with Fedora 23, which uses gcc 3.5.1, but
I haven't yet been able to successfully build any kernel with it.  I'll
post a patch if you want to provide a Tested-by.  Thanks,

Alex


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ