Re: [PATCH v2 4/6] KEYS: trusted: Move tpm2_key_decode() to the TPM driver

From: James Bottomley
Date: Tue May 21 2024 - 17:59:36 EST


On Tue, 2024-05-21 at 22:44 +0100, David Howells wrote:
> Jarkko Sakkinen <jarkko@xxxxxxxxxx> wrote:
>
> > On Tue May 21, 2024 at 9:18 PM EEST, James Bottomley wrote:
> > ...
> > You don't save a single byte of memory with any constant that
> > dictates the size requirements for multiple modules in two disjoint
> > subsystems.
>
> I think James is just suggesting you replace your limit argument with
> a constant not that you always allocate that amount of memory.

Exactly. All we use it for is the -E2BIG check to ensure user space
isn't allowed to run away with loads of kernel memory.

> What the limit should be, OTOH, is up for discussion, but PAGE_SIZE
> seems not unreasonable.

A page is fine currently (MAX_BLOB_SIZE is 512). However, it may be
too small for some of the complex policies when they're introduced.
I'm not bothered about what it currently is, I just want it to be able
to be increased easily when the time comes.

James