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: <CANn89iLok_EZ1L0ZYxQ+H9Wi+SPrgiyhWpAnVnQBfc5qcKgHWw@mail.gmail.com>
Date:   Thu, 2 Dec 2021 07:22:17 -0800
From:   Eric Dumazet <edumazet@...gle.com>
To:     David Laight <David.Laight@...lab.com>
Cc:     Vladimir Oltean <olteanv@...il.com>,
        Eric Dumazet <eric.dumazet@...il.com>,
        "David S . Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        netdev <netdev@...r.kernel.org>,
        David Lebrun <dlebrun@...gle.com>
Subject: Re: [PATCH net-next 2/2] net: optimize skb_postpull_rcsum()

On Thu, Dec 2, 2021 at 7:06 AM David Laight <David.Laight@...lab.com> wrote:
>
> From: Vladimir Oltean
> > Sent: 02 December 2021 13:11
> ...
> > > --- a/include/linux/skbuff.h
> > > +++ b/include/linux/skbuff.h
> > > @@ -3485,7 +3485,11 @@ __skb_postpull_rcsum(struct sk_buff *skb, const void *start, unsigned int
> > len,
> > >  static inline void skb_postpull_rcsum(struct sk_buff *skb,
> > >                                   const void *start, unsigned int len)
> > >  {
> > > -   __skb_postpull_rcsum(skb, start, len, 0);
> > > +   if (skb->ip_summed == CHECKSUM_COMPLETE)
> > > +           skb->csum = ~csum_partial(start, len, ~skb->csum);
>
> You can't do that, the domain is 1..0xffff (or maybe 0xffffffff).
> The invert has to convert ~0 to ~0 not zero.
> ...
> > There seems to be a disparity when the skb->csum is calculated by
> > skb_postpull_rcsum as zero. Before, it was calculated as 0xffff.
>
> Which is what that will do for some inputs at least.
> Maybe:
>                 skb->csum = 1 + ~csum_partial(start, len, ~skb->csum + 1);
> is right.
> I think that is the same as:
>                 skb->csum = -csum_partial(start, len, -skb->csum);
> Although letting the compiler do that transform probably makes
> the code easier to read.
>
>

Interesting, update_csum_diff4() and update_csum_diff16() seem to both use.

skb->csum = ~csum_partial((char *)diff, sizeof(diff), ~skb->csum);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ