linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
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, peterz@infradead.org,
	syzbot+c034966b0b02f94f7f34@syzkaller.appspotmail.com,
	syzkaller-bugs@googlegroups.com
Subject: Re: [PATCH -next] fork: annotate a data race in vm_area_dup()
Date: Tue, 18 Feb 2020 07:40:06 -0500	[thread overview]
Message-ID: <93E6B243-9A0F-410C-8EE4-9D57E28AF5AF@lca.pw> (raw)
In-Reply-To: <20200218103002.6rtjreyqjepo3yxe@box>



> On Feb 18, 2020, at 5:29 AM, Kirill A. Shutemov <kirill@shutemov.name> wrote:
> 
> I think I've got this:
> 
> vm_area_dup() blindly copies all fields of orignal VMA to the new one.
> This includes coping vm_area_struct::shared.rb which is normally protected
> by i_mmap_lock. But this is fine because the read value will be
> overwritten on the following __vma_link_file() under proper protectection.

Right, multiple processes could share the same file-based address space where those vma have been linked into address_space::i_mmap via vm_area_struct::shared.rb. Thus, the reader could see its shared.rb linkage pointers got updated by other processes.

> 
> So the fix is correct, but justificaiton is lacking.
> 
> Also, I would like to more fine-grained annotation: marking with
> data_race() 200 bytes copy may hide other issues.

That is the harder part where I don’t think we have anything for that today. Macro, any suggestions? ASSERT_IGNORE_FIELD()?

  reply	other threads:[~2020-02-18 12:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-14 20:33 [PATCH -next] fork: annotate a data race in vm_area_dup() Qian Cai
2020-02-17 22:31 ` Kirill A. Shutemov
2020-02-18  3:59   ` Qian Cai
2020-02-18 10:30     ` Kirill A. Shutemov
2020-02-18 12:40       ` Qian Cai [this message]
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=93E6B243-9A0F-410C-8EE4-9D57E28AF5AF@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 \
    --cc=peterz@infradead.org \
    --cc=syzbot+c034966b0b02f94f7f34@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    /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;
as well as URLs for NNTP newsgroup(s).