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: <diqzzfq55o7k.fsf@ackerleytng-ctop.c.googlers.com>
Date: Thu, 25 Jul 2024 18:19:27 +0000
From: Ackerley Tng <ackerleytng@...gle.com>
To: Yan Zhao <yan.y.zhao@...el.com>
Cc: sagis@...gle.com, linux-kselftest@...r.kernel.org, afranji@...gle.com, 
	erdemaktas@...gle.com, isaku.yamahata@...el.com, seanjc@...gle.com, 
	pbonzini@...hat.com, shuah@...nel.org, pgonda@...gle.com, haibo1.xu@...el.com, 
	chao.p.peng@...ux.intel.com, vannapurve@...gle.com, runanwang@...gle.com, 
	vipinsh@...gle.com, jmattson@...gle.com, dmatlack@...gle.com, 
	linux-kernel@...r.kernel.org, kvm@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [RFC PATCH v5 07/29] KVM: selftests: TDX: Update
 load_td_memory_region for VM memory backed by guest memfd

Ackerley Tng <ackerleytng@...gle.com> writes:


> Yan Zhao <yan.y.zhao@...el.com> writes:
>
>> On Tue, Dec 12, 2023 at 12:46:22PM -0800, Sagi Shahar wrote:
>>> From: Ackerley Tng <ackerleytng@...gle.com>
>>> 
>>> If guest memory is backed by restricted memfd
>>> 
>>> + UPM is being used, hence encrypted memory region has to be
>>>   registered
>>> + Can avoid making a copy of guest memory before getting TDX to
>>>   initialize the memory region
>>> 
>>> <snip>
>>
>> For memslot 0, 1, 2, when guest_memfd != -1,
>> is it possible to also munmap(mmap_start, mmap_size) after finish loading?
>>
>
> Thank you for your review!
>
> Did you mean "possible" as in whether it is "correct" to do munmap() for
> the rest of the earlier memslots containing non-test-code?
>
> It is correct because the munmap() just deallocates memory that was
> recently allocated in mmap() in this same change. The memory set up for
> the VM is not affected.
>
> <snip>
>
> If we are not using guest_memfd (region->region.guest_memfd == -1), then
> we need to make the source and destination address different by copying
> the contents at the source address somewhere else for the call to
> tdx_init_mem_region(). That is what the mmap() is doing. This temporary
> buffer then needs to be freed, hence the munmap(). Without this copying,
> the destination address for the ioctl's copy would be the same as the
> source address, since those very same pages are provided in the memslot
> for this memory region.
>

Update on this:

Since TDX requires the use of guest_memfd, this patch will be simplified
in the next revision.

The checks for region->region.guest_memfd != -1 will be removed, and
there will be no need to do any mmap() or munmap(), so those will be
removed as well.

> If we are using guest_memfd, then the destination address for the
> ioctl's copy will be taken from the guest_memfd, which is already
> different from the source address, hence we can skip the copying.
>

>>>  }
>>>  
>>> -- 
>>> 2.43.0.472.g3155946c3a-goog
>>> 
>>> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ