From: Takashi Iwai <tiwai@suse.de>
To: "Liang, Andy (Linux Ecosystem Engineering)" <andy.liang@hpe.com>
Cc: Takashi Iwai <tiwai@suse.de>,
Stefan Berger <stefanb@linux.ibm.com>,
Paul Menzel <pmenzel@molgen.mpg.de>,
Jarkko Sakkinen <jarkko@kernel.org>,
Peter Huewe <peterhuewe@gmx.de>, Jason Gunthorpe <jgg@ziepe.ca>,
"linux-integrity@vger.kernel.org"
<linux-integrity@vger.kernel.org>,
"Golmitz,
Jenifer (Linux Ecosystem Engineering)" <jenifer.golmitz@hpe.com>
Subject: Re: [PATCH] tpm/eventlog: Use kvmalloc() for event log buffer
Date: Fri, 08 Nov 2024 10:28:26 +0100 [thread overview]
Message-ID: <87o72qf51h.wl-tiwai@suse.de> (raw)
In-Reply-To: <PH7PR84MB19575D91A43C2D4C7C842038995D2@PH7PR84MB1957.NAMPRD84.PROD.OUTLOOK.COM>
On Fri, 08 Nov 2024 09:48:38 +0100,
Liang, Andy (Linux Ecosystem Engineering) wrote:
>
>
> > On Thu, 07 Nov 2024 20:31:37 +0100,
> > Stefan Berger wrote:
> > >
> > >
> > >
> > > On 11/7/24 2:06 PM, Stefan Berger wrote:
> > > >
> > > >
> > > > On 11/7/24 7:38 AM, Takashi Iwai wrote:
> > > >> On Thu, 07 Nov 2024 13:17:33 +0100, Paul Menzel wrote:
> >> >>>
> >> >>> Dear Takashi,
> >> >>>
> >> >>>
> >> >>> Thank you for the patch.
> >> >>>
> >> >>> Am 07.11.24 um 12:18 schrieb Takashi Iwai:
> >> >>>> The TPM2 ACPI table may request a large size for the event log,
> >> >>>> and it may be over the max size of kmalloc(). When this happens,
> >> >>>> the driver
> >> >>>
> >> >>> What is kmalloc()’s maximum size?
> >> >>
> >> >> 128kB or so, IIRC.
> >> >> And according Andy, the table can be over 4MB.
> >> >
> >> > Can you copy the contents of the file on that machine and tell us
> >> > what size it has:
> >> >
> >> > cp /sys/kernel/security/tpm0/binary_bios_measurements ./
> >>
> >> Actually, you may need to have the contents parsed by a user space
> >> tool since the driver does not detect where the actual end may be:
> >>
> >> tsseventextend -if ./binary_bios_measurements -sim -v
> >>
> >> This may give you a feeling for how much is in that file and then
> >> you'd have to truncate it into half for example and see whether it
> >> still parses the same. My point is that we haven't seen such
> >> excessive-sized logs so far and following the parsing above we may
> >> find something like this more useful than allocating possibly large
> >> amounts of memory that a buggy ACPI table indicates (+ notify
> >> manufacturer):
> >>
> >> if (len > MAX_TPM_LOG_SIZE) {
> >> dev_err(&chip->dev, "Truncated excessive-sized TPM log of %d
> >> bytes\n", len);
> >> len = MAX_TPM_LOG_SIZE;
> >> }
> >>
> >> If you send me the log I'd look at it.
>
> > It's rather a question Andy; could you check give the requested info?
>
>
> https://elixir.bootlin.com/linux/v6.8/source/arch/x86/include/asm/page_types.h#L10
> #define PAGE_SHIFT 12
> #define KMALLOC_SHIFT_MAX (MAX_PAGE_ORDER + PAGE_SHIFT)
>
> https://elixir.bootlin.com/linux/v6.8/source/include/linux/mmzone.h#L30
> #define MAX_PAGE_ORDER 10
>
> https://elixir.bootlin.com/linux/v6.8/source/include/linux/slab.h#L309
> #define KMALLOC_MAX_SIZE (1UL << KMALLOC_SHIFT_MAX)
> The max size = (1UL << MAX_PAGE_ORDER + PAGE_SHIFT) = ( 1UL << (10 + 12)) = 2^22 =4,194,304 (4MB)
>
> For the x86, the max size is 4MB.
Thanks, it was already corrected by Jarkko :)
But what I meant was about the requests:
> cp /sys/kernel/security/tpm0/binary_bios_measurements ./
and
> tsseventextend -if ./binary_bios_measurements -sim -v
mentioned in the above. Could you provide the info?
thanks,
Takashi
next prev parent reply other threads:[~2024-11-08 9:28 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-07 11:18 [PATCH] tpm/eventlog: Use kvmalloc() for event log buffer Takashi Iwai
2024-11-07 12:17 ` Paul Menzel
2024-11-07 12:38 ` Takashi Iwai
2024-11-07 19:06 ` Stefan Berger
2024-11-07 19:31 ` Stefan Berger
2024-11-08 8:24 ` Takashi Iwai
2024-11-08 8:48 ` Liang, Andy (Linux Ecosystem Engineering)
2024-11-08 9:28 ` Takashi Iwai [this message]
2024-11-11 8:43 ` Liang, Andy (Linux Ecosystem Engineering)
2024-11-12 17:56 ` Jarkko Sakkinen
2024-11-13 3:00 ` Liang, Andy (Linux Ecosystem Engineering)
2024-11-07 20:42 ` Jarkko Sakkinen
2024-11-08 8:22 ` Takashi Iwai
2024-11-07 20:32 ` Jarkko Sakkinen
2024-11-07 20:44 ` Jarkko Sakkinen
2024-11-08 8:21 ` Takashi Iwai
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=87o72qf51h.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=andy.liang@hpe.com \
--cc=jarkko@kernel.org \
--cc=jenifer.golmitz@hpe.com \
--cc=jgg@ziepe.ca \
--cc=linux-integrity@vger.kernel.org \
--cc=peterhuewe@gmx.de \
--cc=pmenzel@molgen.mpg.de \
--cc=stefanb@linux.ibm.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.