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: <d7bf992f-0342-450d-8830-f0523ac11e2a@kernel.org>
Date: Thu, 4 Sep 2025 12:39:47 +0900
From: Damien Le Moal <dlemoal@...nel.org>
To: Marek Vasut <marek.vasut@...lbox.org>, linux-pci@...r.kernel.org
Cc: 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>, Niklas Cassel <cassel@...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 9/4/25 12:32 PM, Marek Vasut wrote:
> On 9/4/25 4:40 AM, Damien Le Moal wrote:
> 
> Hello Damien,
> 
>>> @@ -1050,7 +1051,13 @@ static int pci_epf_test_alloc_space(struct pci_epf *epf)
>>>           if (bar == test_reg_bar)
>>>               continue;
>>>   -        base = pci_epf_alloc_space(epf, bar_size[bar], bar,
>>> +        test_bar_size = bar_size[bar];
>>> +
>>> +        bar_fixed_size = epc_features->bar[bar].fixed_size;
>>> +        if (epc_features->bar[bar].type == BAR_FIXED && bar_fixed_size)
>>> +            test_bar_size = min(bar_size[bar], bar_fixed_size);
>>
>> 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];
>>
>> because if the bar type is BAR_FIXED, then the size of the bar can only be its
>> fixed size.
> That is correct, however, please consider the following case:
> 
> - The BAR under test is BAR4 , therefore the size requested by this driver is
> bar_size[4] = 131072 Bytes
> - The BAR4 on a hypothetical hardware is a fixed size BAR , 262144 Bytes large
> 
> With your proposed change, the "test_bar_size" would end up being 262144
> Bytes , instead of 131072 Bytes without your proposed change , which I think is
> not the desired behavior.
> 
> What do you think ?

The bar size for the test is arbitrary. If the bar being tested is not a fixed
bar, anything is OK. But in the case of a fixed bar, you can only use the fixed
bar size so we should force that.


-- 
Damien Le Moal
Western Digital Research

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ