Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp935426img; Mon, 18 Mar 2019 18:36:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqwtpOvgpUgBO3vcvmpb+fkM3gVOJQGEdr9Y962LyUoqgrFEfqrmJkx5s7TgK857Uhd2Yri9 X-Received: by 2002:a63:2224:: with SMTP id i36mr20327667pgi.169.1552959409751; Mon, 18 Mar 2019 18:36:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552959409; cv=none; d=google.com; s=arc-20160816; b=ONRIbbvV497AgUn1AhzoNtzHweVsr3DO2Crue/Cj5AnfY1SWtjsxnK1pk3D3S9//up RXGqjzb7tWiL0FXphtvI9uvzx25DWLwvHkrmMGKpWabXsssDp16Mr0ibehkhBXM18uje cKM4Lz4AhE9uNZNF6QeEeReCLDzeSqvvoH+zBUp/BbyqGA965pQfB7i6i+X/AfadMW06 Zaeqs/UZaDLsnVxwEpuPv5fjhiISbV70/Wz/2mvhzwOjNKiX2UKIMF8Okni7fJdhh7Li O+RYNeIW3iVe8FLEUkG3jCWu+1i4O80rbZoeBfbCLe4pAgM7u82o3bKweYBjYXz8di14 cbaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=5gjlT8OQaj+zANY5Ff3tbHET/g62FgpUzmpkq4hhTUU=; b=a7k7pKw637Ts+q23+vjXNzqvWRYt4DApbJVaFRAaEhFLdc4w9AyAYevldY3Ivl2CW+ o+H4Ceqr85um0xpWEZcJuHm2p6gQD3SLmL/O+BZP5V9hpS8PUC8PR56vJh6roPd98Uct 67RUREszY+qMl/zASiO1iox2t8WrI4yS7rQD0l+OuYQJ2T+PMM2BrdT1Os4lWY6yaA6o XYVRnXITuZAoGeSBKuIUH4obgZAI7GCNciBkhkUReJ5dI/dlS33lN5kMN8eY+TZOit50 kAoW45QI22kkAHDkrIYaqQboIblt7sy4r7/P+z4GXmpe3e7Xg+YL7wDLsNt+EY9SMVXB 2iGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=MsTWk0hi; 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 2si10900641pfd.129.2019.03.18.18.36.33; Mon, 18 Mar 2019 18:36:49 -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=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=MsTWk0hi; 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 S1727408AbfCSBeP (ORCPT + 99 others); Mon, 18 Mar 2019 21:34:15 -0400 Received: from mail-ot1-f67.google.com ([209.85.210.67]:33113 "EHLO mail-ot1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726743AbfCSBeO (ORCPT ); Mon, 18 Mar 2019 21:34:14 -0400 Received: by mail-ot1-f67.google.com with SMTP id q24so16249237otk.0 for ; Mon, 18 Mar 2019 18:34:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=5gjlT8OQaj+zANY5Ff3tbHET/g62FgpUzmpkq4hhTUU=; b=MsTWk0hiLZWkz3w5cbGtEn6/21AsM7UXvSiGHO3hbB1yqk0i0GQOH5PcEPKBuzs+eI R+orEs9omeii5U7oAJYKW5tFP5+hQbs2PPnhevT45CEERXAmjZUrhgZB72d9/AOO2yYH SzSSYYvcpk8ZyCUAaoX/lT0hZuCBlYy96ar1PuGdU+ZFJQqreJ4xLF1UxzXHR15OQ+mn YE2EyZ5tu0jITFBuZt2ZB8ht3Pmxdk8lbICidFqn2IU1zWizyKpIBE7vDlLrVUFhCewm zlEionvIv3Ij3ak2FVML5/MEbl67bsQwPjtytYoCG7f7pEcICZWDZz7QN7XN5TJBHS1Z rEoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5gjlT8OQaj+zANY5Ff3tbHET/g62FgpUzmpkq4hhTUU=; b=pXV+FQ0YeZyVtT66o4qvu8t53wrktKakaLHPLhAv4vrxZymUFNfTbLM+pza9bnCnEd M4JGFk704UUtKk0CwfdkuvHjtDVs7DafJ8qU0H7vY5ur6jH71atc5UWqxVehA2rwcKaB 22CNroogqbXXbjlMjAY+7WN8oOCbKSmINHCPXeP090tEM5W8ogZuq/XUV7FUqrW25axJ /7kr5YfSnwk8BqeqFyFh1w4TX2WJiRIIKffs1sV9RCybqwGLo4Gc3stet19QV0oIVSmO rPTIeB4qseRNy8vIQN06rEPWTuZc6lzeM6EnJU+UKwIigVbYJxKdruw0BeEgmm1BnOkq vQKg== X-Gm-Message-State: APjAAAVzw0zWTihBGcNy57VCbajeBT7K1OeQmuYZHX98k5twmnuuwEiL Qw26F82JPUhXLbM4rGkICFT+zh5Toas8mG9jV0Q5JA== X-Received: by 2002:a9d:224a:: with SMTP id o68mr13325699ota.214.1552959254133; Mon, 18 Mar 2019 18:34:14 -0700 (PDT) MIME-Version: 1.0 References: <155295271345.1945351.6465460744078693578.stgit@dwillia2-desk3.amr.corp.intel.com> <1552955080.2785.26.camel@linux.ibm.com> <1552956989.2785.31.camel@linux.ibm.com> In-Reply-To: <1552956989.2785.31.camel@linux.ibm.com> From: Dan Williams Date: Mon, 18 Mar 2019 18:34:02 -0700 Message-ID: Subject: Re: [PATCH] security/keys/trusted: Allow operation without hardware TPM To: James Bottomley Cc: Jarkko Sakkinen , "linux-nvdimm@lists.01.org" , Roberto Sassu , Linux Kernel Mailing List , Mimi Zohar , David Howells , keyrings@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 18, 2019 at 5:56 PM James Bottomley wrote: > > On Mon, 2019-03-18 at 17:30 -0700, Dan Williams wrote: > > On Mon, Mar 18, 2019 at 5:24 PM James Bottomley > > wrote: > > > > > > On Mon, 2019-03-18 at 16:45 -0700, Dan Williams wrote: > > > > Rather than fail initialization of the trusted.ko module, arrange > > > > for the module to load, but rely on trusted_instantiate() to fail > > > > trusted-key operations. > > > > > > What actual problem is this fixing? To me it would seem like an > > > enhancement to make the trusted module fail at load time if there's > > > no TPM rather than waiting until first use to find out it can never > > > work. Is there some piece of user code that depends on the > > > successful insertion of trusted.ko? > > > > The module dependency chain relies on it. If that can be broken that > > would also be an acceptable fix. > > > > I found this through the following dependency chain: libnvdimm.ko -> > > encrypted_keys.ko -> trusted.ko. > > > > "key_type_trusted" is the symbol that encrypted_keys needs regardless > > of whether the tpm is present. > > That's a nasty dependency caused by every key type module exporting a > symbol for its key type. It really seems that key types should be > looked up by name not symbol to prevent more of these dependency issues > from spreading. Something like this (untested and definitely won't > work without doing an EXPORT_SYMBOL on key_type_lookup). > > If it does look acceptable we can also disentangle the nasty module > dependencies in the encrypted key code around masterkey which alone > should be a huge improvement because that code is too hacky to live. Looks good to me. I fired it up with the export added and also included a: MODULE_SOFTDEP("pre: trusted"); ...to encourage trusted.ko to be ready, if possible, for the lookup.