acrn-kernel/drivers/char
Mario Limonciello f1324bbc40 tpm: disable hwrng for fTPM on some AMD designs
AMD has issued an advisory indicating that having fTPM enabled in
BIOS can cause "stuttering" in the OS.  This issue has been fixed
in newer versions of the fTPM firmware, but it's up to system
designers to decide whether to distribute it.

This issue has existed for a while, but is more prevalent starting
with kernel 6.1 because commit b006c439d5 ("hwrng: core - start
hwrng kthread also for untrusted sources") started to use the fTPM
for hwrng by default. However, all uses of /dev/hwrng result in
unacceptable stuttering.

So, simply disable registration of the defective hwrng when detecting
these faulty fTPM versions.  As this is caused by faulty firmware, it
is plausible that such a problem could also be reproduced by other TPM
interactions, but this hasn't been shown by any user's testing or reports.

It is hypothesized to be triggered more frequently by the use of the RNG
because userspace software will fetch random numbers regularly.

Intentionally continue to register other TPM functionality so that users
that rely upon PCR measurements or any storage of data will still have
access to it.  If it's found later that another TPM functionality is
exacerbating this problem a module parameter it can be turned off entirely
and a module parameter can be introduced to allow users who rely upon
fTPM functionality to turn it on even though this problem is present.

Link: https://www.amd.com/en/support/kb/faq/pa-410
Link: https://bugzilla.kernel.org/show_bug.cgi?id=216989
Link: https://lore.kernel.org/all/20230209153120.261904-1-Jason@zx2c4.com/
Fixes: b006c439d5 ("hwrng: core - start hwrng kthread also for untrusted sources")
Cc: stable@vger.kernel.org
Cc: Jarkko Sakkinen <jarkko@kernel.org>
Cc: Thorsten Leemhuis <regressions@leemhuis.info>
Cc: James Bottomley <James.Bottomley@hansenpartnership.com>
Tested-by: reach622@mailcuk.com
Tested-by: Bell <1138267643@qq.com>
Co-developed-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
2023-03-12 23:28:10 +02:00
..
agp char/agp: consolidate {alloc,free}_gatt_pages() 2023-02-13 22:13:12 +01:00
hw_random hwrng: starfive - Enable compile testing 2023-02-03 12:55:59 +08:00
ipmi ipmi: ipmb: Fix the MODULE_PARM_DESC associated to 'retry_time_ms' 2023-02-10 07:38:18 -06:00
mwave
pcmcia Char/Misc and other driver subsystem changes for 6.3-rc1 2023-02-24 12:47:33 -08:00
tpm tpm: disable hwrng for fTPM on some AMD designs 2023-03-12 23:28:10 +02:00
xilinx_hwicap
xillybus char: xillybus: Fix trivial bug with mutex 2022-11-23 19:44:04 +01:00
Kconfig
Makefile
adi.c
apm-emulation.c
applicom.c applicom: Fix PCI device refcount leak in applicom_init() 2023-01-20 13:05:39 +01:00
applicom.h
bsr.c
ds1620.c
dsp56k.c
dtlk.c
hangcheck-timer.c
hpet.c
lp.c
mem.c mm/nommu: factor out check for NOMMU shared mappings into is_nommu_shared_mapping() 2023-01-18 17:12:56 -08:00
misc.c Driver Core changes for 6.2-rc1 2022-12-16 03:54:54 -08:00
mspec.c mm: replace vma->vm_flags direct modifications with modifier calls 2023-02-09 16:51:39 -08:00
nsc_gpio.c
nvram.c
nwbutton.c
nwbutton.h
nwflash.c
pc8736x_gpio.c
powernv-op-panel.c
ppdev.c
ps3flash.c
random.c cpumask: fix incorrect cpumask scanning result checks 2023-03-06 12:15:13 -08:00
scx200_gpio.c
sonypi.c ACPI: make remove callback of ACPI driver void 2022-11-23 19:11:22 +01:00
tlclk.c
toshiba.c
ttyprintk.c
uv_mmtimer.c
virtio_console.c virtio_console: Use strscpy() to instead of strncpy() 2023-01-20 13:07:54 +01:00