lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <CUHF67ZOFOTN.1UFE7Q1IFRQMX@suppilovahvero>
Date:   Tue, 01 Aug 2023 21:28:42 +0300
From:   "Jarkko Sakkinen" <jarkko@...nel.org>
To:     "Linus Torvalds" <torvalds@...ux-foundation.org>
Cc:     "Daniil Stas" <daniil.stas@...teo.net>,
        "Mario Limonciello" <mario.limonciello@....com>,
        <James.Bottomley@...senpartnership.com>, <Jason@...c4.com>,
        <linux-integrity@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <regressions@...mhuis.info>, <stable@...r.kernel.org>
Subject: Re: [PATCH 1/1] tpm: disable hwrng for fTPM on some AMD designs

On Mon Jul 31, 2023 at 10:05 PM EEST, Linus Torvalds wrote:
> On Mon, 31 Jul 2023 at 03:53, Jarkko Sakkinen <jarkko@...nel.org> wrote:
> >
> > I quickly carved up a patch (attached), which is only compile tested
> > because I do not have any AMD hardware at hand.
>
> Is there some way to just see "this is a fTPM"?
>
> Because honestly, even if AMD is the one that has had stuttering
> issues, the bigger argument is that there is simply no _point_ in
> supporting randomness from a firmware source.
>
> There is no way anybody should believe that a firmware TPM generates
> better randomness than we do natively.
>
> And there are many reasons to _not_ believe it. The AMD problem is
> just the most user-visible one.
>
> Now, I'm not saying that a fTPM needs to be disabled in general - but
> I really feel like we should just do
>
>  static int tpm_add_hwrng(struct tpm_chip *chip)
>  {
>         if (!IS_ENABLED(CONFIG_HW_RANDOM_TPM))
>                 return 0;
>         // If it's not hardware, don't treat it as such
>         if (tpm_is_fTPM(chip))
>                 return 0;
>         [...]
>
> and be done with it.
>
> But hey, if we have no way to see that whole "this is firmware
> emulation", then just blocking AMD might be the only way.
>
>                Linus

I would disable it inside tpm_crb driver, which is the driver used
for fTPM's: they are identified by MSFT0101 ACPI identifier.

I think the right scope is still AMD because we don't have such
regressions with Intel fTPM.

I.e. I would move the helper I created inside tpm_crb driver, and
a new flag, let's say "TPM_CHIP_FLAG_HWRNG_DISABLED", which tpm_crb
sets before calling tpm_chip_register().

Finally, tpm_add_hwrng() needs the following invariant:

	if (chip->flags & TPM_CHIP_FLAG_HWRNG_DISABLED)
		return 0;

How does this sound? I can refine this quickly from my first trial.

BR, Jarkko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ