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=-7.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,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 7D58DC35257 for ; Wed, 16 Sep 2020 18:49:44 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F3CCB21974 for ; Wed, 16 Sep 2020 18:49:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="A8v0KRNu" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F3CCB21974 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 32515900008; Wed, 16 Sep 2020 14:49:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2D379900007; Wed, 16 Sep 2020 14:49:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1C337900008; Wed, 16 Sep 2020 14:49:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0042.hostedemail.com [216.40.44.42]) by kanga.kvack.org (Postfix) with ESMTP id 00611900007 for ; Wed, 16 Sep 2020 14:49:42 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id B841A181AEF23 for ; Wed, 16 Sep 2020 18:49:42 +0000 (UTC) X-FDA: 77269813404.20.work25_6014ce12711c Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin20.hostedemail.com (Postfix) with ESMTP id 83AB5180C07AB for ; Wed, 16 Sep 2020 18:49:42 +0000 (UTC) X-HE-Tag: work25_6014ce12711c X-Filterd-Recvd-Size: 5433 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf08.hostedemail.com (Postfix) with ESMTP for ; Wed, 16 Sep 2020 18:49:41 +0000 (UTC) Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 71A7220809 for ; Wed, 16 Sep 2020 18:49:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600282180; bh=16sTH0SegakzZKBjY8U3FsytaAxRFzwi1y28PIc8vKg=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=A8v0KRNufPmq2ID94lvuAYBLHSHS5ug/gBN4O948j2OLRL/yNp7TGrcaoMc8dhzbO gakR5PNyJc34jx5b5aXJZqOG+ECqvTX6r+JpS79zCVia6YDkI+sbXhF5mFPtKxxwmH lKt5qdjIMkNtCN34jJEvfHrZYNfN+/RBAbfSnBT8= Received: by mail-lf1-f50.google.com with SMTP id q8so8096363lfb.6 for ; Wed, 16 Sep 2020 11:49:40 -0700 (PDT) X-Gm-Message-State: AOAM5303cLdnH7CNZ4EtoAggReP5/rr9jfbbUDlV5+3PKWPisXc7m8NW pNkscHPkcVF62u2KEeS0j8RPtA699xJDT/VPYeK7pA== X-Google-Smtp-Source: ABdhPJwUX3bHQLCL84qG4wIC/JlN+nYNkgmXwAB8lo/1k8NF8oo4sGXt7L/6GSwGvTFkR4oICcgx71syaFhCR+ehMOk= X-Received: by 2002:a5d:5111:: with SMTP id s17mr28001448wrt.70.1600282177590; Wed, 16 Sep 2020 11:49:37 -0700 (PDT) MIME-Version: 1.0 References: <20200916072842.3502-1-rppt@kernel.org> In-Reply-To: <20200916072842.3502-1-rppt@kernel.org> From: Andy Lutomirski Date: Wed, 16 Sep 2020 11:49:25 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v5 0/5] mm: introduce memfd_secret system call to create "secret" memory areas To: Mike Rapoport Cc: Andrew Morton , Alexander Viro , Andy Lutomirski , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Christopher Lameter , Dan Williams , Dave Hansen , David Hildenbrand , Elena Reshetova , "H. Peter Anvin" , Idan Yaniv , Ingo Molnar , James Bottomley , "Kirill A. Shutemov" , Matthew Wilcox , Mark Rutland , Mike Rapoport , Michael Kerrisk , Palmer Dabbelt , Paul Walmsley , Peter Zijlstra , Thomas Gleixner , Tycho Andersen , Will Deacon , Linux API , linux-arch , linux-arm-kernel , Linux FS Devel , Linux-MM , LKML , linux-nvdimm , linux-riscv@lists.infradead.org, X86 ML Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 83AB5180C07AB X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 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 Wed, Sep 16, 2020 at 12:28 AM Mike Rapoport wrote: > > From: Mike Rapoport > > Hi, > > This is an implementation of "secret" mappings backed by a file descriptor. > I've dropped the boot time reservation patch for now as it is not strictly > required for the basic usage and can be easily added later either with or > without CMA. > > v5 changes: > * rebase on v5.9-rc5 > * drop boot time memory reservation patch > > v4 changes: > * rebase on v5.9-rc1 > * Do not redefine PMD_PAGE_ORDER in fs/dax.c, thanks Kirill > * Make secret mappings exclusive by default and only require flags to > memfd_secret() system call for uncached mappings, thanks again Kirill :) > > v3 changes: > * Squash kernel-parameters.txt update into the commit that added the > command line option. > * Make uncached mode explicitly selectable by architectures. For now enable > it only on x86. > > v2 changes: > * Follow Michael's suggestion and name the new system call 'memfd_secret' > * Add kernel-parameters documentation about the boot option > * Fix i386-tinyconfig regression reported by the kbuild bot. > CONFIG_SECRETMEM now depends on !EMBEDDED to disable it on small systems > from one side and still make it available unconditionally on > architectures that support SET_DIRECT_MAP. > > The file descriptor backing secret memory mappings is created using a > dedicated memfd_secret system call The desired protection mode for the > memory is configured using flags parameter of the system call. The mmap() > of the file descriptor created with memfd_secret() will create a "secret" > memory mapping. The pages in that mapping will be marked as not present in > the direct map and will have desired protection bits set in the user page > table. For instance, current implementation allows uncached mappings. I still have serious concerns with uncached mappings. I'm not saying I can't be convinced, but I'm not currently convinced that we should allow user code to create UC mappings on x86. --Andy