Re: [PATCH] perf(message): avoid buffer copy during command parsing
Jarkko Sakkinen <[email protected]> Sun, 31 Aug 2025 18:19:18 +0300
| Newsgroups | dev.linux.lists.tpm-protocol,dev.linux.lists.tpm2 |
|---|---|
| Message-ID | <[email protected]> |
On Sun, Aug 31, 2025 at 06:01:45PM +0300, Jarkko Sakkinen wrote: > `tpm_parse_command` copies handles and parameters to a fixed-size temporary > 4 KiB buffer on the stack before invoking a command parser. > > Introduce `TpmParseCommandBody` trait implemented by `tpm_struct!`, > providing accessors for handles and parameters in the original command > buffer, thus zeroing out the large stack allocation. > > Signed-off-by: Jarkko Sakkinen <[email protected]> > --- > I plan to backport this also to 0.10.x branch, given signficancy. This is something left out of initial stretch, which I've had in my mind for some time. I postponed this change because stability was a priority over performance at the time. For the sake of symmetry I want to also rename `TpmHeaderCommand` as `TpmCommandBuild`, make `TpmHeader` decoupled from that trait, and finally change the constraint in `tpm_build_command` from `C: TpmHeaderCommand` to `C: TpmHeader + TpmCommandBuild`. This patch does not include that style change, given that it is first of all logically distinct and further cannot be backported to the 0.10.x branch. BR, Jarkko