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] [day] [month] [year] [list]
Date:   Mon, 22 Aug 2022 12:59:24 -0500
From:   Rob Herring <robh@...nel.org>
To:     Stefan Berger <stefanb@...ux.ibm.com>
Cc:     kexec@...ts.infradead.org, mpe@...erman.id.au,
        devicetree@...r.kernel.org, Eric Biederman <ebiederm@...ssion.com>,
        Nageswara R Sastry <rnsastry@...ux.ibm.com>,
        linux-kernel@...r.kernel.org, linux-integrity@...r.kernel.org,
        nayna@...ux.ibm.com, nasastry@...ibm.com,
        Frank Rowand <frowand.list@...il.com>,
        Rob Herring <robh+dt@...nel.org>, linuxppc-dev@...ts.ozlabs.org
Subject: Re: [PATCH v7 6/6] tpm/kexec: Duplicate TPM measurement log in
 of-tree for kexec

On Fri, 12 Aug 2022 12:43:05 -0400, Stefan Berger wrote:
> The memory area of the TPM measurement log is currently not properly
> duplicated for carrying it across kexec when an Open Firmware
> Devicetree is used. Therefore, the contents of the log get corrupted.
> Fix this for the kexec_file_load() syscall by allocating a buffer and
> copying the contents of the existing log into it. The new buffer is
> preserved across the kexec and a pointer to it is available when the new
> kernel is started. To achieve this, store the allocated buffer's address
> in the flattened device tree (fdt) under the name linux,tpm-kexec-buffer
> and search for this entry early in the kernel startup before the TPM
> subsystem starts up. Adjust the pointer in the of-tree stored under
> linux,sml-base to point to this buffer holding the preserved log. The TPM
> driver can then read the base address from this entry when making the log
> available. Invalidate the log by removing 'linux,sml-base' from the
> devicetree if anything goes wrong with updating the buffer.
> 
> Use subsys_initcall() to call the function to restore the buffer even if
> the TPM subsystem or driver are not used. This allows the buffer to be
> carried across the next kexec without involvement of the TPM subsystem
> and ensures a valid buffer pointed to by the of-tree.
> 
> Use the subsys_initcall(), rather than an ealier initcall, since
> page_is_ram() in get_kexec_buffer() only starts working at this stage.
> 
> Signed-off-by: Stefan Berger <stefanb@...ux.ibm.com>
> Cc: Rob Herring <robh+dt@...nel.org>
> Cc: Frank Rowand <frowand.list@...il.com>
> Cc: Eric Biederman <ebiederm@...ssion.com>
> Tested-by: Nageswara R Sastry <rnsastry@...ux.ibm.com>
> 
> ---
> v6:
>  - Define prototype for tpm_add_kexec_buffer under same config options
>    as drivers/of/kexec.c is compiled, provide inline function otherwise.
>    (kernel test robot)
> 
> v4:
>  - Added #include <linux/vmalloc.h> due to parisc
>  - Use phys_addr_t for physical address rather than void *
>  - Remove linux,sml-base if the buffer cannot be updated after a kexec
>  - Added __init to functions where possible
> ---
>  drivers/of/kexec.c    | 216 +++++++++++++++++++++++++++++++++++++++++-
>  include/linux/kexec.h |   6 ++
>  include/linux/of.h    |   9 +-
>  kernel/kexec_file.c   |   6 ++
>  4 files changed, 234 insertions(+), 3 deletions(-)
> 

Reviewed-by: Rob Herring <robh@...nel.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ