swiotlb: Do not zero buffer in set_memory_decrypted()
PATCH 1/1 swiotlb: Do not zero buffer in set_memory_decrypted()
For larger TDX VM, memset() after set_memory_decrypted() in swiotlb_update_mem_attributes() takes substantial portion of boot time.
Zeroing doesn't serve any functional purpose. Malicious VMM can mess with decrypted/shared buffer at any point.
Remove the memset().
--- kernel/dma/swiotlb.c | 2 -- 1 file changed, 2 deletions(-)
kernel/dma/swiotlb.c +0 -2
@@ -207,8 +207,6 @@ void __init swiotlb_update_mem_attributes(void) mem->vaddr =swiotlb_mem_remap (mem, bytes);if (!mem->vaddr) mem->vaddr = vaddr; - -memset (mem->vaddr,0 , bytes); } static void swiotlb_init_io_tlb_mem(struct io_tlb_mem *mem, phys_addr_t start,
Signature · 6 lines
2.34.1 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Quoted 9 lines · Kirill A. Shutemov
For larger TDX VM,
memset()afterset_memory_decrypted()inswiotlb_update_mem_attributes()takes substantial portion of boot time.Zeroing doesn't serve any functional purpose. Malicious VMM can mess with decrypted/shared buffer at any point.
Remove the
memset().Signed-off-by Kirill A. Shutemov <[email protected]>
Quoted 9 lines
--- kernel/dma/swiotlb.c | 2 -- 1 file changed, 2 deletions(-)kernel/dma/swiotlb.c +0
-0
kernel/dma/swiotlb.c void __init swiotlb_update_mem_attributes(void) · line 212
Quoted 8 lines
kernel/dma/swiotlb.c +0
-2@@ -207,8 +207,6 @@ void __init swiotlb_update_mem_attributes(void) mem->vaddr =swiotlb_mem_remap (mem, bytes);if (!mem->vaddr) mem->vaddr = vaddr; - -memset (mem->vaddr,0 , bytes); } static void swiotlb_init_io_tlb_mem(struct io_tlb_mem *mem, phys_addr_t start,
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
Thanks,
applied to the dma-mapping for-next tree.
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu