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: <CAKgT0UfDWXbXSX45XRZjTc6SXz+XqaYa1bHGzOUV_RXSPh=U=A@mail.gmail.com>
Date:	Sun, 28 Feb 2016 10:56:38 -0800
From:	Alexander Duyck <alexander.duyck@...il.com>
To:	Tom Herbert <tom@...bertland.com>
Cc:	David Miller <davem@...emloft.net>,
	Netdev <netdev@...r.kernel.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>, Peter Anvin <hpa@...or.com>,
	"the arch/x86 maintainers" <x86@...nel.org>,
	Kernel Team <kernel-team@...com>
Subject: Re: [PATCH v4 net-next] net: Implement fast csum_partial for x86_64

On Sat, Feb 27, 2016 at 12:30 AM, Alexander Duyck
<alexander.duyck@...il.com> wrote:
>> +{
>> +       asm("lea 40f(, %[slen], 4), %%r11\n\t"
>> +           "clc\n\t"
>> +           "jmpq *%%r11\n\t"
>> +           "adcq 7*8(%[src]),%[res]\n\t"
>> +           "adcq 6*8(%[src]),%[res]\n\t"
>> +           "adcq 5*8(%[src]),%[res]\n\t"
>> +           "adcq 4*8(%[src]),%[res]\n\t"
>> +           "adcq 3*8(%[src]),%[res]\n\t"
>> +           "adcq 2*8(%[src]),%[res]\n\t"
>> +           "adcq 1*8(%[src]),%[res]\n\t"
>> +           "adcq 0*8(%[src]),%[res]\n\t"
>> +           "nop\n\t"
>> +           "40: adcq $0,%[res]"
>> +                   : [res] "=r" (sum)
>> +                   : [src] "r" (buff),
>> +                     [slen] "r" (-((unsigned long)(len >> 3))), "[res]" (sum)
>> +                   : "r11");
>> +
>
> With this patch I cannot mix/match different length checksums without
> things failing.  In perf the jmpq in the loop above seems to be set to
> a fixed value so perhaps it is something in how the compiler is
> interpreting the inline assembler.

The perf thing was a red herring.  Turns out the code is working
correctly there.

I actually found the root cause.  The problem is in add32_with_carry3.

> +static inline unsigned int add32_with_carry3(unsigned int a, unsigned int b,
> +                                            unsigned int c)
> +{
> +       asm("addl %2,%0\n\t"
> +           "adcl %3,%0\n\t"
> +           "adcl $0,%0"
> +           : "=r" (a)
> +           : "" (a), "rm" (b), "rm" (c));
> +
> +       return a;
> +}
> +

You need to set the 'a' input variable attribute to "0" instead of ""
and then things work for me correctly.

- Alex

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ