Received: by 10.213.65.68 with SMTP id h4csp948826imn; Tue, 27 Mar 2018 11:45:48 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+sHnvW+xGh2icmbkTDXAaAiYLhMEMCZV3y0ZZB7Q8qtkv4YiFfzxhGMoa6TzbHhS5qt51k X-Received: by 10.101.65.10 with SMTP id w10mr306602pgp.39.1522176348401; Tue, 27 Mar 2018 11:45:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522176348; cv=none; d=google.com; s=arc-20160816; b=klQJOftf2zLYnuylf52qqsB2kl4LTCsc88l0rRXWq39oZqFcmuhKhfxeuaUv/8vQ1o w+DZXBXpWNZddN7qxBlnPomgDN1pRzwf9A8MYB4tHdiKUUHnlK2VZUV4UNNqmmbbyjfy vOo9/R4iEmvDeRilX3gWl25fy/tNrER/eKQjfV98nlRykl4OwDiYY3pm1S2RurnddG/B AaoJWuv3H7q/6UGouM42Lt7xwch7qHhNcY7O2OMLcdALszhxWQVpqS5rnkcGBnpPWgYS EDGCbBot1OOGigHkpSe9W3osIzHod1zXqdQaaOCCNR5Zxg+FjQDYwkuZRvCgcaxlEzQ/ QVmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=G5evFqssPSgCY1q0iuWVI4JDWMyUlTN30Q2zSSq0gys=; b=AEZsZknteB1HCXkre3Tm8ezfzBJTRVNJPITULtR7l/5YjcayvH/sE2TvN6HfAeZQfq n8kBGzzVk8dGVMZEPs8F+bvWKwe2vFMxXVyz0ucxSuqNe5dzRsDXgzGut+UnADsXCpYy AGiiCJagkMWtP6bVaiEhudfkXx50BstQxku7lfL+TxOey2ONFJkg72Oxv4uQfUtxjFTg 5eJAJMsVhxNzJDzXG5iSBmK0ANaUomL03gxSNpV32dn/r/Nrm51cX9MfHtZc2SC5ipUO d7JOGyqOzbupKNuLULcF+R9SRHmXDkbtMK27Ka32QXNb9qFY1uDJxsEEiizzGFXCClBm AWzA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h6si1230760pgc.830.2018.03.27.11.45.31; Tue, 27 Mar 2018 11:45:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751099AbeC0Sof (ORCPT + 99 others); Tue, 27 Mar 2018 14:44:35 -0400 Received: from out30-133.freemail.mail.aliyun.com ([115.124.30.133]:41612 "EHLO out30-133.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750873AbeC0Soe (ORCPT ); Tue, 27 Mar 2018 14:44:34 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R581e4;CH=green;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01f04446;MF=yang.shi@linux.alibaba.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---0T-BuuH2_1522176253; Received: from US-143344MP.local(mailfrom:yang.shi@linux.alibaba.com fp:65.207.107.50) by smtp.aliyun-inc.com(127.0.0.1); Wed, 28 Mar 2018 02:44:16 +0800 Subject: Re: [v2 PATCH] mm: introduce arg_lock to protect arg_start|end and env_start|end in mm_struct To: Cyrill Gorcunov Cc: Matthew Wilcox , adobriyan@gmail.com, mhocko@kernel.org, mguzik@redhat.com, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <1522088439-105930-1-git-send-email-yang.shi@linux.alibaba.com> <20180326183725.GB27373@bombadil.infradead.org> <20180326192132.GE2236@uranus> <20180327073212.GG2236@uranus> From: Yang Shi Message-ID: <73559b36-b55b-429a-285f-c05b45129b51@linux.alibaba.com> Date: Tue, 27 Mar 2018 14:44:09 -0400 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20180327073212.GG2236@uranus> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/27/18 3:32 AM, Cyrill Gorcunov wrote: > On Mon, Mar 26, 2018 at 05:59:49PM -0400, Yang Shi wrote: >>> Say we've two syscalls running prctl_set_mm_map in parallel, and imagine >>> one have @start_brk = 20 @brk = 10 and second caller has @start_brk = 30 >>> and @brk = 20. Since now the call is guarded by _read_ the both calls >>> unlocked and due to OO engine it may happen then when both finish >>> we have @start_brk = 30 and @brk = 10. In turn "write" semaphore >>> has been take to have consistent data on exit, either you have [20;10] >>> or [30;20] assigned not something mixed. >>> >>> That said I think using read-lock here would be a bug. >> Yes it sounds so. However, it was down_read before >> ddf1d398e517e660207e2c807f76a90df543a217 ("prctl: take mmap sem for writing >> to protect against others"). And, that commit is for fixing the concurrent >> writing to arg_* and env_*. I just checked that commit, but omitted the brk >> part. The potential issue mentioned by you should exist before that commit, >> but might be just not discovered or very rare to hit. >> >> I will change it back to down_write. > down_read before was a bug ;) And it was not discovered earlier simply > because not that many users of this interface exist, namely only criu > as far as I know by now. Thanks for confirming this. I assumed so :-)