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:   Thu, 11 Nov 2021 08:52:51 -0800
From:   Eric Dumazet <edumazet@...gle.com>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     Eric Dumazet <eric.dumazet@...il.com>,
        "David S . Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        netdev <netdev@...r.kernel.org>, x86@...nel.org,
        Alexander Duyck <alexander.duyck@...il.com>
Subject: Re: [RFC] x86/csum: rewrite csum_partial()

On Thu, Nov 11, 2021 at 8:02 AM Eric Dumazet <edumazet@...gle.com> wrote:
>

> Thanks Peter !
>
> This is more or less the first version I wrote. (I was doing tests for
> (len & 32), (len & 16) .. to not have to update len in these blocks.
>
> Then, I tried to add an inline version, a la ip_fast_csum() but for IPv6.
>
> Then I came up with the version I sent, for some reason my .config had
> temporarily disabled CONFIG_RETPOLINE,
> thanks for reminding me this !
>
> I also missed this warning anyway :
> arch/x86/lib/csum-partial_64.o: warning: objtool: csum_partial()+0x2f:
> unannotated intra-function call
>
> I will spend a bit more time on this before sending a V2, thanks again !

BTW, I could not understand why :

               result = add32_with_carry(result, *(u32 *)buff);

generates this code :

 123: 41 8b 09              mov    (%r9),%ecx
 126: 89 4d f8              mov    %ecx,-0x8(%rbp)
 129: 03 45 f8              add    -0x8(%rbp),%eax
 12c: 83 d0 00              adc    $0x0,%eax

Apparently add32_with_carry() forces the use of use of a temporary in memory

While
               asm("   addl 0*4(%[src]),%[res]\n"
                   "   adcl $0,%[res]\n"
                       : [res] "=r" (result)
                       : [src] "r" (buff), "[res]" (result)
                        : "memory");

gives

 120: 41 03 01              add    (%r9),%eax
 123: 83 d0 00              adc    $0x0,%eax

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ