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]
Date:   Sat, 4 Mar 2023 18:07:36 -0800
From:   Geoff Levand <geoff@...radead.org>
To:     Jakub Kicinski <kuba@...nel.org>,
        Alexander Lobakin <aleksander.lobakin@...el.com>
Cc:     netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>,
        Alexander Lobakin <alexandr.lobakin@...el.com>,
        Alexander Duyck <alexander.duyck@...il.com>,
        Paolo Abeni <pabeni@...hat.com>
Subject: Re: [PATCH net v6 1/2] net/ps3_gelic_net: Fix RX sk_buff length

Hi,

On 2/28/23 12:31, Jakub Kicinski wrote:
>>
>> IIRC the original problem is that the skb linear parts are not always
>> aligned to a boundary which this particular HW requires. So initially
>> there was something like "allocate len + alignment - 1, then
>> PTR_ALIGN()",
> 
> Let's focus on where the bug is. At a quick look I'm guessing that 
> the bug is that we align the CPU buffer instead of the DMA buffer.
> We should pass the entire allocate len + alignment - 1 as length 
> to dma_map() and then align the dma_addr. dma_addr is what the device
> sees. Not the virtual address of skb->data.
> 
> If I'm right the bug is not in fact directly addressed by the patch.
> I'm guessing the patch helps because at least the patch passes the
> aligned length to the dma_map(), rather than GELIC_NET_MAX_MTU (which
> is not a multiple of 128).

I found some old notes for the gelic network device.  It had values
for the max frame size, and the max MTU size.  These values are the
same as what is in the 'spider net' driver.  For patch set v7 I just
took what the spider net driver was doing for its RX DMA buffer
allocation and applied that to the gelic driver.

I think your comment about aligning the DMA buffer is addressed by
the lines:

    offset = ((unsigned long)descr->skb->data) &
		(GELIC_NET_RXBUF_ALIGN - 1);
    if (offset)
        skb_reserve(descr->skb, GELIC_NET_RXBUF_ALIGN - offset);

I tried to do some thorough testing of v7, and I couldn't get it to
error.

-Geoff



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ