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] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 13 Jun 2019 13:41:21 +0200
From:   Bartosz Szczepanek <bsz@...ihalf.com>
To:     Arnd Bergmann <arnd@...db.de>
Cc:     Qian Cai <cai@....pw>, Ard Biesheuvel <ard.biesheuvel@...aro.org>,
        Matthew Garrett <mjg59@...gle.com>,
        linux-efi <linux-efi@...r.kernel.org>,
        Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH -next] efi/tpm: fix a compilation warning

On Thu, Jun 13, 2019 at 10:55 AM Arnd Bergmann <arnd@...db.de> wrote:
>
> - efi.tpm_final_log is a physical address that gets passed into
>   memremap() to return a pointer
> - tpm2_calc_event_log_size() takes a pointer argument and
>   dereferences it.

Where does it? It's passed with some added offset to
__calc_tpm2_event_size, which does the remapping part. That's why
physical address is used here.

> My best guess is that we should pass the output of memremap()
> here rather than the input:
>
> --- a/drivers/firmware/efi/tpm.c
> +++ b/drivers/firmware/efi/tpm.c
> @@ -75,7 +75,7 @@ int __init efi_tpm_eventlog_init(void)
>                 goto out;
>         }
>
> -       tbl_size = tpm2_calc_event_log_size(efi.tpm_final_log
> +       tbl_size = tpm2_calc_event_log_size(final_tbl
>                                             + sizeof(final_tbl->version)
>                                             + sizeof(final_tbl->nr_events),
>                                             final_tbl->nr_events,
>
> No idea if that is actually what was intended here, but it makes
> the code look more plausible.

Passing final_tbl will lead to failure, as it will be remapped for
second time. Cast is needed here. Changing the type from void* to
unsigned long or phys_addr_t (and casting later) would also do the
job. I'm fine with both options.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ