On 08/02/17 13:22, Brijesh Singh wrote: > > > On 8/2/17 2:37 AM, Laszlo Ersek wrote: >> // >>> + // Zero the shared memory so that hypervisor no longer able to get >>> intelligentable >>> + // data. >>> + // >>> + SetMem ((VOID *) (UINTN)MapInfo->DeviceAddress, MapInfo->NumberOfBytes, >>> 0); >> Please use ZeroMem(). >> >> Furthermore, ZeroMem() should occur just before every FreePages() call: >> - when Unmap() releases the implicitly allocated bounce buffer >> - when FreeBuffer() releases the explicitly allocated common buffer >> (I thought I spelled this out in my previous email(s), but in >> retrospect it seems I only intended to :/ ) >> - in the virtio drivers' exit-boot-services callbacks, FreeBuffer() >> can't be called (only Unmap(), after the virtio reset), so the >> ZeroMem() should be done manually there. > > Not sure why do we need to ZeroMem() when FreeBuffer() is called for > explicitly allocated common buffer ? I thought before calling the > FreeBuffer() on common buffer, client will call Unmap() which will > restore the C-bit state on the common buffer and also update the > contents (i.e now common buffer will contain encrypted data). >
My bad, you are totally right -- when I wrote the above, I actually reviewed the "BusMasterCommonBuffer" section of my earlier message [email protected]">http://mid.mail-archive.com/[email protected] and I totally missed that in that message I had written "Client calls Unmap(). Unmap() restores the C bit in one fell swoop, and encrypts the buffer in-place (by bouncing it page-wise to the static array and back)." Sigh. Need more rest. Thanks for catching my error! Laszlo _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

