Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3151769ybi; Mon, 17 Jun 2019 17:49:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqw1BfBUkKlhg7J+mOXeZT5OpN9IWj38y72ma7QIAZhvgOfuBlm4peBZAwmDUwHKFCOqifG2 X-Received: by 2002:a17:902:8a87:: with SMTP id p7mr93951285plo.124.1560818957855; Mon, 17 Jun 2019 17:49:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560818957; cv=none; d=google.com; s=arc-20160816; b=pUJWtr/koT6T9riDPWPF7IbojdgmTsRcJCVBi6FSkwvtAAuj61L1V9T6eyAjBaa8Y5 buBQjVm2dKMhHdbiLUT6CNvwunfLqN8mlxP7b3fD4M3nXvm7RmXqTbTYUNYXJ0+KOWK8 I+xIJTredrbyayi9dCyKEvncmhAVbp6yjpbEFZeE6sdRjEbepX5smrCSxvdO4Map9/LW cdBOxTwdQxeAYg81H50VcjsqkghQi+eZSu7BlIr8S1vQTuVh93Pf/ZZUXRu6jFgjwrcx DBci9DN3MmWU70byFTHWbPPJkD9jZVCnud2gLF2CilalNT0TWYbXLAkbVEGKUH8w3up2 Xu5A== 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=x1IIyy853VWmbMFvPrJ8ctqrhILgMGwYO0QwBpaQk00=; b=qp53am2A3IzKFst12EgXHZjN/TNnvAKP7ZM0piNhBOeXTEVqpRGFns4MRYl6RQk1no JkrGd8bQ/5gg0XITlsN4renGyaqccNmNWWgtIypJ/DPI4wSXEbjHiuj8t5OVRxOw1fa+ 9tM7KqCu8UkvPqMcgyULz5hlzZwSWbLpIHePsp9oo12nqLH6PwAd4Xs5PJunThdVT97s 2B4TAwirVlAwcqcFd/se63XokaV0uD4rUCTdmZqGiVioV946yg7eZhBy34cM/P4NS5eN CFmFEXotruGa7NiNoExmYXyOMwzAIiJQIqFK83Z1GYv9/YtwVRIbKmtlYOsidBayN3hf +pLw== 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 l125si11005706pgl.63.2019.06.17.17.49.01; Mon, 17 Jun 2019 17:49:17 -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 S1726542AbfFRAs5 (ORCPT + 99 others); Mon, 17 Jun 2019 20:48:57 -0400 Received: from mga18.intel.com ([134.134.136.126]:15204 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725829AbfFRAs4 (ORCPT ); Mon, 17 Jun 2019 20:48:56 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Jun 2019 17:48:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,386,1557212400"; d="scan'208";a="185930070" Received: from khuang2-desk.gar.corp.intel.com ([10.255.91.82]) by fmsmga002.fm.intel.com with ESMTP; 17 Jun 2019 17:48:52 -0700 Message-ID: <1560818931.5187.70.camel@linux.intel.com> Subject: Re: [PATCH, RFC 45/62] mm: Add the encrypt_mprotect() system call for MKTME From: Kai Huang To: Dave Hansen , Andy Lutomirski 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:48:51 +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 > > > And another silly argument: if we had /dev/mktme, then we could > > possibly get away with avoiding all the keyring stuff entirely. > > Instead, you open /dev/mktme and you get your own key under the hook. > > If you want two keys, you open /dev/mktme twice. If you want some > > other program to be able to see your memory, you pass it the fd. > > We still like the keyring because it's one-stop-shopping as the place > that *owns* the hardware KeyID slots. Those are global resources and > scream for a single global place to allocate and manage them. The > hardware slots also need to be shared between any anonymous and > file-based users, no matter what the APIs for the anonymous side. MKTME driver (who creates /dev/mktme) can also be the one-stop-shopping. I think whether to choose keyring to manage MKTME key should be based on whether we need/should take advantage of existing key retention service functionalities. For example, with key retention service we can revoke/invalidate/set expiry for a key (not sure whether MKTME needs those although), and we have several keyrings -- thread specific keyring, process specific keyring, user specific keyring, etc, thus we can control who can/cannot find the key, etc. I think managing MKTME key in MKTME driver doesn't have those advantages. Thanks, -Kai