Re: FW: [RFC PATCH] tpm: don't return -EINVAL if TPM command validation fails

Ken Goldman
2017-12-08T20:16:55Z

On 11/22/2017 3:13 PM, Jason Gunthorpe wrote:
> On Wed, Nov 22, 2017 at 09:16:25AM -0800, flihp wrote:
>
>> We can work around quirks in the kernel RM in user space if we must
>> (short term?) but I'm hesitant to do so in this case. Would feel better
>> about a short term work-around knowing it's only going to be short term.
>
> Pedantically, the kernel is not implementing a RM as per some spec, it
> is using the TPM features to create isolation.
>
> Both sides can be argued. In this case, I think the patch to add a TPM
> response buffer in this one case is reasonable, and does not look so
> complicated that it is dangerous in the kernel.
>
> However the kernel will continue to return errnos in various cases,
> and a userspace that cannot handle them is kinda broken :)

First, to handle the error, the user space TSS would have to know that
the RM is mapping what would normally (with the simulator or /dev/tpm0)
be the usual TPM response packet. This mapping isn't documented anywhere.

Second, if "handle" means "pass EINVAL back up to the application, which
will not have any idea what it means", that's easy. But sending the
application an error code or message that would permit them to debug is
much harder.

To me, it's like the difference between "file not found" and "disk error".