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] [thread-next>] [day] [month] [year] [list]
Message-ID: <3437ff11-4656-2c2a-ae58-04b77b6ff663@linux.intel.com>
Date:   Thu, 10 Jun 2021 14:01:41 -0700
From:   "Kuppuswamy, Sathyanarayanan" 
        <sathyanarayanan.kuppuswamy@...ux.intel.com>
To:     Borislav Petkov <bp@...en8.de>
Cc:     Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Andy Lutomirski <luto@...nel.org>,
        Peter H Anvin <hpa@...or.com>,
        Dave Hansen <dave.hansen@...el.com>,
        Tony Luck <tony.luck@...el.com>,
        Dan Williams <dan.j.williams@...el.com>,
        Andi Kleen <ak@...ux.intel.com>,
        Kirill Shutemov <kirill.shutemov@...ux.intel.com>,
        Kuppuswamy Sathyanarayanan <knsathya@...nel.org>,
        Sean Christopherson <seanjc@...gle.com>,
        linux-kernel@...r.kernel.org, x86@...nel.org
Subject: Re: [PATCH v1 04/11] x86/x86: Add is_tdx_guest() interface



On 6/10/21 12:59 PM, Borislav Petkov wrote:
> On Tue, Jun 01, 2021 at 07:21:29PM -0700, Kuppuswamy Sathyanarayanan wrote:

>> +	if (memcmp("IntelTDX    ", signature, 12))
>> +		return false;
>> +
>> +	return true;
> 
> As before,
> 
>   return !memcmp(...
> 
> and then that function can return simply an int.

I will make the above change in next version.

> 
> 
>> +}
>> +
>> +bool is_tdx_guest(void)
> 
> If anything, this should be early_is_tdx_guest().

If this is the recommendation, I am fine with it. It is
only used by __in/__out macros in decompression code.

> 
>> +{
>> +	if (tdx_guest < 0)
>> +		tdx_guest = native_cpuid_has_tdx_guest();
>> +
>> +	return !!tdx_guest;
>> +}
>> +
> 
> Applying: x86/x86: Add is_tdx_guest() interface
> .git/rebase-apply/patch:58: new blank line at EOF.
> +
> warning: 1 line adds whitespace errors.

I will fix it in next version.

> 
> 
>> diff --git a/arch/x86/kernel/tdx.c b/arch/x86/kernel/tdx.c
>> index 5b14b72e41c5..5e70617e9877 100644
>> --- a/arch/x86/kernel/tdx.c
>> +++ b/arch/x86/kernel/tdx.c
>> @@ -19,6 +19,12 @@ static inline bool cpuid_has_tdx_guest(void)
>>   	return true;
>>   }
>>   
>> +bool is_tdx_guest(void)
>> +{
>> +	return static_cpu_has(X86_FEATURE_TDX_GUEST);
>> +}
>> +EXPORT_SYMBOL_GPL(is_tdx_guest);
> 
> I don't like this is_tdx_guest() thing in kernel proper - what's wrong
> with
> 
>    prot_guest_has(PR_GUEST_TDX)

Is it alright to use vendor name in prot_guest_has() flag? I thought
we want to keep them generic. If this is acceptable, we can replace
is_tdx_guest() with prot_guest_has() calls. Currently it is not used
in many places.

> 
> ?
> 
> Also, why is it exported, for kvm?

Yes. It is used in exported KVM functions.

> 
> Thx.
> 

-- 
Sathyanarayanan Kuppuswamy
Linux Kernel Developer

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ