Re: [PATCH v8 06/11] x86/traps: Add #VE support for TDX guest

From: Dave Hansen
Date: Mon Oct 18 2021 - 10:09:40 EST


On 10/18/21 3:53 AM, Borislav Petkov wrote:
> On Sun, Oct 17, 2021 at 10:15:22AM -0700, Dave Hansen wrote:
>> I think it's equivalent to something like a 'pt_regs' or 'stack_info'
>> that we pass around in other exception handlers. It's always stack
>> allocated. It's never dynamically allocated and NULL is never passed
>> for some other semantic reason.
> Ok, but why is adding that check such a big deal?

It's really not a big deal.

> Are you saying that nothing else will call tdx_get_ve_info() in the
> future so we should trust the passed in *ve pointer blindly or should we
> simply add that cheap check just in case.
>
> I don't mind having it without it but wondering why a little defensive
> programming is a problem, at all.

It's not a problem. I think I'd just rather see a splat (oops or
WARN_ON_ONCE()) than silently returning an error.