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: <4db13429-ffb0-debc-cec4-e37d0e526934@gmail.com>
Date:   Thu, 4 May 2023 08:38:46 -0700
From:   Tianyu Lan <ltykernel@...il.com>
To:     Zhi Wang <zhi.wang.linux@...il.com>
Cc:     luto@...nel.org, tglx@...utronix.de, mingo@...hat.com,
        bp@...en8.de, dave.hansen@...ux.intel.com, x86@...nel.org,
        hpa@...or.com, seanjc@...gle.com, pbonzini@...hat.com,
        jgross@...e.com, tiala@...rosoft.com, kirill@...temov.name,
        jiangshan.ljs@...group.com, peterz@...radead.org,
        ashish.kalra@....com, srutherford@...gle.com,
        akpm@...ux-foundation.org, anshuman.khandual@....com,
        pawan.kumar.gupta@...ux.intel.com, adrian.hunter@...el.com,
        daniel.sneddon@...ux.intel.com, alexander.shishkin@...ux.intel.com,
        sandipan.das@....com, ray.huang@....com, brijesh.singh@....com,
        michael.roth@....com, thomas.lendacky@....com,
        venu.busireddy@...cle.com, sterritt@...gle.com,
        tony.luck@...el.com, samitolvanen@...gle.com, fenghua.yu@...el.com,
        pangupta@....com, linux-kernel@...r.kernel.org,
        kvm@...r.kernel.org, linux-hyperv@...r.kernel.org,
        linux-arch@...r.kernel.org
Subject: Re: [RFC PATCH V5 03/15] x86/hyperv: Set Virtual Trust Level in VMBus
 init message

On 5/2/2023 12:30 PM, Zhi Wang wrote:
> On Mon,  1 May 2023 04:57:13 -0400
> Tianyu Lan <ltykernel@...il.com> wrote:
> 
>> From: Tianyu Lan <tiala@...rosoft.com>
>>
>> sev-snp guest provides vtl(Virtual Trust Level) and
>> get it from hyperv hvcall via HVCALL_GET_VP_REGISTERS.
>> Set target vtl in the VMBus init message.
>>
>> Signed-off-by: Tianyu Lan <tiala@...rosoft.com>
>> ---
>> Change since RFC v4:
>>         * Use struct_size to calculate array size.
>>         * Fix some coding style
>>
>> Change since RFC v3:
>>         * Use the standard helper functions to check hypercall result
>>         * Fix coding style
>>
>> Change since RFC v2:
>>         * Rename get_current_vtl() to get_vtl()
>>         * Fix some coding style issues
>> ---
>>   arch/x86/hyperv/hv_init.c          | 36 ++++++++++++++++++++++++++++++
>>   arch/x86/include/asm/hyperv-tlfs.h |  7 ++++++
>>   drivers/hv/connection.c            |  1 +
>>   include/asm-generic/mshyperv.h     |  1 +
>>   include/linux/hyperv.h             |  4 ++--
>>   5 files changed, 47 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c
>> index 9f3e2d71d015..331b855314b7 100644
>> --- a/arch/x86/hyperv/hv_init.c
>> +++ b/arch/x86/hyperv/hv_init.c
>> @@ -384,6 +384,40 @@ static void __init hv_get_partition_id(void)
>>   	local_irq_restore(flags);
>>   }
>>   
>> +static u8 __init get_vtl(void)
>> +{
>> +	u64 control = HV_HYPERCALL_REP_COMP_1 | HVCALL_GET_VP_REGISTERS;
>> +	struct hv_get_vp_registers_input *input;
>> +	struct hv_get_vp_registers_output *output;
>> +	u64 vtl = 0;
>> +	u64 ret;
>> +	unsigned long flags;
>> +
>> +	local_irq_save(flags);
>> +	input = *this_cpu_ptr(hyperv_pcpu_input_arg);
>> +	output = (struct hv_get_vp_registers_output *)input;
> 
> ===
>> +	if (!input) {
>> +		local_irq_restore(flags);
>> +		goto done;
>> +	}
>> +
> ===
> Is this really necessary?
> 
> drivers/hv/hv_common.c:
> 
>          hyperv_pcpu_input_arg = alloc_percpu(void  *);
>          BUG_ON(!hyperv_pcpu_input_arg);
> 
> 

Hi Zhi:
	The hyperv_pcpu_input_arg is a point to address of input arg
pages and these pages are allocated in the hv_common_cpu_init(). If
it failed to allocate these pages, the value pointed by 
hyperv_pcpu_input_arg will be NULL.
	

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ