From patchwork Fri Mar 9 16:54:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Cline X-Patchwork-Id: 10271291 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 EE42060236 for ; Fri, 9 Mar 2018 16:55:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E099429C14 for ; Fri, 9 Mar 2018 16:55:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D346429C60; Fri, 9 Mar 2018 16:55:01 +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 7463229C14 for ; Fri, 9 Mar 2018 16:55:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932315AbeCIQyt (ORCPT ); Fri, 9 Mar 2018 11:54:49 -0500 Received: from a8-200.smtp-out.amazonses.com ([54.240.8.200]:44496 "EHLO a8-200.smtp-out.amazonses.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932157AbeCIQyo (ORCPT ); Fri, 9 Mar 2018 11:54:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=rdybrs3533vx7mghocfwl3vdwgpl2v5u; d=jcline.org; t=1520614483; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:Content-Type:In-Reply-To; bh=EdQtkMBZrZ05iGRr+u2bmt+AxwGjXLneJ51RvoufHk0=; b=cAM7UHJt8pGCTitACBQ5UFX5PQ5yHjTiWLxFSgvhmt80OAJeTBlmC0j/uBt4aBPV w5QneEHxgzg/lnrVU5oqnsZu111YCe6Lqnb6nmJ6vhuaIktDM3NIxfKGzCQY746Qpib eFCZ/psgVKb7Ylnn1y+MrF1knRrA+pEss5+PJz3Y= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=224i4yxa5dv7c2xz3womw6peuasteono; d=amazonses.com; t=1520614482; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:Content-Type:In-Reply-To:Feedback-ID; bh=EdQtkMBZrZ05iGRr+u2bmt+AxwGjXLneJ51RvoufHk0=; b=oTk5MzqkF+H8hrdf4R00kxusE3S4PznyPGMOr1d8LLLvzsLUAiPsknBe3mF4hUdC AMXnpzyPagKpsgMY8jItAnyVoRQQpRQyE2Kf/ug9v3HhhC7nNWJMVq6g/xKjI2UhF0Z u9wN2E0sa69XKf8jIq8f4txBy8rzr+XB6/jJ7a+s= X-Virus-Scanned: amavisd-new at jcline.org Date: Fri, 9 Mar 2018 16:54:42 +0000 From: Jeremy Cline To: Thiebaud Weksteen Cc: hdegoede@redhat.com, Javier Martinez Canillas , Jarkko Sakkinen , linux-efi@vger.kernel.org, linux-integrity@vger.kernel.org, tpmdd-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: Re: Regression from efi: call get_event_log before ExitBootServices Message-ID: <010001620bafa06b-41525407-603e-40a9-ba11-6033b2f5dcc7-000000@email.amazonses.com> References: <01000161fc0b4755-df0621f4-ab5d-479a-b425-adf98427a308-000000@email.amazonses.com> <0100016206a68850-bd5c96b3-f275-46ea-98b1-1317e02a5d6e-000000@email.amazonses.com> <29c1640a-cf19-ca19-7de9-96f202edfb5a@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.3 (2018-01-21) X-SES-Outgoing: 2018.03.09-54.240.8.200 Feedback-ID: 1.us-east-1.z18Isoc/FaoPOvCyJyi1mnTt8STwoRuibXVNoUcvG6g=:AmazonSES 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 On Fri, Mar 09, 2018 at 10:43:50AM +0000, Thiebaud Weksteen wrote: > Thanks a lot for trying out the patch! > > Please don't modify your install at this stage, I think we are hitting a > firmware bug and that would be awesome if we can fix how we are handling it. > So, if we reach that stage in the function it could either be that: > * The allocation did not succeed, somehow, but the firmware still returned > EFI_SUCCEED. > * The size requested is incorrect (I'm thinking something like a 1G of > log). This would be due to either a miscalculation of log_size (possible) > or; the returned values of GetEventLog are not correct. > I'm sending a patch to add checks for these. Could you please apply and > retest? > Again, thanks for helping debugging this. No problem, thanks for the help :) With the new patch: Locating the TCG2Protocol Calling GetEventLog on TCG2Protocol Log returned log_location is not empty log_size != 0 log_size < 1M Allocating memory for storing the logs Returned from memory allocation Copying log to new location And then it hangs. I added a couple more print statements: and it's hanging at "memset(log_tbl, 0, sizeof(*log_tbl) + log_size);" Regards, Jeremy diff --git a/drivers/firmware/efi/libstub/tpm.c b/drivers/firmware/efi/libstub/tpm.c index ee3fac109078..1ab5638bc50e 100644 --- a/drivers/firmware/efi/libstub/tpm.c +++ b/drivers/firmware/efi/libstub/tpm.c @@ -148,8 +148,11 @@ void efi_retrieve_tpm2_eventlog_1_2(efi_system_table_t *sys_table_arg) efi_printk(sys_table_arg, "Copying log to new location\n"); memset(log_tbl, 0, sizeof(*log_tbl) + log_size); + efi_printk(sys_table_arg, "Successfully memset log_tbl to 0\n"); log_tbl->size = log_size; + efi_printk(sys_table_arg, "Set log_tbl->size\n"); log_tbl->version = EFI_TCG2_EVENT_LOG_FORMAT_TCG_1_2; + efi_printk(sys_table_arg, "Set log_tbl-version\n"); memcpy(log_tbl->log, (void *) first_entry_addr, log_size); efi_printk(sys_table_arg, "Installing the log into the configuration table\n");