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().
Showing the changes to kernel (1 of 1 file). Show all
Unified · Split
| @@ -207,8 +207,6 @@ void __init swiotlb_update_mem_attributes(void) · 206 unmodified lines | |||
| 207 | mem->vaddr = swiotlb_mem_remap(mem, bytes); | 207 | mem->vaddr = swiotlb_mem_remap(mem, bytes); |
| 208 | if (!mem->vaddr) | 208 | if (!mem->vaddr) |
| 209 | mem->vaddr = vaddr; | 209 | mem->vaddr = vaddr; |
| 210 | |||
| 211 | memset(mem->vaddr, 0, bytes); | ||
| 212 | } | 210 | } |
| 213 | 211 | ||
| 214 | static void swiotlb_init_io_tlb_mem(struct io_tlb_mem *mem, phys_addr_t start, | 212 | static void swiotlb_init_io_tlb_mem(struct io_tlb_mem *mem, phys_addr_t start, |