Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1792938ybh; Mon, 20 Jul 2020 07:22:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy9gbjpZQuINNfmyzt+hnMQsqjknyQcJBKGBq0nANYpWwessgym8TpB80C/ECQRVYQSspRx X-Received: by 2002:a17:906:27c9:: with SMTP id k9mr20401802ejc.74.1595254941970; Mon, 20 Jul 2020 07:22:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595254941; cv=none; d=google.com; s=arc-20160816; b=Ur6KhSVpfDTnf5Alr1rc27YSccwoxR9OV01ohE8M8igNJUd3ycPMrGxdrm84BvzApf 4u1xevOCkbL5PKFAhoc+8RSq+VfIDQElYruwMjZbBwhHb0xVbvjkVP5XqNsNYG3+Emga WtXtsrbXG1lflXNKUzcEmDTyfrMrk1A4P9kbwKJU7vyIcNpOsQVeQouqqvXuWHCQZVS0 gxJ3iVL9Z+gXKPkm6XSBHAMbJBS7CxV73UxCmmo46WMclNgbLP+STqEQEPsdv9ecP+LO kziPv+vVZWT9BEShu9E5wTEOLoWx5BJKTFQpuBEac4U89Pqw4qqUc9n6IdI0eeSnF+9C XI/w== 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 :dkim-signature; bh=QK1OR1i4yeTISqnTTGCNFqYwZIT8k9K6IZEUGjX6ego=; b=mVg6lEao56ihfc7eMLZ8WL34iVTjOkZcPNZD5HFQoRKKSgFtHv4UXiMEKh8N4rgKFC oeen4e4r5aBs5Dtvegi/7FlMd9zwgOqMMsZYLu2JL6xeWfz7NQeBnN5h99flZTxuOlfQ fvYLPXPg2WlZMHhRFbcI1tL1bcmT+nKNdxWFa6map7/6I0oBN5mF1ToxAkm0bQOE/sHQ WiYmlBnyiqZ2r7ceAeHxy9BOjoLDqJS3M/mYkG3cr4mpt7DpcMJQQbqGSRJwhX8gDe44 pETL3haen3GNRuYR2BlQUgBSgonaYyq73wpxdOytRRwY8yI7sHtObirIitEfGFxIqwVo cKJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XQFs0H8a; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id va7si10464714ejb.55.2020.07.20.07.21.53; Mon, 20 Jul 2020 07:22:21 -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; dkim=pass header.i=@kernel.org header.s=default header.b=XQFs0H8a; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728642AbgGTOVK (ORCPT + 99 others); Mon, 20 Jul 2020 10:21:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:48780 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726759AbgGTOVK (ORCPT ); Mon, 20 Jul 2020 10:21:10 -0400 Received: from kernel.org (unknown [87.71.40.38]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 268A520B1F; Mon, 20 Jul 2020 14:20:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595254869; bh=HLsnWapSZr1TpttXIYrQQDMJGrH8nj1rqvBMPrAFCRE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=XQFs0H8abPDZJviZX+5bTqQNawGqmx/pBTGly2VfVP90WSpMzcMHYQaTLQ4IRVWLD k/TvI13Gi+NhRKv0vTnOIb6rS5YvbMFxFB2Z5aBUzsuJsDlzLpFqI8rMGY5I1SWibn SqtW927tzctc+7dbf6a1ky5SigWZ7PMcfQCFsoO4= Date: Mon, 20 Jul 2020 17:20:53 +0300 From: Mike Rapoport To: Arnd Bergmann Cc: "linux-kernel@vger.kernel.org" , Alexander Viro , Andrew Morton , Andy Lutomirski , Borislav Petkov , Catalin Marinas , Christopher Lameter , Dan Williams , Dave Hansen , Elena Reshetova , "H. Peter Anvin" , Idan Yaniv , Ingo Molnar , James Bottomley , "Kirill A. Shutemov" , Matthew Wilcox , Mike Rapoport , Palmer Dabbelt , Paul Walmsley , Peter Zijlstra , Thomas Gleixner , Tycho Andersen , Will Deacon , Linux API , linux-arch , Linux ARM , Linux FS-devel Mailing List , Linux-MM , linux-nvdimm@lists.01.org, linux-riscv , the arch/x86 maintainers , linaro-mm-sig@lists.linaro.org, Sumit Semwal Subject: Re: [PATCH 3/6] mm: introduce secretmemfd system call to create "secret" memory areas Message-ID: <20200720142053.GC8593@kernel.org> References: <20200720092435.17469-1-rppt@kernel.org> <20200720092435.17469-4-rppt@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 20, 2020 at 01:30:13PM +0200, Arnd Bergmann wrote: > On Mon, Jul 20, 2020 at 11:25 AM Mike Rapoport wrote: > > > > From: Mike Rapoport > > > > Introduce "secretmemfd" system call with the ability to create memory areas > > visible only in the context of the owning process and not mapped not only > > to other processes but in the kernel page tables as well. > > > > The user will create a file descriptor using the secretmemfd system call > > where flags supplied as a parameter to this system call will define the > > desired protection mode for the memory associated with that file > > descriptor. Currently there are two protection modes: > > > > * exclusive - the memory area is unmapped from the kernel direct map and it > > is present only in the page tables of the owning mm. > > * uncached - the memory area is present only in the page tables of the > > owning mm and it is mapped there as uncached. > > > > For instance, the following example will create an uncached mapping (error > > handling is omitted): > > > > fd = secretmemfd(SECRETMEM_UNCACHED); > > ftruncate(fd, MAP_SIZE); > > ptr = mmap(NULL, MAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, > > fd, 0); > > > > Signed-off-by: Mike Rapoport > > I wonder if this should be more closely related to dmabuf file > descriptors, which > are already used for a similar purpose: sharing access to secret memory areas > that are not visible to the OS but can be shared with hardware through device > drivers that can import a dmabuf file descriptor. TBH, I didn't think about dmabuf, but my undestanding is that is this case memory areas are not visible to the OS because they are on device memory rather than normal RAM and when dmabuf is backed by the normal RAM, the memory is visible to the OS. Did I miss anything? > Arnd -- Sincerely yours, Mike.