Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3441921pxv; Mon, 12 Jul 2021 17:58:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxnWo+Pl4/QTO5kF2vKw2t5CorpugzrEiMAGJD/wByvm/mDX2RZ3tl6zFv5GfkCxa7TW2ud X-Received: by 2002:a05:6638:3819:: with SMTP id i25mr1535068jav.44.1626137931362; Mon, 12 Jul 2021 17:58:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626137931; cv=none; d=google.com; s=arc-20160816; b=Kt8477zXrGgC5M7wfdeHG/9Houaa+4SlLYXJ0QApBBmlN7rQfLXcSAzjdwKCdaB1pe rYEApePyZ/Mv1Dw6N5HVMu+4OtubB5r6Q/dEdsujXs/LGg0Qh1F7ePJCMGFte9XK9RA6 HHR4SskE1S8Jc2CrS25e5qGsVDWnLkAsGQZdrkGrdkRpJZQUrcvZdGtUU2EIpmCmO6fe WSu0WB3RKkFDdNZXy+WOG+aggzdELAg6xfiAeKfvGmPc2L7GKf3SWdcobXpQe2TO/PcM ge4sHzAzL1EIK+oMbUzLrkjk8LLjNANYKvXJCNS1VWEOYhf7703lk2dRHHjxXp5j5tAa N8qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from; bh=Y606zzu5cBf79RqZUI1fKNfxY9Yt4bRI1Pc/tlPgC40=; b=cJm/d7FqfoQv/ioHdTdGl7bZWuejEVhIiecx09MdlfvTqC2MhxLoiKAMO0Nbk2uKMJ mILRpI2zyN9RDvZ5lOzKi9ofY2pXb6hvHmp1JXujPB6EjBwU8HuAnXxdX6Iv30JDTNYU +KWR5EkoG5iUIp8YfyuIsSOqOnWTg47GOQDqJyGucaecT3PMhIqSIuqm4JtGyL90+pzr H7tzahwyteDbVUXBf/ztxtVnwYiDvm5txI6Xl+Oqd2lEgemLL+ZJt7HoHyvT7h2cOfFo HTD2m1qLWGLfDn11PGbCLAgDj7/9zGwuzcAX34uCRLljC6b5MUAJsFfeA5rjoSwIox7m VtIA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d16si18132957ilf.112.2021.07.12.17.58.39; Mon, 12 Jul 2021 17:58:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230225AbhGMBA5 convert rfc822-to-8bit (ORCPT + 99 others); Mon, 12 Jul 2021 21:00:57 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:6806 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229604AbhGMBA5 (ORCPT ); Mon, 12 Jul 2021 21:00:57 -0400 Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4GP2Ct5sKzzXsS1; Tue, 13 Jul 2021 08:52:26 +0800 (CST) Received: from dggpemm500007.china.huawei.com (7.185.36.183) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Tue, 13 Jul 2021 08:57:59 +0800 Received: from dggpeml500016.china.huawei.com (7.185.36.70) by dggpemm500007.china.huawei.com (7.185.36.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Tue, 13 Jul 2021 08:57:59 +0800 Received: from dggpeml500016.china.huawei.com ([7.185.36.70]) by dggpeml500016.china.huawei.com ([7.185.36.70]) with mapi id 15.01.2176.012; Tue, 13 Jul 2021 08:57:59 +0800 From: "Longpeng (Mike, Cloud Infrastructure Service Product Dept.)" To: Matthew Wilcox CC: Steven Sistare , Anthony Yznaga , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , "Gonglei (Arei)" Subject: RE: [RFC PATCH 0/5] madvise MADV_DOEXEC Thread-Topic: [RFC PATCH 0/5] madvise MADV_DOEXEC Thread-Index: AQHXc97/nCzRwgdWL0SQOyOsHiWdfas4gR6AgAWFHYCAAAbcAIACA3Tw Date: Tue, 13 Jul 2021 00:57:59 +0000 Message-ID: References: <1595869887-23307-1-git-send-email-anthony.yznaga@oracle.com> <43471cbb-67c6-f189-ef12-0f8302e81b06@oracle.com> In-Reply-To: Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.174.148.223] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Matthew, > -----Original Message----- > From: Matthew Wilcox [mailto:willy@infradead.org] > Sent: Monday, July 12, 2021 9:30 AM > To: Longpeng (Mike, Cloud Infrastructure Service Product Dept.) > > Cc: Steven Sistare ; Anthony Yznaga > ; linux-kernel@vger.kernel.org; > linux-mm@kvack.org; Gonglei (Arei) > Subject: Re: [RFC PATCH 0/5] madvise MADV_DOEXEC > > On Mon, Jul 12, 2021 at 09:05:45AM +0800, Longpeng (Mike, Cloud > Infrastructure Service Product Dept.) wrote: > > Let me describe my use case more clearly (just ignore if you're not > > interested in it): > > > > 1. Prog A mmap() 4GB memory (anon or file-mapping), suppose the > > allocated VA range is [0x40000000,0x140000000) > > > > 2. Prog A specifies [0x48000000,0x50000000) and > > [0x80000000,0x100000000) will be shared by its child. > > > > 3. Prog A fork() Prog B and then Prog B exec() a new ELF binary. > > > > 4. Prog B notice the shared ranges (e.g. by input parameters or ...) > > and remap them to a continuous VA range. > > This is dangerous. There must be an active step for Prog B to accept Prog A's > ranges into its address space. Otherwise Prog A could almost completely fill > Prog B's address space and so control where Prog B places its mappings. It > could also provoke a latent bug in Prog B if it doesn't handle address space > exhaustion gracefully. > > I had a proposal to handle this. Would it meet your requirements? > https://lore.kernel.org/lkml/20200730152250.GG23808@casper.infradead.org/ I noticed your proposal of project Sileby and I think it can meet Steven's requirement, but I not sure whether it's suitable for mine because there's no sample code yet, is it in progress ? According to the abstract of Sileby, I have two questions: 1. Would you plan to support the file-mapping memory sharing ? e.g. Prog A's 4G memory is backend with 2M hugetlb. 2. Does each mshare fd only containe one sharing VMA ? For large memory process (1T~4T in our env), maybe there is hundreds of memory ranges need to be shared, this will take too much fd space if so ?