Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1188084rwi; Wed, 19 Oct 2022 07:41:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4CBpJbebFt8vWPQoNx9f3Ax5bhMTNT+e3/IBnw4l04ZoP8BcumU/MK+hh96XIvgeCsZPBK X-Received: by 2002:aa7:d306:0:b0:459:6e9:6284 with SMTP id p6-20020aa7d306000000b0045906e96284mr7693642edq.70.1666190474493; Wed, 19 Oct 2022 07:41:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666190474; cv=none; d=google.com; s=arc-20160816; b=EZuPh1v6UwHUfYnVD0UGA1nyw8E76ZWbe9M4U2zAulYqt7XaLJ4fvYXLhLZUDZGlxp nW8FL/fGRTzfBcMsVJz9Svs4FIA5pLgLNx2jOKCr/Ayk3jgJA3k+xa486wyjrjduAGj3 p8AjI0cWBodSiTtIYjrOGjIG14G2bHjmTP6D4MfdYHXBFFJ32DRn03Eav/vVLg+unpeo ybQj4myAcuBB46a1QX3rf3R19QxEq480dnAMLb9qkSm6dL0HTUTTJyCOgJmuofju56UV ORs76h+CRvzadTK+L4jMtuD/Qlb8G1gD2tQxwbsjzZ1MyTkkSsN79UrNrKiM7qzfK+25 Ef1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=ZYlo4aSdnNnEAh/dxPH/ZApKTFUaYIPsaLIT4suSCzI=; b=JqS2k2Sd8hb5/9zCDoAiosgg0Njp7+0QkY0g+H25tI+HiwdvzHsXUmubxkYLCYzo2u YerYFkhJyW0c5FYpre62jmWjGzzOflUZJtwrbjy5YRBYUvmnTTJizr1jSA/wPQ34FL8/ OXR12DAd5rPH5tDuTF3+rlH6Z5qdh06D08aZAxy76t7jUrifIGwmPCvOhtHWEjBS0fRL OK8ZDafQ02q58iPSfEsy3PGx7+SBVBZJHaEytnT4oAwGjtU4zCCKLQR27JJyAchhWg1Z JI27zAvHnDe1xBt2Ev3XT/roYsBzJdFuNYVA3vgphoSB/7RupWYeqzq4iwsysNtL/B0s Oh1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=jjhzCoBC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b15-20020a056402350f00b0044ee4ec8915si16639092edd.39.2022.10.19.07.40.47; Wed, 19 Oct 2022 07:41:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=jjhzCoBC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233738AbiJSNw7 (ORCPT + 99 others); Wed, 19 Oct 2022 09:52:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233595AbiJSNwI (ORCPT ); Wed, 19 Oct 2022 09:52:08 -0400 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EBC2185422; Wed, 19 Oct 2022 06:35:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666186557; x=1697722557; h=date:from:to:cc:subject:message-id:reply-to:references: mime-version:in-reply-to; bh=4xcGc4T12PBypY/VcZfHNkEly5yZ/s7CT5KUy36zg78=; b=jjhzCoBCsLf8VUs0R+QfGydIe7QYMFm556unX6I3R1DhSqiZ6WdqdGVa b58y8RqAbpOUVWcVU80uo6UdKSAEaP58z78cTXYknf8jnPI1EPw1Ko8CS 9P4GSLacFbYoEP5y0IdzcamCNPNMyiKLNICDGy3Sb384VgKaZcR10bNVB RA8w2ffKnvwlH2hIji1lwf7aova5NGJGlNbXdroBiWEj3jQJb4F+KSwx+ P8m2wZLALph4TDFXT2aZIqb6t4vHFkYos0euU2OjLo9a0tQGtZztObxhN m5uvSoc3lGKdeFUgCz0ogBy9KOvVgmRg9BL0ZqEQxRM9EEY9rXf4luzXk Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10505"; a="286801355" X-IronPort-AV: E=Sophos;i="5.95,196,1661842800"; d="scan'208";a="286801355" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Oct 2022 06:35:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10505"; a="624137726" X-IronPort-AV: E=Sophos;i="5.95,196,1661842800"; d="scan'208";a="624137726" Received: from chaop.bj.intel.com (HELO localhost) ([10.240.193.75]) by orsmga007.jf.intel.com with ESMTP; 19 Oct 2022 06:35:14 -0700 Date: Wed, 19 Oct 2022 21:30:43 +0800 From: Chao Peng To: Fuad Tabba Cc: Sean Christopherson , David Hildenbrand , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org, linux-doc@vger.kernel.org, qemu-devel@nongnu.org, Paolo Bonzini , Jonathan Corbet , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H . Peter Anvin" , Hugh Dickins , Jeff Layton , "J . Bruce Fields" , Andrew Morton , Shuah Khan , Mike Rapoport , Steven Price , "Maciej S . Szmigiero" , Vlastimil Babka , Vishal Annapurve , Yu Zhang , "Kirill A . Shutemov" , luto@kernel.org, jun.nakajima@intel.com, dave.hansen@intel.com, ak@linux.intel.com, aarcange@redhat.com, ddutile@redhat.com, dhildenb@redhat.com, Quentin Perret , Michael Roth , mhocko@suse.com, Muchun Song , wei.w.wang@intel.com, Will Deacon , Marc Zyngier Subject: Re: [PATCH v8 1/8] mm/memfd: Introduce userspace inaccessible memfd Message-ID: <20221019133043.GB3496045@chaop.bj.intel.com> Reply-To: Chao Peng References: <20220926142330.GC2658254@chaop.bj.intel.com> <20221013133457.GA3263142@chaop.bj.intel.com> <20221017145856.GB3417432@chaop.bj.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 17, 2022 at 08:05:10PM +0100, Fuad Tabba wrote: > Hi, > > > > > Using both private_fd and userspace_addr is only needed in TDX and other > > > > confidential computing scenarios, pKVM may only use private_fd if the fd > > > > can also be mmaped as a whole to userspace as Sean suggested. > > > > > > That does work in practice, for now at least, and is what I do in my > > > current port. However, the naming and how the API is defined as > > > implied by the name and the documentation. By calling the field > > > private_fd, it does imply that it should not be mapped, which is also > > > what api.rst says in PATCH v8 5/8. My worry is that in that case pKVM > > > would be mis/ab-using this interface, and that future changes could > > > cause unforeseen issues for pKVM. > > > > That is fairly enough. We can change the naming and the documents. > > > > > > > > Maybe renaming this to something like "guest_fp", and specifying in > > > the documentation that it can be restricted, e.g., instead of "the > > > content of the private memory is invisible to userspace" something > > > along the lines of "the content of the guest memory may be restricted > > > to userspace". > > > > Some other candidates in my mind: > > - restricted_fd: to pair with the mm side restricted_memfd > > - protected_fd: as Sean suggested before > > - fd: how it's explained relies on the memslot.flag. > > All these sound good, since they all capture the potential use cases. > Restricted might be the most logical choice if that's going to also > become the name for the mem_fd. Thanks, I will use 'restricted' for them. e.g.: - memfd_restricted() syscall - restricted_fd - restricted_offset The memslot flags will still be KVM_MEM_PRIVATE, since I think pKVM will create its own one? Chao > > Thanks, > /fuad > > > Thanks, > > Chao > > > > > > What do you think? > > > > > > Cheers, > > > /fuad > > > > > > > > > > > Thanks, > > > > Chao > > > > > > > > > > Cheers, > > > > > /fuad