Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp6109064ybi; Wed, 31 Jul 2019 08:29:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqwxPzH48B+XclC4bjEzZ/e5ZqT55JZku1OOi/PFAcxGTcWmqL3EJj77JAIaDsAcXhsKqUVG X-Received: by 2002:a63:4c5a:: with SMTP id m26mr112480961pgl.270.1564586955333; Wed, 31 Jul 2019 08:29:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564586955; cv=none; d=google.com; s=arc-20160816; b=ppJUKUFuC6oDFkE19vBpcWbWvModwopW9L1pgAvrzAO8WhWA2jnLoqwSeTpuC2EOkB 22OQ4H3wyDZGWl252fyWTBgNMLzhNMnVybe5uzhblX3IFp43H1iWvCmcRlhNr3/l6Mj4 tKHhG+PowphRapjb+OIifOByZ3T8Qv19f/K3zFoyGx6nE5jVNFlz/iu6jykYi2Dy32EA IW9neQopgIb+7QwA/F2UdCkwGQ9oD5hSfCr/fzHFgpvKPEp6xQSHXM9nMBvStVsfeHae YuK2MphtwkXO9yom01hvfNOqHiD2ieJUf48WpU9JwBZCgrBgMKoO16HezmO6T/0pm3kb l1sg== 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:message-id:date:subject:cc:to:from :dkim-signature; bh=WTAAjTsK3+3w7eSPHsyJf/zyVQM+N+66EXtK8GvqGh0=; b=X/MDR3MpyVP745wPUZNWEpzK2iqEFRlFiqCNwv+MaoYX40J5wQrJokvCagoV7h4df/ DYYfu8RqAhnettzC9ghpqEhFREQEcbRTzGPxvTsHCOpJHv0hBFIZDrdY2yKyXBPaBSxH 6/u5kcxz0vwyR2aMv3W1geJo+nscJ3K04ONtmfL3f+56bTHJpLrPP779bThXRy9CqwSt i/jM7Eq/hwGZwINlPlXfwKwp1rfdfic59xeEp0XZ0grT5cU4/1ot9a0WIQg7RCZdf3Xh 3NN+hD99+MtRDvdjVtmBOg6WCqkxrfWcVBGvLSE0lsySDaiWulGv9aN8mBVV/hJY7qmj PTlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=vHCm2eeu; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 11si30784839pla.248.2019.07.31.08.28.59; Wed, 31 Jul 2019 08:29:15 -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; dkim=pass header.i=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=vHCm2eeu; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727512AbfGaPTq (ORCPT + 99 others); Wed, 31 Jul 2019 11:19:46 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:38276 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729675AbfGaPTo (ORCPT ); Wed, 31 Jul 2019 11:19:44 -0400 Received: by mail-ed1-f66.google.com with SMTP id r12so31255799edo.5 for ; Wed, 31 Jul 2019 08:19:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WTAAjTsK3+3w7eSPHsyJf/zyVQM+N+66EXtK8GvqGh0=; b=vHCm2eeuCUQs2yHSeXWs6297E3LD/DJ3yKHjxnQ3uS38oTOhZMWNOL2t2b8qyqezCd TSyHJ2nZIkIp+xozfa1fMkbPHgLyD07pzVHXY1r0RJbOqJQjIa59zY+kzkFpFK+i6bAm u2IRsUZJ7qr8muyrOi/vvs1sPIHYD5F+Sz93KlJmSVBGUVMoNkaJnWL0flwcUWdk1Rd+ pJLhMUZ1mXkr512XbgaOmHVFaepWq9DNGGdxUvxD97xw+4EXINwjigBZSkDbyOrFGk9v coI9yYfL7DOZadkWb+EyLWXGslgUVJIufSy67o3yRyMY9W/s+uFsbxg0YK6+eu5onsz9 Qs2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WTAAjTsK3+3w7eSPHsyJf/zyVQM+N+66EXtK8GvqGh0=; b=gcfHMi5JCL0wTC3ImRN6CVyLIGLGhAsOI9n+JNkUdwuutG9PftTy3bynzX4ReSqxq+ vGRr5awz+wgS2ks0y22VuFgKf+TWCR83BKBe1YNrDZBY4ZhhFQiZadV4R2kE1yz6VJXA K8BXIzxUZN3GcI3bL4ZkqiAxtwcR88i/QMPJw8LQgojI4dtD9eXOwTAL5THX3NHxU1M7 VqetmoOIgxJRdOvpu1v/k823odslUR01twD9gI/Lkadh4h+e0AtFMel+SIt0ZoYYlw7r Js9zjObq6nLnXaL9ASVasHCpLEn2Sy3/WgX5eoL5Z8iKigYGsurdI+XIG2rOKm11/rSX cCKg== X-Gm-Message-State: APjAAAWdEJdQLfSRLclaZt0NhM1psGxtZzMqJqgn54ATfTH7rV26rrvl YHM1JPfjzEWeQx47EmL2PuY= X-Received: by 2002:a50:9153:: with SMTP id f19mr109455097eda.70.1564586035945; Wed, 31 Jul 2019 08:13:55 -0700 (PDT) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id q56sm17022134eda.28.2019.07.31.08.13.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 31 Jul 2019 08:13:53 -0700 (PDT) From: "Kirill A. Shutemov" X-Google-Original-From: "Kirill A. Shutemov" Received: by box.localdomain (Postfix, from userid 1000) id 87A6F1048A9; Wed, 31 Jul 2019 18:08:17 +0300 (+03) To: Andrew Morton , x86@kernel.org, Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Borislav Petkov , Peter Zijlstra , Andy Lutomirski , David Howells Cc: Kees Cook , Dave Hansen , Kai Huang , Jacob Pan , Alison Schofield , linux-mm@kvack.org, kvm@vger.kernel.org, keyrings@vger.kernel.org, linux-kernel@vger.kernel.org, "Kirill A . Shutemov" Subject: [PATCHv2 57/59] x86/mktme: Document the MKTME Key Service API Date: Wed, 31 Jul 2019 18:08:11 +0300 Message-Id: <20190731150813.26289-58-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190731150813.26289-1-kirill.shutemov@linux.intel.com> References: <20190731150813.26289-1-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alison Schofield Signed-off-by: Alison Schofield Signed-off-by: Kirill A. Shutemov --- Documentation/x86/mktme/index.rst | 1 + Documentation/x86/mktme/mktme_keys.rst | 61 ++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 Documentation/x86/mktme/mktme_keys.rst diff --git a/Documentation/x86/mktme/index.rst b/Documentation/x86/mktme/index.rst index 0f021cc4a2db..8cf2b7d62091 100644 --- a/Documentation/x86/mktme/index.rst +++ b/Documentation/x86/mktme/index.rst @@ -8,3 +8,4 @@ Multi-Key Total Memory Encryption (MKTME) mktme_overview mktme_mitigations mktme_configuration + mktme_keys diff --git a/Documentation/x86/mktme/mktme_keys.rst b/Documentation/x86/mktme/mktme_keys.rst new file mode 100644 index 000000000000..5d9125eb7950 --- /dev/null +++ b/Documentation/x86/mktme/mktme_keys.rst @@ -0,0 +1,61 @@ +MKTME Key Service API +===================== +MKTME is a new key service type added to the Linux Kernel Key Service. + +The MKTME Key Service type is available when CONFIG_X86_INTEL_MKTME is +turned on in Intel platforms that support the MKTME feature. + +The MKTME Key Service type manages the allocation of hardware encryption +keys. Users can request an MKTME type key and then use that key to +encrypt memory with the encrypt_mprotect() system call. + +Usage +----- + When using the Kernel Key Service to request an *mktme* key, + specify the *payload* as follows: + + type= + *cpu* User requests a CPU generated encryption key. + The CPU generates and assigns an ephemeral key. + + *no-encrypt* + User requests that hardware does not encrypt + memory when this key is in use. + + algorithm= + When type=cpu the algorithm field must be *aes-xts-128* + *aes-xts-128* is the only supported encryption algorithm + + When type=no-encrypt the algorithm field must not be + present in the payload. + +ERRORS +------ + In addition to the Errors returned from the Kernel Key Service, + add_key(2) or keyctl(1) commands, the MKTME Key Service type may + return the following errors: + + EINVAL for any payload specification that does not match the + MKTME type payload as defined above. + + EACCES for access denied. The MKTME key type uses capabilities + to restrict the allocation of keys to privileged users. + CAP_SYS_RESOURCE is required, but it will accept the + broader capability of CAP_SYS_ADMIN. See capabilities(7). + + ENOKEY if a hardware key cannot be allocated. Additional error + messages will describe the hardware programming errors. + +EXAMPLES +-------- + Add a 'cpu' type key:: + + char \*options_CPU = "type=cpu algorithm=aes-xts-128"; + + key = add_key("mktme", "name", options_CPU, strlen(options_CPU), + KEY_SPEC_THREAD_KEYRING); + + Add a "no-encrypt' type key:: + + key = add_key("mktme", "name", "no-encrypt", strlen(options_CPU), + KEY_SPEC_THREAD_KEYRING); -- 2.21.0