From patchwork Thu Mar 8 10:03:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Thi=C3=A9baud_Weksteen?= X-Patchwork-Id: 10267515 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 62447602C8 for ; Thu, 8 Mar 2018 10:03:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5356629731 for ; Thu, 8 Mar 2018 10:03:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 47F0529849; Thu, 8 Mar 2018 10:03:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DC59A29731 for ; Thu, 8 Mar 2018 10:03:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755608AbeCHKDj (ORCPT ); Thu, 8 Mar 2018 05:03:39 -0500 Received: from mail-yw0-f202.google.com ([209.85.161.202]:35952 "EHLO mail-yw0-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755570AbeCHKDh (ORCPT ); Thu, 8 Mar 2018 05:03:37 -0500 Received: by mail-yw0-f202.google.com with SMTP id v19so3056610ywg.3 for ; Thu, 08 Mar 2018 02:03:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:date:message-id:subject:from:to:cc; bh=23OOZ4ZZ9yscC28Ej9XETaP7HJ2mPqQi5DYNCgFgWEI=; b=sYquom3G7KnN08puDY7yzZ1MRY+KQe9CGBN3dwugQQdnAABHm7PfbBQPv4VGcfQTgz s/6W4bjr1cpIO2fOSkPmtgOGiy6ei08oTkQ8AV6WQHOgcQ+U4O06gSzz/AqpQqG/RBAS HrjSlIRUpho/2z9M/sniqYJWhY8yH0bximcqge5Kpea7pSxn4JsWhvYKixh04wvjIT/p 8mB9E2vPI+Y5d8vDOABNE+UYwHg0e4M+rEsiWtfvVdZ2junz6Rru8jUZZkCf9Km+xR35 0HQZYXzqpT2yscXzPoDLfBe4fVHh/RdYSAiE8q/j7A+3T0o6eLx4RyDv1wCL6Q5qTfY5 WKdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:date:message-id:subject:from:to:cc; bh=23OOZ4ZZ9yscC28Ej9XETaP7HJ2mPqQi5DYNCgFgWEI=; b=JC9YdBATumAs+XsoM3fmu+kMgvKBk/LwqYns7RND5/DQAVnRFPdVv4k21K9C0YIBWM yUcTxh9pVJYhfaExiU0hM9BPE/Bu0e/arneTt59rz5LxqiAY8mk1hoWZTqm8vrZQszwS Wln6xLN54CNSZMgTgxlDeTXRo13hk6o5MiDA2e+5bp6INvcMpp7MUqssEZLebviLC9TF n5TnT8fiyE5y/oWSF+x+aRmtN5r/DCm0WmGqj9vA0BwWzPg08eYhSz2Uh8iQJS2Hy3k+ VvjyKHyMSGuDgfCZ3yHwlaobiZeVlroJ7hk4V3a4ODInoLkDRieycH6k1ISXEPn6tMkt wX6g== X-Gm-Message-State: APf1xPCcHVF7VlFuRab2cGnK6nutJZmMRZB7fdKf6r95moJeerUp574R qLdckYXplYrebbn38lT94NQvEgdF4A== X-Google-Smtp-Source: AG47ELtmzyLfyEHzIxDNq2fKsRcMiOfrVnToYJwilxbORc40194JB3eJ9NlsZp+F7a+UODRI+9ANXQcU4A== MIME-Version: 1.0 X-Received: by 10.129.198.76 with SMTP id q12mr11168184ywj.135.1520503416940; Thu, 08 Mar 2018 02:03:36 -0800 (PST) Date: Thu, 8 Mar 2018 11:03:19 +0100 Message-Id: <20180308100319.131536-1-tweek@google.com> X-Mailer: git-send-email 2.16.2.395.g2e18187dfd-goog Subject: Re: Regression from efi: call get_event_log before ExitBootServices From: Thiebaud Weksteen To: Jeremy Cline Cc: Javier Martinez Canillas , Jarkko Sakkinen , hdegoede@redhat.com, linux-efi@vger.kernel.org, linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org, Thiebaud Weksteen Sender: linux-integrity-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP --- drivers/firmware/efi/libstub/tpm.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/firmware/efi/libstub/tpm.c b/drivers/firmware/efi/libstub/tpm.c index da661bf8cb96..773afcd6a37c 100644 --- a/drivers/firmware/efi/libstub/tpm.c +++ b/drivers/firmware/efi/libstub/tpm.c @@ -74,19 +74,23 @@ void efi_retrieve_tpm2_eventlog_1_2(efi_system_table_t *sys_table_arg) efi_bool_t truncated; void *tcg2_protocol; + efi_printk(sys_table_arg, "Locating the TCG2Protocol\n"); status = efi_call_early(locate_protocol, &tcg2_guid, NULL, &tcg2_protocol); if (status != EFI_SUCCESS) return; + efi_printk(sys_table_arg, "Calling GetEventLog on TCG2Protocol\n"); status = efi_call_proto(efi_tcg2_protocol, get_event_log, tcg2_protocol, EFI_TCG2_EVENT_LOG_FORMAT_TCG_1_2, &log_location, &log_last_entry, &truncated); if (status != EFI_SUCCESS) return; + efi_printk(sys_table_arg, "Log returned\n"); if (!log_location) return; + efi_printk(sys_table_arg, "log_location is not empty\n"); first_entry_addr = (unsigned long) log_location; /* @@ -94,7 +98,9 @@ void efi_retrieve_tpm2_eventlog_1_2(efi_system_table_t *sys_table_arg) */ if (!log_last_entry) { log_size = 0; + efi_printk(sys_table_arg, "log_size = 0\n"); } else { + efi_printk(sys_table_arg, "log_size != 0\n"); last_entry_addr = (unsigned long) log_last_entry; /* * get_event_log only returns the address of the last entry. @@ -106,26 +112,31 @@ void efi_retrieve_tpm2_eventlog_1_2(efi_system_table_t *sys_table_arg) log_size = log_last_entry - log_location + last_entry_size; } + efi_printk(sys_table_arg, "Allocating memory for storing the logs\n"); /* Allocate space for the logs and copy them. */ status = efi_call_early(allocate_pool, EFI_LOADER_DATA, sizeof(*log_tbl) + log_size, (void **) &log_tbl); + efi_printk(sys_table_arg, "Returned from memory allocation\n"); if (status != EFI_SUCCESS) { efi_printk(sys_table_arg, "Unable to allocate memory for event log\n"); return; } + efi_printk(sys_table_arg, "Copying log to new location\n"); memset(log_tbl, 0, sizeof(*log_tbl) + log_size); log_tbl->size = log_size; log_tbl->version = EFI_TCG2_EVENT_LOG_FORMAT_TCG_1_2; memcpy(log_tbl->log, (void *) first_entry_addr, log_size); + efi_printk(sys_table_arg, "Installing the log into the configuration table\n"); status = efi_call_early(install_configuration_table, &linux_eventlog_guid, log_tbl); if (status != EFI_SUCCESS) goto err_free; + efi_printk(sys_table_arg, "Done\n"); return; err_free: