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: <aLqg90KqEJ8wSEPi@ryzen>
Date: Fri, 5 Sep 2025 10:36:07 +0200
From: Niklas Cassel <cassel@...nel.org>
To: Jerome Brunet <jbrunet@...libre.com>
Cc: Damien Le Moal <dlemoal@...nel.org>,
	Marek Vasut <marek.vasut+renesas@...lbox.org>,
	linux-pci@...r.kernel.org,
	Krzysztof WilczyƄski <kwilczynski@...nel.org>,
	Bjorn Helgaas <bhelgaas@...gle.com>, Frank Li <Frank.Li@....com>,
	Kishon Vijay Abraham I <kishon@...nel.org>,
	Manivannan Sadhasivam <mani@...nel.org>,
	Wang Jiang <jiangwang@...inos.cn>, linux-kernel@...r.kernel.org,
	linux-renesas-soc@...r.kernel.org
Subject: Re: [PATCH] PCI: endpoint: pci-epf-test: Limit PCIe BAR size for
 fixed BARs

On Fri, Sep 05, 2025 at 09:32:03AM +0200, Jerome Brunet wrote:
> On Thu 04 Sep 2025 at 14:28, Niklas Cassel <cassel@...nel.org> wrote:
> >> 
> >> I think this can be simplified to:
> >> 
> >> 		if (epc_features->bar[bar].type == BAR_FIXED)
> >> 			test_bar_size = epc_features->bar[bar].fixed_size;
> >> 		else
> >> 			test_bar_size = bar_size[bar];
> >
> > +1
> 
> It's what pci_epf_alloc_space() does too. so it makes sense but it also
> means the side must stay aligned.

Not really, pci_epf_alloc_space() will give you 'fixed_size'
if you request size < fixed_size.

If you request more, it will give you an error.

> 
> If a rework is needed, maybe it would be better to get size from
> pci_epf_alloc_space() instead of recomputing it ?

The pci-epf-test driver is just a test driver and we can use whatever
BAR size we want for each BAR.

However, I don't think that pci_epf_alloc_space() can always give us
a BAR size. Sure, for fixed_size BARs, there is only a single size
that is possible. But for Programmable and Resizable BARs, there are
many possible sizes, so which size should pci_epf_alloc_space() then
return?

And not all EPF drivers might be happy with an aribitrary BAR size
(which is the case for pci-epf-test), some EPF drivers might have
strict minimum sizes for a BAR.

So, I still think this proposal is the best thing we can do.

At least it appears that we only need to patch pci-epf-test.



Kind regards,
Niklas

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ