Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3121092ybi; Mon, 17 Jun 2019 17:06:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqyu0z+LE8uvFcdlpGLszOOKI3QkFf+G/0R/2GN+3i1I3T7ft90tYMXppgL7/ui/2DILM8na X-Received: by 2002:a17:90a:ab0b:: with SMTP id m11mr2010295pjq.73.1560816368896; Mon, 17 Jun 2019 17:06:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560816368; cv=none; d=google.com; s=arc-20160816; b=vOZVrhmqEwAUUut7HsdusrYr2DZ7uXk0x3oFubJEaxG/ydnYEzPyX5OIGRZ9IWX3mG Bx7KQeQo74Sl/0agCzl1H3BtAwSv/WEAa+e8bPr3uL/hst9Me38rQrzb3zHLCmN2Vf96 4hVQtTVk1x9YsXJK/APdt0ucSFVghFIqmGcZpwhCPT3G7NGatKgjR7gDPB4SwqoIe5Nk gSyfKdo5AnIYKdadH5mdTvpkWgVqXJlOjLCKNvDZt2Ryq9xm64EyYIBNiUFtg91ztCiA WUcmBjSg95mj1H5S23fkmDUR2Sz51tHYaY/q/0VfHW7SWFTYMzqrmT+bRlekoeZu39bP QAJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id; bh=P3nxrY717BKTkiVI120EuB8btH0pMUXP0qaiy/FBJKA=; b=WshFFb2glcSyIEHX64r9GYuOjPI1coqJ3jiAA4JLZYHsmid6Omjj60sg6GaN+HuYon 9M3j/s4MF45/iGupjaI1nFnhMJfLHbtebowxpwGSaQoy8nvm5pbUu7HfXTLSRtIjyUti u5b/Dy055pu1M3dNECTfuaku1DmEFCGHtHZ7XU89PGh3rqxkrfi3tM1Iqu8F3Vb4kY64 LDwLa8zNPGfQP8/6RdM11JKw4tToTJYeau7KXVCKnSFp3vc4oNnrawk31YImtfTHUfeI BD2u1lKrd49gw8afPKieUIMnhQWFOD/UlLJ2zqc49JmETVN7uNCeDGWbbQrP/rmP3ZHG eliA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 92si11363734plf.299.2019.06.17.17.05.52; Mon, 17 Jun 2019 17:06:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727909AbfFRAFs (ORCPT + 99 others); Mon, 17 Jun 2019 20:05:48 -0400 Received: from mga04.intel.com ([192.55.52.120]:49795 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726568AbfFRAFs (ORCPT ); Mon, 17 Jun 2019 20:05:48 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Jun 2019 17:05:47 -0700 X-ExtLoop1: 1 Received: from khuang2-desk.gar.corp.intel.com ([10.255.91.82]) by fmsmga008.fm.intel.com with ESMTP; 17 Jun 2019 17:05:43 -0700 Message-ID: <1560816342.5187.63.camel@linux.intel.com> Subject: Re: [PATCH, RFC 45/62] mm: Add the encrypt_mprotect() system call for MKTME From: Kai Huang To: Andy Lutomirski , Dave Hansen Cc: "Kirill A. Shutemov" , Andrew Morton , X86 ML , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Borislav Petkov , Peter Zijlstra , David Howells , Kees Cook , Jacob Pan , Alison Schofield , Linux-MM , kvm list , keyrings@vger.kernel.org, LKML , Tom Lendacky Date: Tue, 18 Jun 2019 12:05:42 +1200 In-Reply-To: References: <20190508144422.13171-1-kirill.shutemov@linux.intel.com> <20190508144422.13171-46-kirill.shutemov@linux.intel.com> <3c658cce-7b7e-7d45-59a0-e17dae986713@intel.com> <5cbfa2da-ba2e-ed91-d0e8-add67753fc12@intel.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.24.6 (3.24.6-1.fc26) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2019-06-17 at 12:12 -0700, Andy Lutomirski wrote: > On Mon, Jun 17, 2019 at 11:37 AM Dave Hansen wrote: > > > > Tom Lendacky, could you take a look down in the message to the talk of > > SEV? I want to make sure I'm not misrepresenting what it does today. > > ... > > > > > > > > I actually don't care all that much which one we end up with. It's not > > > > like the extra syscall in the second options means much. > > > > > > The benefit of the second one is that, if sys_encrypt is absent, it > > > just works. In the first model, programs need a fallback because > > > they'll segfault of mprotect_encrypt() gets ENOSYS. > > > > Well, by the time they get here, they would have already had to allocate > > and set up the encryption key. I don't think this would really be the > > "normal" malloc() path, for instance. > > > > > > How do we > > > > eventually stack it on top of persistent memory filesystems or Device > > > > DAX? > > > > > > How do we stack anonymous memory on top of persistent memory or Device > > > DAX? I'm confused. > > > > If our interface to MKTME is: > > > > fd = open("/dev/mktme"); > > ptr = mmap(fd); > > > > Then it's hard to combine with an interface which is: > > > > fd = open("/dev/dax123"); > > ptr = mmap(fd); > > > > Where if we have something like mprotect() (or madvise() or something > > else taking pointer), we can just do: > > > > fd = open("/dev/anything987"); > > ptr = mmap(fd); > > sys_encrypt(ptr); > > I'm having a hard time imagining that ever working -- wouldn't it blow > up if someone did: > > fd = open("/dev/anything987"); > ptr1 = mmap(fd); > ptr2 = mmap(fd); > sys_encrypt(ptr1); > > So I think it really has to be: > fd = open("/dev/anything987"); > ioctl(fd, ENCRYPT_ME); > mmap(fd); This requires "/dev/anything987" to support ENCRYPT_ME ioctl, right? So to support NVDIMM (DAX), we need to add ENCRYPT_ME ioctl to DAX? > > But I really expect that the encryption of a DAX device will actually > be a block device setting and won't look like this at all. It'll be > more like dm-crypt except without device mapper. Are you suggesting not to support MKTME for DAX, or adding MKTME support to dm-crypt? Thanks, -Kai