[PATCH v2 0/4] libstub,tpm: fix small bugs and improve error reporting

Gregory Price posted 4 patches 2 months, 2 weeks ago
drivers/firmware/efi/libstub/tpm.c |  9 ++++++---
drivers/firmware/efi/tpm.c         | 26 ++++++++++++++++----------
include/linux/tpm_eventlog.h       |  2 +-
3 files changed, 23 insertions(+), 14 deletions(-)
[PATCH v2 0/4] libstub,tpm: fix small bugs and improve error reporting
Posted by Gregory Price 2 months, 2 weeks ago
The efi/tpm code has a number of small signed/unsigned bugs and
inaccuracies are prone to cause further bugs in a difficult to
debug manner.  For example, there is a signed/unsigned mismatch
in efi/tpm.c that can lead to calling memblock_reserve on a range
with an effectively negative length.

Additionally, there are silently ignored error conditions may
result in undefined behavior.  Address these.

Signed-off-by: Gregory Price <gourry@gourry.net>

Gregory Price (4):
  tpm: fix signed/unsigned bug when checking event logs
  tpm: do not ignore memblock_reserve return value
  tpm: fix unsigned/signed mismatch errors related to
    __calc_tpm2_event_size
  libstub,tpm: do not ignore failure case when reading final event log

 drivers/firmware/efi/libstub/tpm.c |  9 ++++++---
 drivers/firmware/efi/tpm.c         | 26 ++++++++++++++++----------
 include/linux/tpm_eventlog.h       |  2 +-
 3 files changed, 23 insertions(+), 14 deletions(-)

-- 
2.43.0
Re: [PATCH v2 0/4] libstub,tpm: fix small bugs and improve error reporting
Posted by Ard Biesheuvel 1 month, 2 weeks ago
On Sat, 14 Sept 2024 at 15:26, Gregory Price <gourry@gourry.net> wrote:
>
> The efi/tpm code has a number of small signed/unsigned bugs and
> inaccuracies are prone to cause further bugs in a difficult to
> debug manner.  For example, there is a signed/unsigned mismatch
> in efi/tpm.c that can lead to calling memblock_reserve on a range
> with an effectively negative length.
>
> Additionally, there are silently ignored error conditions may
> result in undefined behavior.  Address these.
>
> Signed-off-by: Gregory Price <gourry@gourry.net>
>
> Gregory Price (4):
>   tpm: fix signed/unsigned bug when checking event logs
>   tpm: do not ignore memblock_reserve return value
>   tpm: fix unsigned/signed mismatch errors related to
>     __calc_tpm2_event_size
>   libstub,tpm: do not ignore failure case when reading final event log
>

Now queued up - thanks.

>  drivers/firmware/efi/libstub/tpm.c |  9 ++++++---
>  drivers/firmware/efi/tpm.c         | 26 ++++++++++++++++----------
>  include/linux/tpm_eventlog.h       |  2 +-
>  3 files changed, 23 insertions(+), 14 deletions(-)
>
> --
> 2.43.0
>