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>] [day] [month] [year] [list]
Message-ID: <CAHk-=whEL2B-PSGzhQxyC3VR1XpUee6nKw6YiJG6w7hRL1f9Lg@mail.gmail.com>
Date:   Mon, 26 Oct 2020 17:14:35 -0700
From:   Linus Torvalds <torvalds@...ux-foundation.org>
To:     Jason Gunthorpe <jgg@...dia.com>
Cc:     John Hubbard <jhubbard@...dia.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Andrea Arcangeli <aarcange@...hat.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        "Aneesh Kumar K.V" <aneesh.kumar@...ux.ibm.com>,
        Christoph Hellwig <hch@....de>,
        Hugh Dickins <hughd@...gle.com>, Jan Kara <jack@...e.cz>,
        Jann Horn <jannh@...gle.com>,
        Kirill Shutemov <kirill@...temov.name>,
        Kirill Tkhai <ktkhai@...tuozzo.com>,
        Leon Romanovsky <leonro@...dia.com>,
        Linux-MM <linux-mm@...ck.org>, Michal Hocko <mhocko@...e.com>,
        Oleg Nesterov <oleg@...hat.com>, Peter Xu <peterx@...hat.com>
Subject: Re: [PATCH 2/2] mm: prevent gup_fast from racing with COW during fork

On Mon, Oct 26, 2020 at 4:50 PM Jason Gunthorpe <jgg@...dia.com> wrote:
>
> Right, it isn't a "seqcount" because the read side doesn't spin.

Not all readers spin for seqcount either.

Sure, it's the *common* case, but look at name resolution - it will
basically fail on a seqcount failure in RCU mode, and go to the "slow
and safe" version:

                if (unlikely(read_seqcount_retry(&d->d_seq, nd->seq)))
                        return -ECHILD;

Exactly like gup_fast vs fork, in fact.

So no, you don't need to retry for seqcount failures, doing

     seq = seqcount_begin(..);
     ... optimistic fast case ...
     if (!read_seqcount_retry(.., seq))
          return 0; // success
       .. do slow case ...

is valid and happens.

              Linus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ