Re: [RFC PATCH V2 10/18] drivers: hv: Decrypt percpu hvcall input arg page in sev-snp enlightened guest

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/9/2022 5:52 AM, Dexuan Cui wrote:
@@ -134,6 +136,16 @@ int hv_common_cpu_init(unsigned int cpu)
  	if (!(*inputarg))
  		return -ENOMEM;

+	if (hv_isolation_type_en_snp()) {
+		ret = set_memory_decrypted((unsigned long)*inputarg, 1);
Is it possible hv_root_partition==1 here? If yes, the pgcount is 2.

Hi Dexuan:
Thanks for review. So far, root partition doesn't support sev enlightened guest and so here assume pgcount is always 1. We may use pgcount variable here instead of the number.

+		if (ret) {
+			kfree(*inputarg);
+			return ret;
+		}
+
+		memset(*inputarg, 0x00, PAGE_SIZE);
+	}
+
  	if (hv_root_partition) {
  		outputarg = (void **)this_cpu_ptr(hyperv_pcpu_output_arg);
  		*outputarg = (char *)(*inputarg) + HV_HYP_PAGE_SIZE;
@@ -168,6 +180,9 @@ int hv_common_cpu_die(unsigned int cpu)

  	local_irq_restore(flags);

+	if (hv_isolation_type_en_snp())
+		set_memory_encrypted((unsigned long)mem, 1);
If set_memory_encrypted() fails, we should not free the 'mem'.

Good point. Will update in the next version.



[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux