New issue
Advanced search Search tips

Issue 822509 link

Starred by 1 user

Issue metadata

Status: Verified
Owner:
Closed: Apr 2018
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug



Sign in to add a comment

tpm-rng doesn't produce random data with mocktpm

Project Member Reported by evgreen@chromium.org, Mar 16 2018

Issue description

The kernel log gets spammed every 10 seconds with:

hwrng: no data available

whenever mocktpm is used. This is because tpm-rng is registering a random source, but mocktpm never supplies it with any randomness. The log spamming is annoying, let's deal with it one way or another.
 
Project Member

Comment 1 by bugdroid1@chromium.org, Apr 3 2018

Labels: merge-merged-chromeos-4.14
The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/fe1ec7024c1a1f6bad1f8e0be091d5f66a49f3bb

commit fe1ec7024c1a1f6bad1f8e0be091d5f66a49f3bb
Author: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Date: Tue Apr 03 23:12:15 2018

UPSTREAM: tpm: use struct tpm_chip for tpm_chip_find_get()

Device number (the character device index) is not a stable identifier
for a TPM chip. That is the reason why every call site passes
TPM_ANY_NUM to tpm_chip_find_get().

This commit changes the API in a way that instead a struct tpm_chip
instance is given and NULL means the default chip. In addition, this
commit refines the documentation to be up to date with the
implementation.

Suggested-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> (@chip_num -> @chip part)
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Reviewed-by: Jason Gunthorpe <jgg@ziepe.ca>
Tested-by: PrasannaKumar Muralidharan <prasannatsmkumar@gmail.com>

BUG= chromium:822509 
TEST=Build kernel for Cheza, which uses mocktpm

Signed-off-by: Evan Green <evgreen@chromium.org>
(cherry picked from commit aad887f6641145fec2a801da2ce4ed36cf99c6a5)
Change-Id: I3f9ea1545f0023107ad70aaeed58b3562c9d5c2a
Reviewed-on: https://chromium-review.googlesource.com/966873
Reviewed-by: Guenter Roeck <groeck@chromium.org>

[modify] https://crrev.com/fe1ec7024c1a1f6bad1f8e0be091d5f66a49f3bb/security/integrity/ima/ima_crypto.c
[modify] https://crrev.com/fe1ec7024c1a1f6bad1f8e0be091d5f66a49f3bb/drivers/char/tpm/tpm-chip.c
[modify] https://crrev.com/fe1ec7024c1a1f6bad1f8e0be091d5f66a49f3bb/drivers/char/hw_random/tpm-rng.c
[modify] https://crrev.com/fe1ec7024c1a1f6bad1f8e0be091d5f66a49f3bb/drivers/char/tpm/tpm-interface.c
[modify] https://crrev.com/fe1ec7024c1a1f6bad1f8e0be091d5f66a49f3bb/drivers/char/tpm/tpm.h
[modify] https://crrev.com/fe1ec7024c1a1f6bad1f8e0be091d5f66a49f3bb/include/linux/tpm.h
[modify] https://crrev.com/fe1ec7024c1a1f6bad1f8e0be091d5f66a49f3bb/security/integrity/ima/ima_init.c
[modify] https://crrev.com/fe1ec7024c1a1f6bad1f8e0be091d5f66a49f3bb/security/integrity/ima/ima_queue.c
[modify] https://crrev.com/fe1ec7024c1a1f6bad1f8e0be091d5f66a49f3bb/security/keys/trusted.c

Project Member

Comment 2 by bugdroid1@chromium.org, Apr 3 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/f8290d5ddcaed257980d6bff3c9f7125946c3e05

commit f8290d5ddcaed257980d6bff3c9f7125946c3e05
Author: Thiebaud Weksteen <tweek@google.com>
Date: Tue Apr 03 23:12:17 2018

UPSTREAM: tpm: move tpm_eventlog.h outside of drivers folder

The generic definitions of data structures in tpm_eventlog.h are
required by other part of the kernel (namely, the EFI stub).

Signed-off-by: Thiebaud Weksteen <tweek@google.com>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Tested-by: Javier Martinez Canillas <javierm@redhat.com>
Tested-by: Jarkko Sakkinen  <jarkko.sakkinen@linux.intel.com>
Reviewed-by: Jarkko Sakkinen  <jarkko.sakkinen@linux.intel.com>
Signed-off-by: Jarkko Sakkinen  <jarkko.sakkinen@linux.intel.com>

BUG= chromium:822509 
TEST=Build kernel for Cheza, which uses mocktpm

Signed-off-by: Evan Green <evgreen@chromium.org>
(cherry picked from commit fd3ec3663718e5f89fbcbc18a67885203fd914a1)
Change-Id: I20d7157d9f1590d79f7900ee1f3af011723f4814
Reviewed-on: https://chromium-review.googlesource.com/966874
Reviewed-by: Guenter Roeck <groeck@chromium.org>

[modify] https://crrev.com/f8290d5ddcaed257980d6bff3c9f7125946c3e05/drivers/char/tpm/tpm_acpi.c
[modify] https://crrev.com/f8290d5ddcaed257980d6bff3c9f7125946c3e05/drivers/char/tpm/tpm_of.c
[modify] https://crrev.com/f8290d5ddcaed257980d6bff3c9f7125946c3e05/drivers/char/tpm/tpm-chip.c
[modify] https://crrev.com/f8290d5ddcaed257980d6bff3c9f7125946c3e05/drivers/char/tpm/tpm2_eventlog.c
[modify] https://crrev.com/f8290d5ddcaed257980d6bff3c9f7125946c3e05/drivers/char/tpm/tpm-interface.c
[modify] https://crrev.com/f8290d5ddcaed257980d6bff3c9f7125946c3e05/drivers/char/tpm/tpm.h
[rename] https://crrev.com/f8290d5ddcaed257980d6bff3c9f7125946c3e05/include/linux/tpm_eventlog.h
[modify] https://crrev.com/f8290d5ddcaed257980d6bff3c9f7125946c3e05/drivers/char/tpm/tpm1_eventlog.c

Project Member

Comment 3 by bugdroid1@chromium.org, Apr 3 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/ab1e00f3021571afe34e4d5574679dd984a4dc19

commit ab1e00f3021571afe34e4d5574679dd984a4dc19
Author: Jason Gunthorpe <jgg@ziepe.ca>
Date: Tue Apr 03 23:12:21 2018

UPSTREAM: tpm: Move Linux RNG connection to hwrng

The tpm-rng.c approach is completely inconsistent with how the kernel
handles hotplug. Instead manage a hwrng device for each TPM. This will
cause the kernel to read entropy from the TPM when it is plugged in, and
allow access to the TPM rng via /dev/hwrng.

Signed-off-by: Jason Gunthorpe <jgg@ziepe.ca>
Tested-by: PrasannaKumar Muralidharan <prasannatsmkumar@gmail.com>
Tested-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>

Note: drivers/char/tpm/tpm.h conflicted because of
1f6cbc95287eb7f903ccf3e67ce1015acf7f1a3e
which was just a chromium-specific nearby change.

Conflicts:
	drivers/char/tpm/tpm.h

BUG= chromium:822509 
TEST=Build kernel for Cheza, which uses mocktpm

Signed-off-by: Evan Green <evgreen@chromium.org>
(cherry picked from commit 6e592a065d51d26f9d62b8b7501a5114076af8b4)
Change-Id: Ie999ad5981883809734bc2f818c16e818e9f97f3
Reviewed-on: https://chromium-review.googlesource.com/966875
Reviewed-by: Guenter Roeck <groeck@chromium.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Andrey Pronin <apronin@chromium.org>

[modify] https://crrev.com/ab1e00f3021571afe34e4d5574679dd984a4dc19/drivers/char/hw_random/Makefile
[modify] https://crrev.com/ab1e00f3021571afe34e4d5574679dd984a4dc19/drivers/char/tpm/tpm-chip.c
[modify] https://crrev.com/ab1e00f3021571afe34e4d5574679dd984a4dc19/drivers/char/hw_random/Kconfig
[delete] https://crrev.com/13316b4f2cb2bbac9104c363eccda512fd4a0a0d/drivers/char/hw_random/tpm-rng.c
[modify] https://crrev.com/ab1e00f3021571afe34e4d5574679dd984a4dc19/drivers/char/tpm/Kconfig
[modify] https://crrev.com/ab1e00f3021571afe34e4d5574679dd984a4dc19/drivers/char/tpm/tpm.h

Project Member

Comment 4 by bugdroid1@chromium.org, Apr 3 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/13316b4f2cb2bbac9104c363eccda512fd4a0a0d

commit 13316b4f2cb2bbac9104c363eccda512fd4a0a0d
Author: Evan Green <evgreen@chromium.org>
Date: Tue Apr 03 23:12:19 2018

CHROMIUM: Revert "CHROMIUM: tpm-rng: Make hwrng working"

This reverts
commit d0621b4cd498 ("CHROMIUM: tpm-rng: Make hwrng working")
in order to apply upstream
commit 6e592a065d51 ("tpm: Move Linux RNG connection to hwrng")

That change made the rpm-rng driver load a little later, presumably to
avoid some sort of situation where it came up too early. Since the driver
is being deleted by the upcoming upstream change, this is no longer
needed.

Signed-off-by: Evan Green <evgreen@chromium.org>

BUG= chromium:822509 
TEST=Build kernel for cheza, which uses mocktpm.

Change-Id: I0fd1a3ab9d6aa8d4161b278d31523be01ba25358
Reviewed-on: https://chromium-review.googlesource.com/966937
Commit-Ready: Evan Green <evgreen@chromium.org>
Tested-by: Evan Green <evgreen@chromium.org>
Reviewed-by: Guenter Roeck <groeck@chromium.org>

[modify] https://crrev.com/13316b4f2cb2bbac9104c363eccda512fd4a0a0d/drivers/char/hw_random/tpm-rng.c

Status: Verified (was: Untriaged)

Sign in to add a comment