From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6B29C34026 for ; Tue, 18 Feb 2020 12:40:10 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8A3B4206F4 for ; Tue, 18 Feb 2020 12:40:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lca.pw header.i=@lca.pw header.b="GB/rqqA7" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8A3B4206F4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lca.pw Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 320E06B0003; Tue, 18 Feb 2020 07:40:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2D1F36B0006; Tue, 18 Feb 2020 07:40:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1E6DC6B0007; Tue, 18 Feb 2020 07:40:10 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0074.hostedemail.com [216.40.44.74]) by kanga.kvack.org (Postfix) with ESMTP id 0525E6B0003 for ; Tue, 18 Feb 2020 07:40:09 -0500 (EST) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id A12CD180AD815 for ; Tue, 18 Feb 2020 12:40:09 +0000 (UTC) X-FDA: 76503205338.04.walk90_589a97785f352 X-HE-Tag: walk90_589a97785f352 X-Filterd-Recvd-Size: 4135 Received: from mail-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175]) by imf08.hostedemail.com (Postfix) with ESMTP for ; Tue, 18 Feb 2020 12:40:08 +0000 (UTC) Received: by mail-qk1-f175.google.com with SMTP id h4so19335986qkm.0 for ; Tue, 18 Feb 2020 04:40:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lca.pw; s=google; h=content-transfer-encoding:from:mime-version:subject:date:message-id :references:cc:in-reply-to:to; bh=LWli3K53CEX1HNi+Tv/g1jNkXhayZEjclQo7y9gNLIg=; b=GB/rqqA7hJJg58RQqIcDEtDMUPNqc/+XnLUPmx/2fCLTZN+/K/5yEloHg1bvKV9zlC AA/KMkY98nxFljPtm17Vm0ox83jDH5DsVGWLqwHhwrVbmI9/KQST8UGrV0H7CQQSvPzi 7tzCdVtXXWD7ONqp6UnggxilWwkOnD++koYl+FbVKiIM+aeH3Jz8GZNzDFOzBopfQQjR Y6UpifbOccA1y2UyL1AmVasK4x3ljvvSdCyux4ACz7XKr1W7xlC49rEpOFEKbwrRvkyX DMDRmLEOb4xW6cPwTKzM1Q8sUsyAOdhjk3xDaaFRCoHn2NLSLMwa9GRDQCosW3n+2tHH Ym1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=LWli3K53CEX1HNi+Tv/g1jNkXhayZEjclQo7y9gNLIg=; b=EhJ5rjAIBZnaPlMTQjmLCQBO6aXicyFi2lTS1MOefrFRw6+usi3I8z1JLIv9b7fkzb FNXIoMT1tTdgJflm9cfK4LpDy1b7vbXx0CLL7riob0Y6dDn2sEE/yqZx0P2Y7a+26Jy0 JgZ1yXBRV38tpaV59FL45LgNq/BvWNNosUsAjX01r5obQBnQZgs5Fg6atwzX0Dp7oEzU uzxX1hXOvOsNVGokWOmUSuNa0ftRb29TR47D2DCiiIm9Y+OxrdLoQI2Hh+visCYj4xI5 8Do3EUGApdONU8vq024o2Of22zXoqcXn5pfleUdsXp8/tlBIFo9mTcow/3E/h3Fvi3bM jivg== X-Gm-Message-State: APjAAAXIoKJPYdds+gnDFGB3O7Mr2Szck62VV1U/cLUXVKgV+r+69hpn dT5HTW+zpg+IJo4lJMoHR9MFSQ== X-Google-Smtp-Source: APXvYqyd3eazdTC7HD2pIOmHzLCRMhVj8/vlWUZ0zIP2gj/268N8Yf0idWhkqlXqQcmCRcrvbt+AHA== X-Received: by 2002:a05:620a:4cc:: with SMTP id 12mr18079991qks.153.1582029608059; Tue, 18 Feb 2020 04:40:08 -0800 (PST) Received: from [192.168.1.183] (pool-71-184-117-43.bstnma.fios.verizon.net. [71.184.117.43]) by smtp.gmail.com with ESMTPSA id p18sm1846908qkp.47.2020.02.18.04.40.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 18 Feb 2020 04:40:07 -0800 (PST) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Qian Cai Mime-Version: 1.0 (1.0) Subject: Re: [PATCH -next] fork: annotate a data race in vm_area_dup() Date: Tue, 18 Feb 2020 07:40:06 -0500 Message-Id: <93E6B243-9A0F-410C-8EE4-9D57E28AF5AF@lca.pw> References: <20200218103002.6rtjreyqjepo3yxe@box> Cc: Andrew Morton , elver@google.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, peterz@infradead.org, syzbot+c034966b0b02f94f7f34@syzkaller.appspotmail.com, syzkaller-bugs@googlegroups.com In-Reply-To: <20200218103002.6rtjreyqjepo3yxe@box> To: "Kirill A. Shutemov" X-Mailer: iPhone Mail (17D50) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000373, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: > On Feb 18, 2020, at 5:29 AM, Kirill A. Shutemov wro= te: >=20 > I think I've got this: >=20 > 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 wher= e 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 upd= ated by other processes. >=20 > So the fix is correct, but justificaiton is lacking. >=20 > 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=E2=80=99t think we have anything for tha= t today. Macro, any suggestions? ASSERT_IGNORE_FIELD()?=