From: Qian Cai <cai@lca.pw>
To: "Kirill A. Shutemov" <kirill@shutemov.name>
Cc: Andrew Morton <akpm@linux-foundation.org>,
elver@google.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH -next] fork: annotate a data race in vm_area_dup()
Date: Mon, 17 Feb 2020 22:59:47 -0500 [thread overview]
Message-ID: <EAD6E54D-8A57-4494-94F2-2EEEC3265560@lca.pw> (raw)
In-Reply-To: <20200217223138.doaph66iwprbwhw5@box>
> On Feb 17, 2020, at 5:31 PM, Kirill A. Shutemov <kirill@shutemov.name> wrote:
>
> I'm confused. AFAICS both sides hold mmap_sem on write:
>
> - vm_mmap_pgoff() takes mmap_sem for the write on the write side
>
> - do_mprotect_pkey() takes mmap_sem for the write on the read side
>
>
> What do I miss?
Ah, good catch. I missed the locking for the read there. This is interesting because Marco
did confirmed that the concurrency could happen,
https://lore.kernel.org/lkml/20191025173511.181416-1-elver@google.com/
If that means KCSAN is not at fault, then I could think of two things,
1) someone downgrades the lock.
I don’t think that a case here. Only __do_munmap() will do that but I did not see how
it will affect us here.
2) the reader and writer are two different processes.
So, they held a different mmap_sem, but I can’t see how could two processes shared
the same vm_area_struct. Also, file->f_mapping->i_mmap was also stored in the
writer, but I can’t see how it was also loaded in the reader.
Any ideas?
next prev parent reply other threads:[~2020-02-18 3:59 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-14 20:33 Qian Cai
2020-02-17 22:31 ` Kirill A. Shutemov
2020-02-18 3:59 ` Qian Cai [this message]
2020-02-18 10:30 ` Kirill A. Shutemov
2020-02-18 12:40 ` Qian Cai
2020-02-18 14:09 ` Marco Elver
2020-02-18 15:00 ` Qian Cai
2020-02-18 15:18 ` Kirill A. Shutemov
2020-02-18 16:46 ` Qian Cai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=EAD6E54D-8A57-4494-94F2-2EEEC3265560@lca.pw \
--to=cai@lca.pw \
--cc=akpm@linux-foundation.org \
--cc=elver@google.com \
--cc=kirill@shutemov.name \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox