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-next>] [day] [month] [year] [list]
Message-ID: <40a0b4ba22ff499686a2521998767ae5@huawei.com>
Date:   Tue, 11 Aug 2020 12:10:49 +0000
From:   linmiaohe <linmiaohe@...wei.com>
To:     Eric Dumazet <eric.dumazet@...il.com>
CC:     "davem@...emloft.net" <davem@...emloft.net>,
        "kuba@...nel.org" <kuba@...nel.org>,
        "pshelar@....org" <pshelar@....org>,
        "martin.varghese@...ia.com" <martin.varghese@...ia.com>,
        "fw@...len.de" <fw@...len.de>,
        "dcaratti@...hat.com" <dcaratti@...hat.com>,
        "edumazet@...gle.com" <edumazet@...gle.com>,
        "steffen.klassert@...unet.com" <steffen.klassert@...unet.com>,
        "pabeni@...hat.com" <pabeni@...hat.com>,
        "shmulik@...anetworks.com" <shmulik@...anetworks.com>,
        "kyk.segfault@...il.com" <kyk.segfault@...il.com>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] net: eliminate meaningless memcpy to data in
 pskb_carve_inside_nonlinear()

Eric Dumazet <eric.dumazet@...il.com> wrote:
> On 8/10/20 5:28 AM, Miaohe Lin wrote:
>> The skb_shared_info part of the data is assigned in the following 
>> loop. It is meaningless to do a memcpy here.
>> 
>
>Reminder : net-next is CLOSED.
>

Thanks for your remind. I would wait for it open.

>This is not correct. We still have to copy _something_
>
>Something like :
>
>diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 2828f6d5ba898a5e50ccce45589bf1370e474b0f..1c0519426c7ba4b04377fc8054c4223c135879ab 100644
>--- a/net/core/skbuff.c
>+++ b/net/core/skbuff.c
>@@ -5953,8 +5953,8 @@ static int pskb_carve_inside_nonlinear(struct sk_buff *skb, const u32 off,
>        size = SKB_WITH_OVERHEAD(ksize(data));
> 
>        memcpy((struct skb_shared_info *)(data + size),
>-              skb_shinfo(skb), offsetof(struct skb_shared_info,
>-                                        frags[skb_shinfo(skb)->nr_frags]));
>+              skb_shinfo(skb), offsetof(struct skb_shared_info, 
>+ frags[0]));
>+
>        if (skb_orphan_frags(skb, gfp_mask)) {
>                kfree(data);
>                return -ENOMEM;
>

This looks good. Will send a patch v2 soon. May I add a suggested-by tag of you ?
Many thanks.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ