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=-5.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_MUTT autolearn=unavailable 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 B824CC31E50 for ; Sat, 15 Jun 2019 00:04:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9A87021773 for ; Sat, 15 Jun 2019 00:04:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726700AbfFOAEA (ORCPT ); Fri, 14 Jun 2019 20:04:00 -0400 Received: from mga18.intel.com ([134.134.136.126]:27174 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725981AbfFOAEA (ORCPT ); Fri, 14 Jun 2019 20:04:00 -0400 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Jun 2019 17:03:58 -0700 Received: from alison-desk.jf.intel.com ([10.54.74.53]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Jun 2019 17:03:58 -0700 Date: Fri, 14 Jun 2019 17:07:05 -0700 From: Alison Schofield To: Peter Zijlstra Cc: "Kirill A. Shutemov" , Andrew Morton , x86@kernel.org, Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Borislav Petkov , Andy Lutomirski , David Howells , Kees Cook , Dave Hansen , Kai Huang , Jacob Pan , linux-mm@kvack.org, kvm@vger.kernel.org, keyrings@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH, RFC 47/62] mm: Restrict MKTME memory encryption to anonymous VMAs Message-ID: <20190615000705.GA14860@alison-desk.jf.intel.com> References: <20190508144422.13171-1-kirill.shutemov@linux.intel.com> <20190508144422.13171-48-kirill.shutemov@linux.intel.com> <20190614115520.GH3436@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190614115520.GH3436@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Fri, Jun 14, 2019 at 01:55:20PM +0200, Peter Zijlstra wrote: > On Wed, May 08, 2019 at 05:44:07PM +0300, Kirill A. Shutemov wrote: > > From: Alison Schofield > > > > Memory encryption is only supported for mappings that are ANONYMOUS. > > Test the VMA's in an encrypt_mprotect() request to make sure they all > > meet that requirement before encrypting any. > > > > The encrypt_mprotect syscall will return -EINVAL and will not encrypt > > any VMA's if this check fails. > > > > Signed-off-by: Alison Schofield > > Signed-off-by: Kirill A. Shutemov > > This should be folded back into the initial implemention, methinks. It is part of the initial implementation. I looked for places to split the implementation into smaller, reviewable patches, hence this split. None of it gets built until the CONFIG_X86_INTEL_MKTME is introduced in a later patch. The encrypt_mprotect() patchset is ordered like this: 1) generalize mprotect to support the mktme extension 2) wire up encrypt_mprotect() 3) implement encrypt_mprotect() 4) keep reference counts on encryption keys (was VMAs) 5) (this patch) restrict to anonymous VMAs. I thought Patch 5) was a small, but meaningful split. It accentuates the fact that MKTME is restricted to anonymous memory. Alas, I want to make it logical to review, so I'll move it.