Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp309715ybg; Tue, 28 Jul 2020 06:41:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxOk7slVYWnyFO3oq+yCK1w/g6jr3VwZ1M8AuUenJEjd6HyS6kT3HdH3L0xhGZ20C9u79VC X-Received: by 2002:a17:906:8601:: with SMTP id o1mr26430132ejx.326.1595943695445; Tue, 28 Jul 2020 06:41:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595943695; cv=none; d=google.com; s=arc-20160816; b=lOjmHDCOHv446xes3XwjZkgMJtpH5ShFxW4NKGJrxbk6FwyOTsS4cXenXZ0xfSGULf 2NWQTjs3TGXwfclNtv9ZjnScQhI8xxaRgNOyl200Ga+lKoojcVJUZQR7+VEcLHghVr9G pAII2zAz0kER/MBKDOYLID6aC3Q7g8yLbW+SmHHQ7Q6f6ysVhiUWRAJnkzv0UGMvLkah drI/p0mFn9qz0W4QPM2/uj3RDfvwTROCFP10UwjlC8k5Va3txAyamM4o9DH8prXG6lxz G5PJTUo5tQ9WX3FsCeQ0OLFNrObXD0fA1ACBLhsfoY6ss3w925zYrRByodN2B8U0vAEg yPGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=nzIDHa34X8KL5+HCryPqlbtW3FXLwbrWJUC/qS4oAOI=; b=ABpohAl1fBNVNy50LxnxSfd4UNJA7nwkmiPB4hmszEGG6M4u//S0EoTN8dmh2dDUTA dSkN1+klOVD5Rs6iJgKwYzp0+fjRsqb1liPkLEdQNG/GS2tLnL77NiM2dORlK6dg/FXT szSiwB5nduDSGN498IpRN26OBKkBRqjjWA7gT5l6iMbz9BR4WdLTCOgnC5+hdS3HXbwd ZY7zv4btu6v7r7r5YbdVIJ4nPLo0PzBjQCBtj5EGPgGevIY/e51A54OmT8K/EyuoUQMT x6ycBFlDa1ZKsmv5WB0h5hOrSeT33TVdmz7/DBc7V9KiYvujTdWiT6tScXg3KCH24Gdc 6riQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e8si3047643edk.310.2020.07.28.06.41.12; Tue, 28 Jul 2020 06:41:35 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730141AbgG1Nk2 (ORCPT + 99 others); Tue, 28 Jul 2020 09:40:28 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:55330 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729044AbgG1Nk2 (ORCPT ); Tue, 28 Jul 2020 09:40:28 -0400 Received: from ip5f5af08c.dynamic.kabel-deutschland.de ([95.90.240.140] helo=wittgenstein) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1k0Pq5-0004Om-5K; Tue, 28 Jul 2020 13:40:17 +0000 Date: Tue, 28 Jul 2020 15:40:15 +0200 From: Christian Brauner To: Steven Sistare Cc: "Eric W. Biederman" , Anthony Yznaga , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, mhocko@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, x86@kernel.org, hpa@zytor.com, viro@zeniv.linux.org.uk, akpm@linux-foundation.org, arnd@arndb.de, keescook@chromium.org, gerg@linux-m68k.org, ktkhai@virtuozzo.com, peterz@infradead.org, esyr@redhat.com, jgg@ziepe.ca, christian@kellner.me, areber@redhat.com, cyphar@cyphar.com, linux-api@vger.kernel.org Subject: Re: [RFC PATCH 0/5] madvise MADV_DOEXEC Message-ID: <20200728134015.tmjy5hy4xden2v5h@wittgenstein> References: <1595869887-23307-1-git-send-email-anthony.yznaga@oracle.com> <87pn8glwd2.fsf@x220.int.ebiederm.org> <28125570-4129-bcba-099b-f90481cfbfe8@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <28125570-4129-bcba-099b-f90481cfbfe8@oracle.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 27, 2020 at 02:00:17PM -0400, Steven Sistare wrote: > On 7/27/2020 1:07 PM, ebiederm@xmission.com wrote: > > Anthony Yznaga writes: > > > >> This patchset adds support for preserving an anonymous memory range across > >> exec(3) using a new madvise MADV_DOEXEC argument. The primary benefit for > >> sharing memory in this manner, as opposed to re-attaching to a named shared > >> memory segment, is to ensure it is mapped at the same virtual address in > >> the new process as it was in the old one. An intended use for this is to > >> preserve guest memory for guests using vfio while qemu exec's an updated > >> version of itself. By ensuring the memory is preserved at a fixed address, > >> vfio mappings and their associated kernel data structures can remain valid. > >> In addition, for the qemu use case, qemu instances that back guest RAM with > >> anonymous memory can be updated. > > > > What is wrong with using a file descriptor to a possibly deleted file > > and re-mmaping it? > > > > There is already MAP_FIXED that allows you to ensure you have the same > > address. > > MAP_FIXED blows away any existing mapping in that range, which is not the > desired behavior. We want to preserve the previously created mapping at There's also MAP_FIXED_NOREPLACE since v4.17 in case that helps. Note that this should really go to linux-api too. I won't argue to resend it since that would mean spamming everyone's inbox with the same thread again but in case you send a revised version, please ensure to Cc linux-api. The glibc folks are listening on there too. Thanks! Christian