Received: by 10.223.185.111 with SMTP id b44csp528858wrg; Fri, 9 Mar 2018 08:56:18 -0800 (PST) X-Google-Smtp-Source: AG47ELv+EUP7gSZDExhUM72j/d3vwG6xhUF8wCTubBGFxYXlzMEgLh5P2GmmoLUQF9sC56vZIDiB X-Received: by 10.101.85.71 with SMTP id t7mr24727247pgr.386.1520614578121; Fri, 09 Mar 2018 08:56:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520614578; cv=none; d=google.com; s=arc-20160816; b=PjOKgNd7dC14mXKof3j2QVgTXFWiOkd20cfO6JNlR8QRNgWTxuUYyJO83V0hEkrAUY Jw35vr8cwm6D7/74Jp6Z1AXvGPm8mmWJ08BcvyNUVM4VRhdUL3qqB57pTuliZ2EZO7tu cGgcSQyEdO25Q8c7yK5hvjYcwts978ohFs7n0Q6OpP3OXK34VSbIroZIA1o0YwQEzoLO K6JcIWrenpHNeXyZHhvVwEpRl0DKrwzynJL8ODVYtGyGJ4bt/cekye6IjvKipCrI0ro1 LxCcQ/GATRZCT0o223OSwjNk5HA3gLrg1WZAYYQ1UbT4mc88JwaZkjtgoXEpAMM7Mpm/ 9ihA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:feedback-id:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:dkim-signature :arc-authentication-results; bh=sR9T2fVSSvt5rngKgAwBpgoupqcdTqXU1l8amn+y+V4=; b=HIMMj4pgspxkDCq16E2G/EMK4qOlOvsZ4xMGqZX3tbMR+RHvS2XSxnAfle4aAw54cf gyrp9vGnr8r1uZufmOOTN21/LBI3Mk96jihXdNhnBuDf1p+MkOgb2dScHNzie7K2dFub UoloEJ4Ecm9ywgpr5yK0Zk2lW/1UhFaAd14phLK+MOp3p3JB7jLv0ADRISpTlMbEJ/za 0FtLSc62gmS3kJJzKrBcBXug1s0dp5L+liW5tSMSsf9fm2rLOhjyxWf9GE3cz3/0FfJ2 rXthSsIvSedarhYteXhvNobnEYXMCOBq4jP70nYD6LDkekFntyQxzR0xguM7OMjgV/gj WkLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@jcline.org header.s=rdybrs3533vx7mghocfwl3vdwgpl2v5u header.b=cAM7UHJt; dkim=pass header.i=@amazonses.com header.s=224i4yxa5dv7c2xz3womw6peuasteono header.b=oTk5Mzqk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a190si587772pge.436.2018.03.09.08.56.03; Fri, 09 Mar 2018 08:56:18 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@jcline.org header.s=rdybrs3533vx7mghocfwl3vdwgpl2v5u header.b=cAM7UHJt; dkim=pass header.i=@amazonses.com header.s=224i4yxa5dv7c2xz3womw6peuasteono header.b=oTk5Mzqk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932330AbeCIQyt (ORCPT + 99 others); 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-Type: text/plain; charset=us-ascii 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: 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"); and it's hanging at "memset(log_tbl, 0, sizeof(*log_tbl) + log_size);" Regards, Jeremy