Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5326359yba; Tue, 30 Apr 2019 12:53:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqwh3C2FkqBBCSCLiX/m0GADC2Dd0jMmnifY4umfa+aRNE7gHUqUB0xqfEGDTRzYRAeEWwpI X-Received: by 2002:a63:2b0d:: with SMTP id r13mr69588537pgr.400.1556654002267; Tue, 30 Apr 2019 12:53:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556654002; cv=none; d=google.com; s=arc-20160816; b=tdrziBq0lFyIhicgSWxaQ7LyHOn6nFOcHkCZWcqnCG08iCzF16YItkcgCux1jS6y/2 ifD6y2qGovssysRQIHRG+dUQ4eLk1eLPEld1FJGqHC0fBm1g3MqRvSeqoar6asDH3uqX lu5naRHMtjbdbJ6sbGmISzStUj8P+iXi1/vEEr+oFsAT4y7AzNrvzedNw0p5hDRKge9z +X1m8mUup1ZvTaDgJfvXH6Aa5SS+40QOIPNhLuHTkHLRVn2kGYjZ1Yowk208DpX9WA+o HG7VrILlsiuWrlknyw2c+3/sDKeNnUzNzfU2QxhGr1B6u1dys9Qfw6WIeG+u+ZNBkZBK sI6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=egv8gBhUCwez9IoA3piXkzNWat3a9Q7nOx3S/lPZw9k=; b=wQXLelfOXdNSfIaeWmuEARhNHUeKki/pRTAc1LDkm6G5rkbm1FtZ+ffERyuIM4bM0j aBywsQjwv2Ri/IZHzOEZc1gtt2O0dzT6TEollonSbyLatjqdITLaOAAiwHwXNlJ9hNv9 3RCAWnC3KEdW5cVYWS4Kfg03nK/++tTl8BMK9BMfMqQbBTihz3Zw36be/v8Hz+4/MmZB g2RDDDuu8qWNNUGWbdHKiWSl46yY8p2dP7sl9ZM/3+wlWvdxT+ZZodk/lOTZX4/I1Pzu jFztbDsVKC9h+sodPwBn0R8ZuzvlkUMDE6k06QQ16iO6an1SE0gwF+2hnY0xtGagrZ7E x6LQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=G6GfZ5ia; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ay3si8990026plb.201.2019.04.30.12.53.06; Tue, 30 Apr 2019 12:53:22 -0700 (PDT) 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=@google.com header.s=20161025 header.b=G6GfZ5ia; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726198AbfD3TwN (ORCPT + 99 others); Tue, 30 Apr 2019 15:52:13 -0400 Received: from mail-io1-f66.google.com ([209.85.166.66]:37670 "EHLO mail-io1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726024AbfD3TwM (ORCPT ); Tue, 30 Apr 2019 15:52:12 -0400 Received: by mail-io1-f66.google.com with SMTP id a23so13330361iot.4 for ; Tue, 30 Apr 2019 12:52:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=egv8gBhUCwez9IoA3piXkzNWat3a9Q7nOx3S/lPZw9k=; b=G6GfZ5iaW0m25ZRTXr7m8HEFSOOargOq9Nora6opbxcB3fSBbwP2/s0zVy4fWD0gMO HtRmTDtnV0WxOcN40ARSbDDUFGvwrbUnaq0OYVvO/FjTl93aFXa7t9Ww5dniTcGbJKcp DGZ0CNe071uEHHBnsLnFdwHRHRiViAEFvK71EJ6BgRszii2X+GRxOmseslX/a/39oW6/ PpeO4S1y3sJ/VJSrl4kjWfIv5FUtWoibeTAcwj5etuqwuT0RFjEsLNRf1qYOW/CGXJkj iqCVgz6HqiIeQoDlITrBqYCpuSSZkgzy6SP/3xZv1Ws995KafrjSzwUXbWE3iM7Tecp/ KLAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=egv8gBhUCwez9IoA3piXkzNWat3a9Q7nOx3S/lPZw9k=; b=o//7icSD1ERn5ez+KN8reMsTCsm0KUK5wo0yuyaKRzUzm4LUVpstIpIsTMX0tpvamI e8KvE6DQznk1BhzDZwinHKwpbVuzgr+M35kbqew5HgSyJHRSLOyE+NF+EiP80QejMQo2 YCZMK3Q+RaO/YyKTlCd0iPfbT+Oa5UctghKVC4SXupJLtd0LxlF/J5rEPi3nXkYeHcUj 81+yFAgDTJ9pzaJNrWmvs7oYaqS6CaBmvP7gSgYPJ8YJ78EjkmrY+mGMadghqlyC9y2i Lr+Hzqtld/hkXtD6sPt0kow0W44KQsy9ZfdNQQVCmAvyaG3/aI5NeLBrAuNGMkXsg6af o3ZA== X-Gm-Message-State: APjAAAWEftxwTUKhsh653Om/qhgLeiTdlUO0Aq9N6Jx82/vf0Ji+dBpM kOgp1gcAtgKBbiDrhLgIZvaI+n/1OeyKOFzjvO2hkw== X-Received: by 2002:a6b:e20e:: with SMTP id z14mr1259647ioc.169.1556653930964; Tue, 30 Apr 2019 12:52:10 -0700 (PDT) MIME-Version: 1.0 References: <20190227202658.197113-1-matthewgarrett@google.com> <20190227202658.197113-3-matthewgarrett@google.com> In-Reply-To: From: Matthew Garrett Date: Tue, 30 Apr 2019 12:51:59 -0700 Message-ID: Subject: Re: [PATCH V5 2/4] tpm: Reserve the TPM final events table To: Bartosz Szczepanek Cc: linux-integrity , Peter Huewe , Jarkko Sakkinen , Jason Gunthorpe , Roberto Sassu , linux-efi , LSM List , Linux Kernel Mailing List , =?UTF-8?Q?Thi=C3=A9baud_Weksteen?= Content-Type: multipart/mixed; boundary="00000000000098970e0587c4bc96" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --00000000000098970e0587c4bc96 Content-Type: text/plain; charset="UTF-8" On Tue, Apr 30, 2019 at 6:07 AM Bartosz Szczepanek wrote: > > I may be a little late with this comment, but I've just tested these > patches on aarch64 platform (from the top of jjs/master) and got > kernel panic ("Unable to handle kernel read", full log at the end of > mail). I think there's problem with below call to > tpm2_calc_event_log_size(), where physical address of efi.tpm_log is > passed as (void *) and never remapped: Yes, it looks like this is just broken. Can you try with the attached patch? --00000000000098970e0587c4bc96 Content-Type: text/x-patch; charset="US-ASCII"; name="fix_log.diff" Content-Disposition: attachment; filename="fix_log.diff" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_jv47jttc0 ZGlmZiAtLWdpdCBhL2RyaXZlcnMvZmlybXdhcmUvZWZpL3RwbS5jIGIvZHJpdmVycy9maXJtd2Fy ZS9lZmkvdHBtLmMKaW5kZXggZmU0ODE1MGYwNmQxLi45NzExYmQzNGY4YWUgMTAwNjQ0Ci0tLSBh L2RyaXZlcnMvZmlybXdhcmUvZWZpL3RwbS5jCisrKyBiL2RyaXZlcnMvZmlybXdhcmUvZWZpL3Rw bS5jCkBAIC0yOCw2ICsyOCw3IEBAIHN0YXRpYyBpbnQgdHBtMl9jYWxjX2V2ZW50X2xvZ19zaXpl KHZvaWQgKmRhdGEsIGludCBjb3VudCwgdm9pZCAqc2l6ZV9pbmZvKQogCQlpZiAoZXZlbnRfc2l6 ZSA9PSAwKQogCQkJcmV0dXJuI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