lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1019158c-a854-4e29-b9ec-961fb878bab3@linux.intel.com>
Date:   Tue, 3 Oct 2023 07:01:44 -0700
From:   Kuppuswamy Sathyanarayanan 
        <sathyanarayanan.kuppuswamy@...ux.intel.com>
To:     Yi Sun <yi.sun@...el.com>
Cc:     kirill.shutemov@...ux.intel.com, linux-kernel@...r.kernel.org,
        heng.su@...el.com, yi.sun@...ux.intel.com,
        Dongcheng Yan <dongcheng.yan@...el.com>
Subject: Re: [PATCH v3] x86/tdx: Dump TDX version During the TD Bootup



On 10/3/2023 6:56 AM, Yi Sun wrote:
> On 03.10.2023 06:26, Kuppuswamy Sathyanarayanan wrote:
>>
>>
>> On 9/30/2023 9:11 AM, Yi Sun wrote:
>>> +static int tdg_get_sysinfo(struct tdg_sys_info *td_sys)
>>> +{
>>> +    struct tdx_module_output out;
>>> +    u64 ret;
>>> +
>>> +    if (!td_sys)
>>> +        return -EINVAL;
>>> +
>>> +    ret = __tdx_module_call(TDX_SYS_RD, 0, TDX_SYS_VENDOR_ID_FID, 0, 0,
>>> +                &out);
>>> +    if (TDCALL_RETURN_CODE(ret) == TDCALL_INVALID_OPERAND)
>>> +        goto version_1_0;
>>> +    else if (ret)
>>> +        return ret;
>>
>> For this failure case, do you want to reset tdg_sys_info to some value like zero
>> or some constants to specify unknown?
> Yes, that would be better for this case.
> 
>>> +
>>> +    td_sys->vendor_id = (u32)out.r8;
>>> +
>>> +    ret = __tdx_module_call(TDX_SYS_RD, 0, TDX_SYS_MAJOR_FID, 0, 0, &out);
>>> +    if (ret)
>>> +        return ret;
>>> +
>>> +    td_sys->major_version = (u16)out.r8;
>>> +
>>> +    ret = __tdx_module_call(TDX_SYS_RD, 0, TDX_SYS_MINOR_FID, 0, 0, &out);
>>> +    if (ret)
>>> +        return ret;
>>> +
>>> +    td_sys->minor_version = (u16)out.r8;
>>> +
>>> +    return 0;
>>> +
>>> +    /* TDX 1.0 does not have the TDCALL TDG.SYS.RD */
>>> +version_1_0:
>>> +    td_sys->vendor_id = TDX_VENDOR_INTEL;
>>> +    td_sys->major_version = 1;
>>> +    td_sys->minor_version = 0;
>>> +
>>> +    return 0;
>>> +}
>>> +
>>>  void __init tdx_early_init(void)
>>>  {
>>>      u64 cc_mask;
>>>      u32 eax, sig[3];
>>> +    struct tdg_sys_info td_sys_info;
>>>
>>>      cpuid_count(TDX_CPUID_LEAF_ID, 0, &eax, &sig[0], &sig[2],  &sig[1]);
>>>
>>> @@ -820,5 +882,9 @@ void __init tdx_early_init(void)
>>>       */
>>>      x86_cpuinit.parallel_bringup = false;
>>>
>>> -    pr_info("Guest detected\n");
>>> +    tdg_get_sysinfo(&td_sys_info);
>>
>> Why not check the return value before dumping the info?
>>
> I overlooked that. I will add it in the next version.
> Thanks Sathya for your comments.

if you plan to zero out the td_sys_info value in error case, I think it
is better to make the tdg_get_sysinfo as void

> 
> Thanks
>      --Yi Sun

-- 
Sathyanarayanan Kuppuswamy
Linux Kernel Developer

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ