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=-4.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 1D1E0C433E3 for ; Tue, 28 Jul 2020 14:23:21 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CF81020663 for ; Tue, 28 Jul 2020 14:23:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=amacapital-net.20150623.gappssmtp.com header.i=@amacapital-net.20150623.gappssmtp.com header.b="D7/86MC1" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CF81020663 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amacapital.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 522D36B0085; Tue, 28 Jul 2020 10:23:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4AD076B0088; Tue, 28 Jul 2020 10:23:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 373B56B0089; Tue, 28 Jul 2020 10:23:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0243.hostedemail.com [216.40.44.243]) by kanga.kvack.org (Postfix) with ESMTP id 1ECD76B0085 for ; Tue, 28 Jul 2020 10:23:20 -0400 (EDT) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id C719E1EF3 for ; Tue, 28 Jul 2020 14:23:19 +0000 (UTC) X-FDA: 77087702118.13.stamp85_071859826f6a Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin13.hostedemail.com (Postfix) with ESMTP id 90ADC18140B7B for ; Tue, 28 Jul 2020 14:23:08 +0000 (UTC) X-HE-Tag: stamp85_071859826f6a X-Filterd-Recvd-Size: 4666 Received: from mail-pj1-f67.google.com (mail-pj1-f67.google.com [209.85.216.67]) by imf31.hostedemail.com (Postfix) with ESMTP for ; Tue, 28 Jul 2020 14:23:07 +0000 (UTC) Received: by mail-pj1-f67.google.com with SMTP id k1so11665359pjt.5 for ; Tue, 28 Jul 2020 07:23:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amacapital-net.20150623.gappssmtp.com; s=20150623; h=content-transfer-encoding:from:mime-version:subject:date:message-id :references:cc:in-reply-to:to; bh=0gezrYAszKsYKcLXi9TMmF45AfpArZp7tf2tQTcsIB4=; b=D7/86MC1Tqp9oc0VICIhfafxb3tBKrlVgTQgo74JcMWGNVZjzmkRkSPO+UaELTUEwa hA2GW+HERh5M2odXF3L1QZNAFFoTOnxCUqDuUqd+xD54MgRqydkWiLasAWQmucuiUX9y /HA6vqfiAYDwCMBvJQPsnzD96xliQ3O0e++hOjll/2Z5APzOuNu7gH9zfRs4jk1u/4VI 49V7Y+MZGeI3h+zO6gZkKACbWgKi3SBDGtM0OP0OKRBoHDlHCLafa/fTo8q2s2AnY2mL fhpECbWQwe8VhAil1beOIe84mykJJtKhpx/KmcnDNs3QlX6d51VI87/q+vivCNN/VjqH 7mig== 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=0gezrYAszKsYKcLXi9TMmF45AfpArZp7tf2tQTcsIB4=; b=B8mcmdpMdFXJRW5yX/F1IYzSeNjs9a/jpNVQBV4rxPoZUJrkscG1hx3KTT0l2vHEx0 TxSpbIaoLcBAdIpOHO/vS+6ImT4aeFtJjXxscaE7WVY0RAJCXnugDPRgdmPn5T657NIx B1Izjr/++BXvN4qfLQVEg4eg2Q7lbnl1OJHp2wODb+k/8ltwx8lSd6+JfNxQN7zSyE3Z uZ/AgFp75dobca6gary/x0sf5CPMPYHWoRk+LgRnKiyQbV/hCHqdDpBrlhuR7dhU3br8 v6IiCSxxkd8gz+ShVfmppIlNKzzXK1cPn7ZmXthhKZ+cPtmXd5U6q7YC+gK3NnIMpQDk rG9A== X-Gm-Message-State: AOAM531BniFg/BH6WebAf9wIezAQKGDEn+YaQfzRBLAg0/5hOeX/X0BT YSuvnvV9liVnd1k1Q7SGnL95xg== X-Google-Smtp-Source: ABdhPJwGmlsbEVuJXdrA5FyCMv/IW/fPnSTAHwkj6VyQa14OnWq1IW5Sje+yw0TWIJZrFoMkdQtvhw== X-Received: by 2002:a17:90a:ce0c:: with SMTP id f12mr4957417pju.19.1595946186974; Tue, 28 Jul 2020 07:23:06 -0700 (PDT) Received: from ?IPv6:2601:646:c200:1ef2:1c3a:e74b:bd16:b3ab? ([2601:646:c200:1ef2:1c3a:e74b:bd16:b3ab]) by smtp.gmail.com with ESMTPSA id 4sm18047374pgk.68.2020.07.28.07.23.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 28 Jul 2020 07:23:06 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Andy Lutomirski Mime-Version: 1.0 (1.0) Subject: Re: [RFC PATCH 0/5] madvise MADV_DOEXEC Date: Tue, 28 Jul 2020 07:23:03 -0700 Message-Id: <1764B08C-CC1E-4636-944A-DB95B81C7A8E@amacapital.net> References: <1595869887-23307-1-git-send-email-anthony.yznaga@oracle.com> Cc: 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, ebiederm@xmission.com, keescook@chromium.org, gerg@linux-m68k.org, ktkhai@virtuozzo.com, christian.brauner@ubuntu.com, peterz@infradead.org, esyr@redhat.com, jgg@ziepe.ca, christian@kellner.me, areber@redhat.com, cyphar@cyphar.com, steven.sistare@oracle.com In-Reply-To: <1595869887-23307-1-git-send-email-anthony.yznaga@oracle.com> To: Anthony Yznaga X-Mailer: iPhone Mail (17F80) X-Rspamd-Queue-Id: 90ADC18140B7B X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: > On Jul 27, 2020, at 10:02 AM, Anthony Yznaga w= rote: >=20 > =EF=BB=BFThis patchset adds support for preserving an anonymous memory ran= ge 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 share= d > 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 wit= h > anonymous memory can be updated. This will be an amazing attack surface. Perhaps use of this flag should requ= ire no_new_privs? Arguably it should also require a special flag to execve(= ) to honor it. Otherwise library helpers that do vfork()+exec() or posix_sp= awn() could be quite surprised.