From: Guo Zihao <guozh23@xiaopeng.com>
To: Jarkko Sakkinen <jarkko@kernel.org>
Cc: Peter Huewe <peterhuewe@gmx.de>, Jason Gunthorpe <jgg@ziepe.ca>,
Ard Biesheuvel <ardb@kernel.org>,
Matthew Garrett <matthewgarrett@google.com>,
linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH] tpm: efi: reject a final events table with an oversized preboot log
Date: Mon, 09 Nov 2026 09:49:34 +0800 [thread overview]
Message-ID: <179418897414.2773996.1582380807629789288@xiaopeng.com> (raw)
In-Reply-To: <au3xM-7onNTtgceh@kernel.org>
On Fri, Nov 06, 2026 at 03:24:39PM +0000, Jarkko Sakkinen wrote:
> Ditto.
>
> For all four address validation vs bug fix intersection. I did not
> check throughly enough to be exactly sure of all four.
For this one I'd like to argue the bug fix case, since the data being
validated is not something the TPM reports over a TCG-defined
protocol: both sizes come from EFI configuration tables written by
firmware, and nothing in the TCG spec constrains what firmware puts
there.
The firmware data is already treated as untrusted in the same
function: it bails out on an empty log (log_tbl->size == 0), on a
missing final log address, and on a wrong log format version. The
unchecked subtraction is the odd one out.
The consequence is also plain memory corruption rather than a
graceful rejection: final_events_log_size goes negative, the
following devm_krealloc() gets a wrapped size, and the memcpy()
appending the final events log runs with a negative length.
And the out-of-bounds write was introduced by 166a2809d65b ("tpm:
Don't duplicate events from the final event log in the TCG2 log"):
before that commit nothing subtracted the preboot size, so a
malformed table was harmless. The Fixes: tag refers to that
regression, not to the malformed table itself.
Ard also had a look at v2 and only asked for a pr_warn() on the
rejection path, which is in.
So I'd like to keep the Fixes: tag here, but I'm happy to drop it if
you disagree - your tree, your call.
Thanks.
next prev parent reply other threads:[~2026-11-09 1:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-06 1:49 Guo Zihao
2026-11-06 9:12 ` Ard Biesheuvel
2026-11-06 9:20 ` [PATCH v2] " Guo Zihao
2026-11-06 15:24 ` [PATCH] " Jarkko Sakkinen
2026-11-09 1:49 ` Guo Zihao [this message]
2026-11-09 14:43 ` Jarkko Sakkinen
2026-11-09 14:45 ` 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=179418897414.2773996.1582380807629789288@xiaopeng.com \
--to=guozh23@xiaopeng.com \
--cc=ardb@kernel.org \
--cc=jarkko@kernel.org \
--cc=jgg@ziepe.ca \
--cc=linux-integrity@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matthewgarrett@google.com \
--cc=peterhuewe@gmx.de \
--cc=stable@vger.kernel.org \
/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
all inboxes | Powered by JetHome®