linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Berger <stefanb@linux.ibm.com>
To: Jarkko Sakkinen <jarkko@kernel.org>
Cc: peterhuewe@gmx.de, jgg@ziepe.ca, linux-integrity@vger.kernel.org,
	linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org, mjg59@google.com
Subject: Re: [PATCH v2 1/3] tpm: efi: Use local variable for calculating final log size
Date: Thu, 11 Mar 2021 09:02:38 -0500	[thread overview]
Message-ID: <39ea4fef-0a21-ad06-118f-dbdf01cd5c61@linux.ibm.com> (raw)
In-Reply-To: <YElVN0kwMIyeF9gQ@kernel.org>


On 3/10/21 6:24 PM, Jarkko Sakkinen wrote:
> On Thu, Mar 11, 2021 at 01:21:47AM +0200, Jarkko Sakkinen wrote:
>> On Wed, Mar 10, 2021 at 05:19:14PM -0500, Stefan Berger wrote:
>>> When tpm_read_log_efi is called multiple times, which happens when
>>> one loads and unloads a TPM2 driver multiple times, then the global
>>> variable efi_tpm_final_log_size will at some point become a negative
>>> number due to the subtraction of final_events_preboot_size occurring
>>> each time. Use a local variable to avoid this integer underflow.
>>>
>>> The following issue is now resolved:
>>>
>>> Mar  8 15:35:12 hibinst kernel: Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015
>>> Mar  8 15:35:12 hibinst kernel: Workqueue: tpm-vtpm vtpm_proxy_work [tpm_vtpm_proxy]
>>> Mar  8 15:35:12 hibinst kernel: RIP: 0010:__memcpy+0x12/0x20
>>> Mar  8 15:35:12 hibinst kernel: Code: 00 b8 01 00 00 00 85 d2 74 0a c7 05 44 7b ef 00 0f 00 00 00 c3 cc cc cc 66 66 90 66 90 48 89 f8 48 89 d1 48 c1 e9 03 83 e2 07 <f3> 48 a5 89 d1 f3 a4 c3 66 0f 1f 44 00 00 48 89 f8 48 89 d1 f3 a4
>>> Mar  8 15:35:12 hibinst kernel: RSP: 0018:ffff9ac4c0fcfde0 EFLAGS: 00010206
>>> Mar  8 15:35:12 hibinst kernel: RAX: ffff88f878cefed5 RBX: ffff88f878ce9000 RCX: 1ffffffffffffe0f
>>> Mar  8 15:35:12 hibinst kernel: RDX: 0000000000000003 RSI: ffff9ac4c003bff9 RDI: ffff88f878cf0e4d
>>> Mar  8 15:35:12 hibinst kernel: RBP: ffff9ac4c003b000 R08: 0000000000001000 R09: 000000007e9d6073
>>> Mar  8 15:35:12 hibinst kernel: R10: ffff9ac4c003b000 R11: ffff88f879ad3500 R12: 0000000000000ed5
>>> Mar  8 15:35:12 hibinst kernel: R13: ffff88f878ce9760 R14: 0000000000000002 R15: ffff88f77de7f018
>>> Mar  8 15:35:12 hibinst kernel: FS:  0000000000000000(0000) GS:ffff88f87bd00000(0000) knlGS:0000000000000000
>>> Mar  8 15:35:12 hibinst kernel: CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
>>> Mar  8 15:35:12 hibinst kernel: CR2: ffff9ac4c003c000 CR3: 00000001785a6004 CR4: 0000000000060ee0
>>> Mar  8 15:35:12 hibinst kernel: Call Trace:
>>> Mar  8 15:35:12 hibinst kernel: tpm_read_log_efi+0x152/0x1a7
>>> Mar  8 15:35:12 hibinst kernel: tpm_bios_log_setup+0xc8/0x1c0
>>> Mar  8 15:35:12 hibinst kernel: tpm_chip_register+0x8f/0x260
>>> Mar  8 15:35:12 hibinst kernel: vtpm_proxy_work+0x16/0x60 [tpm_vtpm_proxy]
>>> Mar  8 15:35:12 hibinst kernel: process_one_work+0x1b4/0x370
>>> Mar  8 15:35:12 hibinst kernel: worker_thread+0x53/0x3e0
>>> Mar  8 15:35:12 hibinst kernel: ? process_one_work+0x370/0x370
>>>
>>> Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
>> Fixes tag for this one?
> Or just sanity check, I think it is:
>
> Fixes: 166a2809d65b ("tpm: Don't duplicate events from the final event log in the TCG2 log")
Looks good.
>
> Also, I guess all of the patches ought to have stable cc, right?

Yes, please. I think the maintainer has to add this 'at some point'.

Since you queued them already I won't send a v3.


Thanks!

    Stefan



  reply	other threads:[~2021-03-11 14:03 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-10 22:19 [PATCH v2 0/3] Fix bugs related to TPM2 event log Stefan Berger
2021-03-10 22:19 ` [PATCH v2 1/3] tpm: efi: Use local variable for calculating final log size Stefan Berger
2021-03-10 23:14   ` Jarkko Sakkinen
2021-03-10 23:21   ` Jarkko Sakkinen
2021-03-10 23:24     ` Jarkko Sakkinen
2021-03-11 14:02       ` Stefan Berger [this message]
2021-03-12 16:54         ` Jarkko Sakkinen
2021-03-10 22:19 ` [PATCH v2 2/3] tpm: acpi: Check eventlog signature before using it Stefan Berger
2021-03-10 23:13   ` Jarkko Sakkinen
2021-03-10 22:19 ` [PATCH v2 3/3] tpm: vtpm_proxy: Avoid reading host log when using a virtual device Stefan Berger
2021-03-10 23:04   ` Jarkko Sakkinen
2021-03-10 23:04 ` [PATCH v2 0/3] Fix bugs related to TPM2 event log Jarkko Sakkinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=39ea4fef-0a21-ad06-118f-dbdf01cd5c61@linux.ibm.com \
    --to=stefanb@linux.ibm.com \
    --cc=jarkko@kernel.org \
    --cc=jgg@ziepe.ca \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=mjg59@google.com \
    --cc=peterhuewe@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).