Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5289411yba; Wed, 8 May 2019 10:44:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqyVIFPlpDZuhIHt5kh8wNLXHXKFVsUCaXowfkc8bnZ3ybwrru6d98hJrnKxP1H6bhU+ZlkQ X-Received: by 2002:a62:1a0d:: with SMTP id a13mr33072770pfa.198.1557337484640; Wed, 08 May 2019 10:44:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557337484; cv=none; d=google.com; s=arc-20160816; b=iuAJPQ2updzJpIbd7rARPgg6ayBZP8wXllCCg+BEua/ccrNm7u3fGdulVI66sXdSrl 5RCtO59hkkt5cmZQAU4dUmDondfiyR+vha50nsl3dqApF6cRQwnrEfhBXS/t+3d7p6OQ 0b9xc1eU8n3K5u5R0KGcZT/FCgHw4H0fVEPbBYJA5B6/OGUElCwEJezI0lljAWT/ttX4 p1/SmQ3hqvQxIiFvBjM0u+Yeb2abd5qS3/l5JYQtTk2zqGN6MFtUvXjBXZAyEn4NBIYQ gX8/pcUgELQ4+E+jvT6AwZFtMnMndTQrce2c791LsqrKyUJ47eqYksnQ59qFqsZoOi7w nrbw== 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; bh=YUiV7ciEmu1VpZKDN9yq95Yz4mn5jz12GvAwo9oqPZY=; b=VbgwUL8v7WGyfM3s0TpsOslMxOwl+jvejK/ecfMPkX0AcBa4LEWB5haPyO/okUt5F0 8NVqaedBDzXh3ODSlnscS4nXS1ES/NhvJaVGfSS2sa43LiuVqjaX25IiNQH1qNTJnqUX kkUYJS9TeE+wzCrcqkNL1zQ0NVu9rtoJWKQq460H9PdG6nHNBkqxUafp0bs+UkcEacVm aHpf2CBCDkhtWFIFUHsUAxmvRvxuF4e1afj/dY6FbUHqSNBbv0NgbZEJhrgeqbbsAt4J pjSTY9WHGV0wKA96W3RZi4T6mU8YUujLywrgTF0OwkGNaF8I7wd8V/z/yJcDBiQ9+R4j VaLg== 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 j9si24369798pgh.206.2019.05.08.10.44.29; Wed, 08 May 2019 10:44:44 -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 S1728132AbfEHOtO (ORCPT + 99 others); Wed, 8 May 2019 10:49:14 -0400 Received: from mga02.intel.com ([134.134.136.20]:19899 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728371AbfEHOos (ORCPT ); Wed, 8 May 2019 10:44:48 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 May 2019 07:44:47 -0700 X-ExtLoop1: 1 Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 08 May 2019 07:44:43 -0700 Received: by black.fi.intel.com (Postfix, from userid 1000) id 6B821BD1; Wed, 8 May 2019 17:44:30 +0300 (EEST) From: "Kirill A. Shutemov" 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: [PATCH, RFC 35/62] keys/mktme: Require ACPI HMAT to register the MKTME Key Service Date: Wed, 8 May 2019 17:43:55 +0300 Message-Id: <20190508144422.13171-36-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190508144422.13171-1-kirill.shutemov@linux.intel.com> References: <20190508144422.13171-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 The ACPI HMAT will be used by the MKTME key service to identify topologies that support the safe programming of encryption keys. Those decisions will happen at key creation time and during hotplug events. To enable this, we at least need to have the ACPI HMAT present at init time. If it's not present, do not register the type. If the HMAT is not present, failure looks like this: [ ] MKTME: Registration failed. ACPI HMAT not present. Signed-off-by: Alison Schofield Signed-off-by: Kirill A. Shutemov --- security/keys/mktme_keys.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/security/keys/mktme_keys.c b/security/keys/mktme_keys.c index bcd68850048f..f5fc6cccc81b 100644 --- a/security/keys/mktme_keys.c +++ b/security/keys/mktme_keys.c @@ -2,6 +2,7 @@ /* Documentation/x86/mktme_keys.rst */ +#include #include #include #include @@ -490,6 +491,12 @@ static int __init init_mktme(void) if (mktme_nr_keyids < 1) return 0; + /* Require an ACPI HMAT to identify MKTME safe topologies */ + if (!acpi_hmat_present()) { + pr_warn("MKTME: Registration failed. ACPI HMAT not present.\n"); + return -EINVAL; + } + /* Mapping of Userspace Keys to Hardware KeyIDs */ if (mktme_map_alloc()) return -ENOMEM; -- 2.20.1