tpmdd-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Javier Martinez Canillas <javierm@redhat.com>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	linux-efi@vger.kernel.org, Ingo Molnar <mingo@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>
Cc: hdegoede@redhat.com, tweek@google.com,
	jarkko.sakkinen@linux.intel.com, linux-kernel@vger.kernel.org,
	linux-integrity@vger.kernel.org,
	tpmdd-devel@lists.sourceforge.net
Subject: Re: [PATCH 1/1] efi/libstub: tpm: zero initialize pointer variables for mixed mode
Date: Tue, 13 Mar 2018 16:10:32 +0100	[thread overview]
Message-ID: <1a72c53b-76fe-a119-3283-0950b8f758e7@redhat.com> (raw)
In-Reply-To: <20180313140922.17266-2-ard.biesheuvel@linaro.org>

[adding linux-integrity and tpmdd-devel since this was discussed in these ML too]

On 03/13/2018 03:09 PM, Ard Biesheuvel wrote:
> As reported by Jeremy, running the new TPM libstub code in mixed mode
> (i.e., 64-bit kernel on 32-bit UEFI) results in hangs when invoking
> the TCG2 protocol, or when accessing the log_tbl pool allocation.
> 
> The reason turns out to be that in both cases, the 64-bit pointer
> variables are not fully initialized by the 32-bit EFI code, and so
> we should take care to zero initialize these variables beforehand,
> or we'll end up dereferencing bogus pointers.
> 
> Reported-by: Jeremy Cline <jeremy@jcline.org>
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
>  drivers/firmware/efi/libstub/tpm.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/firmware/efi/libstub/tpm.c b/drivers/firmware/efi/libstub/tpm.c
> index da661bf8cb96..13c1edd37e96 100644
> --- a/drivers/firmware/efi/libstub/tpm.c
> +++ b/drivers/firmware/efi/libstub/tpm.c
> @@ -68,11 +68,11 @@ void efi_retrieve_tpm2_eventlog_1_2(efi_system_table_t *sys_table_arg)
>  	efi_guid_t linux_eventlog_guid = LINUX_EFI_TPM_EVENT_LOG_GUID;
>  	efi_status_t status;
>  	efi_physical_addr_t log_location, log_last_entry;
> -	struct linux_efi_tpm_eventlog *log_tbl;
> +	struct linux_efi_tpm_eventlog *log_tbl = NULL;
>  	unsigned long first_entry_addr, last_entry_addr;
>  	size_t log_size, last_entry_size;
>  	efi_bool_t truncated;
> -	void *tcg2_protocol;
> +	void *tcg2_protocol = NULL;
>  
>  	status = efi_call_early(locate_protocol, &tcg2_guid, NULL,
>  				&tcg2_protocol);
> 

Looks good to me.

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>

Best regards,
-- 
Javier Martinez Canillas
Software Engineer - Desktop Hardware Enablement
Red Hat

           reply	other threads:[~2018-03-13 15:10 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20180313140922.17266-2-ard.biesheuvel@linaro.org>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1a72c53b-76fe-a119-3283-0950b8f758e7@redhat.com \
    --to=javierm@redhat.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=hdegoede@redhat.com \
    --cc=jarkko.sakkinen@linux.intel.com \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=tpmdd-devel@lists.sourceforge.net \
    --cc=tweek@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).