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.9 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 2E7A6C34031 for ; Tue, 18 Feb 2020 03:59:51 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D9122206EF for ; Tue, 18 Feb 2020 03:59:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lca.pw header.i=@lca.pw header.b="JpYIm6no" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D9122206EF 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 654CA6B0008; Mon, 17 Feb 2020 22:59:50 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5DE3B6B000A; Mon, 17 Feb 2020 22:59:50 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4CE046B000C; Mon, 17 Feb 2020 22:59:50 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0096.hostedemail.com [216.40.44.96]) by kanga.kvack.org (Postfix) with ESMTP id 33ED06B0008 for ; Mon, 17 Feb 2020 22:59:50 -0500 (EST) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id D1CF5180AD807 for ; Tue, 18 Feb 2020 03:59:49 +0000 (UTC) X-FDA: 76501894098.11.fish92_38aaecfe81432 X-HE-Tag: fish92_38aaecfe81432 X-Filterd-Recvd-Size: 4158 Received: from mail-qt1-f173.google.com (mail-qt1-f173.google.com [209.85.160.173]) by imf49.hostedemail.com (Postfix) with ESMTP for ; Tue, 18 Feb 2020 03:59:49 +0000 (UTC) Received: by mail-qt1-f173.google.com with SMTP id n17so13598040qtv.2 for ; Mon, 17 Feb 2020 19:59:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lca.pw; s=google; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=eBMrYVnG2e5g/Olgnu0zX3IFSEXk/cmu6kxT75NqeqA=; b=JpYIm6no20JunYFfGQ6pzuZbzD2WRbnkWP1hg/qTdVzHRtjRYxC92TSVuhoLX9icGX iN99sE8PdtIRmp5HZjWlZQVsNGTA5lyzMXYOxC1GLOU8ZLJTSIaQ55MvUPfaTnhB98L3 rbPBW/nK7iatec/qFcbHwKRisVLgMqnSdKZIDBnOCFSLV4nJO/ByGhhRFr/3YE3ZGsMi trCxl2bEoh35CBDK++uZvePlXI4Stv0iQaqS3qMYUGwgxJLHX9jEy4AR/aQKx9LjeeJg GvqOgurooT+8bBWebuYs7ILegYts4y6vwTFBs6Ee1RfyPryd2iVDeFlGZWasrM2sVUOX siLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=eBMrYVnG2e5g/Olgnu0zX3IFSEXk/cmu6kxT75NqeqA=; b=A1nQi1/mWoOkAcs+HIsWGhsNcRvuUgOGZZGpATYY3mH5JWBgimZTa7DpTunaM2N/+N eUkBFbY3aruoYP5NooAix6bjWdNoWacJITtDuhni0typZQj1pXzf3gZjKxUnhWt7SRS3 tMoYCCAN3COrQcNiK1oEuNktIZZnbQPNO+EBrj00bZoUrslpJzJbOS6c1xPuTCtGANyr gy/H4hWHtpkxatV4REdz+Rk9lZ0i7tPu0LiZIcT5eOjIa486ms/2Jg8MI1Bqe66uUVD+ yPZFyBDwYbrtOPr9EyHnHIsdue3viTQBrrYZMZbBudbz0OJeZf/MD9rnyWFyyhQP7xE0 /xlA== X-Gm-Message-State: APjAAAXKeJUx9v6rRMiEMjGDt3am5Trd5HPgO2QoTuH2ETX2uQ9jEx0U 1LvAdYTgTqt9hfG2nGSvbtLj4A== X-Google-Smtp-Source: APXvYqy2/meLKdlopF9ZhXy9TAFlMv+cxtpUhf2YbSbGrZI9L0zGsb5QSVWG/WVyf8pzIhEHuJRj/A== X-Received: by 2002:ac8:6f27:: with SMTP id i7mr15597893qtv.253.1581998388654; Mon, 17 Feb 2020 19:59:48 -0800 (PST) Received: from [192.168.1.153] (pool-71-184-117-43.bstnma.fios.verizon.net. [71.184.117.43]) by smtp.gmail.com with ESMTPSA id v10sm1287993qtj.26.2020.02.17.19.59.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Feb 2020 19:59:48 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3608.60.0.2.5\)) Subject: Re: [PATCH -next] fork: annotate a data race in vm_area_dup() From: Qian Cai In-Reply-To: <20200217223138.doaph66iwprbwhw5@box> Date: Mon, 17 Feb 2020 22:59:47 -0500 Cc: Andrew Morton , elver@google.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <20200217223138.doaph66iwprbwhw5@box> To: "Kirill A. Shutemov" X-Mailer: Apple Mail (2.3608.60.0.2.5) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000096, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: > On Feb 17, 2020, at 5:31 PM, Kirill A. Shutemov = wrote: >=20 > I'm confused. AFAICS both sides hold mmap_sem on write: >=20 > - vm_mmap_pgoff() takes mmap_sem for the write on the write side >=20 > - do_mprotect_pkey() takes mmap_sem for the write on the read side >=20 >=20 > 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=E2=80=99t 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=E2=80=99t 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=E2=80=99t see how it was also loaded in the reader. Any ideas?=