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: <87k1i411vc.fsf@linutronix.de>
Date:   Wed, 13 Feb 2019 10:20:07 +0100
From:   John Ogness <john.ogness@...utronix.de>
To:     Linus Torvalds <torvalds@...ux-foundation.org>
Cc:     Linux List Kernel Mailing <linux-kernel@...r.kernel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Petr Mladek <pmladek@...e.com>,
        Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>,
        Steven Rostedt <rostedt@...dmis.org>,
        Daniel Wang <wonderfly@...gle.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Alan Cox <gnomes@...rguk.ukuu.org.uk>,
        Jiri Slaby <jslaby@...e.com>,
        Peter Feiner <pfeiner@...gle.com>,
        linux-serial@...r.kernel.org,
        Sergey Senozhatsky <sergey.senozhatsky@...il.com>
Subject: Re: [RFC PATCH v1 07/25] printk-rb: add functionality required by printk

On 2019-02-12, Linus Torvalds <torvalds@...ux-foundation.org> wrote:
> On Tue, Feb 12, 2019 at 6:30 AM John Ogness <john.ogness@...utronix.de> wrote:
>>
>> +                       while (atomic_long_read(&rb->lost)) {
>> +                               atomic_long_dec(&rb->lost);
>> +                               rb->seq++;
>> +                       }
>
> This looks like crazy garbage. It's neither atomic nor sane.

It works because because only 1 context on a single CPU can hit that
loop. But yes, it is crazy.

> Why isn't it something like
>
>     if (atomic_long_read(&rb->lost)) {
>         long lost = atomic_xchg(&rb->lost, 0);
>         rb->seq += lost;
>     }
>
> instead?

Yes, it should be like you suggest. Thanks.

John Ogness

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ