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] [day] [month] [year] [list]
Message-ID: <6661221c-2dc8-0501-3f59-8c59f3ad2d49@engleder-embedded.com>
Date:   Tue, 18 Apr 2023 20:41:59 +0200
From:   Gerhard Engleder <gerhard@...leder-embedded.com>
To:     Paolo Abeni <pabeni@...hat.com>, netdev@...r.kernel.org,
        bpf@...r.kernel.org
Cc:     davem@...emloft.net, kuba@...nel.org, edumazet@...gle.com,
        bjorn@...nel.org, magnus.karlsson@...el.com,
        maciej.fijalkowski@...el.com, jonathan.lemon@...il.com
Subject: Re: [PATCH net-next v2 5/6] tsnep: Add XDP socket zero-copy RX
 support

On 18.04.23 10:22, Paolo Abeni wrote:
> On Sat, 2023-04-15 at 16:42 +0200, Gerhard Engleder wrote:
>> @@ -892,6 +900,37 @@ static int tsnep_rx_desc_available(struct tsnep_rx *rx)
>>   		return rx->read - rx->write - 1;
>>   }
>>   
>> +static void tsnep_rx_free_page_buffer(struct tsnep_rx *rx)
>> +{
>> +	struct page **page;
>> +
>> +	page = rx->page_buffer;
>> +	while (*page) {
>> +		page_pool_put_full_page(rx->page_pool, *page, false);
>> +		*page = NULL;
>> +		page++;
>> +	}
>> +}
> 
> [...]
> 
>>   static void tsnep_rx_close(struct tsnep_rx *rx)
>>   {
>> +	if (rx->xsk_pool)
>> +		tsnep_rx_free_page_buffer(rx);
> 
> It looks like the above could call tsnep_rx_free_page_buffer() with
> each page ptr in rx->page_buffer not zero. If so
> tsnep_rx_free_page_buffer() will do an out of bound access.

rx->page_buffer has space for up to TSNEP_RING_SIZE ptr's. The
descriptor ring is filled with at most TSNEP_RING_SIZE - 1
pages. Thus, the last ptr in rx->page_buffer is always zero.

> Also, why testing rx->xsk_pool instead of rx->page_buffer?

Testing for rx->xsk_pool is done for all code, which is only needed
if XSK zero-copy is enabled. For me this is more consistent to the
rest of the code.

Thanks!

Gerhard

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ