lkml.org 
[lkml]   [2021]   [Oct]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v10 06/11] x86/traps: Add #VE support for TDX guest
From
Date
On 10/16/21 7:45 PM, Sathyanarayanan Kuppuswamy wrote:
>>> +bool tdx_get_ve_info(struct ve_info *ve)
>>> +{
>>> +    struct tdx_module_output out;
>>> +    u64 ret;
>>> +
>>> +    if (!ve)
>>> +        return false;
>> This should be WARN_ON_ONCE() if at all.
>
> This is an input validation. Since we need to de-reference "ve" in
> the following code, we want to validate it to avoid NULL pointer
> exception. As per current usage of this function, "ve" will not be
> NULL. But we have added this check as a extra precaution against
> future use cases.
Input validation, eh?

It's one thing if this argument comes from userspace, or is even open
for modules to call. You *might* have an argument that it should be
checked in case something in the kernel goes insane.

But, there's a single call site. It looks like this:

> +DEFINE_IDTENTRY(exc_virtualization_exception)
> +{
> + struct ve_info ve;
...
> + ret = tdx_get_ve_info(&ve);

Could you please explain, given the existing kernel code, how !ve could
ever possibly happen? Or, how tdx_get_ve_info() might conceivably ever
be called from another path which is not extremely well controlled?

\
 
 \ /
  Last update: 2021-10-17 05:19    [W:0.055 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site