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:   Tue, 5 May 2020 11:32:27 -0400
From:   Sasha Levin <sashal@...nel.org>
To:     Andy Shevchenko <andy.shevchenko@...il.com>
Cc:     Pavel Machek <pavel@...x.de>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Stable <stable@...r.kernel.org>,
        Dan Williams <dan.j.williams@...el.com>,
        Nicolas Ferre <nicolas.ferre@...rochip.com>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Vinod Koul <vkoul@...nel.org>
Subject: Re: [PATCH 4.19 28/37] dmaengine: dmatest: Fix iteration non-stop
 logic

On Tue, May 05, 2020 at 05:05:37PM +0300, Andy Shevchenko wrote:
>On Tue, May 5, 2020 at 4:37 PM Pavel Machek <pavel@...x.de> wrote:
>> On Tue 2020-05-05 16:19:11, Andy Shevchenko wrote:
>> > On Tue, May 5, 2020 at 3:58 PM Pavel Machek <pavel@...x.de> wrote:
>> > > On Tue 2020-05-05 15:51:16, Andy Shevchenko wrote:
>> > > > On Tue, May 5, 2020 at 3:37 PM Pavel Machek <pavel@...x.de> wrote:
>> > > Yeah, I pointed that out above. Both && and || permit short
>> > > execution. But that does not matter, as neither "params->iterations"
>> > > nor "total_tests >= params->iterations" have side effects.
>> > >
>> > > Where is the runtime difference?
>> >
>> > We have to check *both* conditions. If we don't check iterations, we
>> > just wait indefinitely until somebody tells us to stop.
>> > Everything in the commit message and mentioned there commit IDs which
>> > you may check.
>>
>> No.
>
>Yes. Please, read carefully the commit message (for your convenience I
>emphasized above). I don't want to spend time on this basics stuff
>anymore.

I'm a bit confused about this too. Maybe it's too early in the morning,
so I wrote this little test program:

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
        int a = atoi(argv[1]);
        int b = atoi(argv[2]);

        if (!a && !b)
                printf("A");
        else
                printf("B");

        if (!(a || b))
                printf("A");
        else
                printf("B");

        printf("\n");

        return 0;
}

Andy, could you give an example of two values which will print something
other than "AA" or "BB"?

Heck, gcc even compiles these two conditions the same way:

        if (!a && !b)
    11a8:       83 7d f8 00             cmpl   $0x0,-0x8(%rbp)
    11ac:       75 12                   jne    11c0 <main+0x57>
    11ae:       83 7d fc 00             cmpl   $0x0,-0x4(%rbp)
    11b2:       75 0c                   jne    11c0 <main+0x57>
                printf("A");
    11b4:       bf 41 00 00 00          mov    $0x41,%edi
    11b9:       e8 a2 fe ff ff          callq  1060 <putchar@plt>
    11be:       eb 0a                   jmp    11ca <main+0x61>
        else
                printf("B");
    11c0:       bf 42 00 00 00          mov    $0x42,%edi
    11c5:       e8 96 fe ff ff          callq  1060 <putchar@plt>

        if (!(a || b))
    11ca:       83 7d f8 00             cmpl   $0x0,-0x8(%rbp)
    11ce:       75 12                   jne    11e2 <main+0x79>
    11d0:       83 7d fc 00             cmpl   $0x0,-0x4(%rbp)
    11d4:       75 0c                   jne    11e2 <main+0x79>
                printf("A");
    11d6:       bf 41 00 00 00          mov    $0x41,%edi
    11db:       e8 80 fe ff ff          callq  1060 <putchar@plt>
    11e0:       eb 0a                   jmp    11ec <main+0x83>
        else
                printf("B");
    11e2:       bf 42 00 00 00          mov    $0x42,%edi
    11e7:       e8 74 fe ff ff          callq  1060 <putchar@plt>

-- 
Thanks,
Sasha

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ